Files
XplorePlane/build-release.ps1
T
XplorePlane Developer 957157ae80 fix: 修复编译错误、BGA向导预览、算子重复插入及状态栏消息
## Compilation fixes
- Fix XAML namespace reference XplorePlane.Converters → XplorePlane.Helpers (EventLogView, StateDisplayView)
- Add missing using for ISampleTypeRepository / JsonSampleTypeRepository in App.xaml.cs
- Fix ILoggerService.Warn() calls using Exception as first arg instead of message string
- Serialize CncProgram to JSON when passing to MatrixLayout (expects string, not CncProgram object)
- Suppress CS8632 nullable annotation warnings project-wide

## BGA wizard fixes
- Fix preview not showing on step 3: force RefreshBgaPreview() when entering final step
- Add step validation in CanNext() to prevent skipping to preview with invalid inputs
- Notify NextCommand.CanExecuteChanged when inputs change
- Fix RunProgress runtime binding error: set Mode=OneWay for ProgressBar.Value

## Operator toolbox: prevent duplicate insertion
- Add static OperatorTarget property for direct dispatch to active pipeline
- PipelineEditorView registers as toolbox target on load (floating window only)
- CNC page sets initial target; PipelineEditorWindow resets to CNC pipeline on close
- '+' button inserts only to the active pipeline instead of broadcasting to all subscribers

## Pipeline editor status bar messages
- Add StatusBarMessageEvent / StatusBarMessagePayload to CommonEvents.cs
- PipelineEditorViewModel publishes status on all ops (add/remove/reorder/save/execute)
- MainViewModel subscribes and displays on main window bottom status bar
- Auto-clear after timeout (3s info, 5s error)

## docs
- Merge three architecture docs into consolidated XplorePlane-架构与结构说明.md
2026-07-24 15:59:16 +08:00

132 lines
5.7 KiB
PowerShell

param(
# 不传时自动从 XplorePlane.csproj 的 <Version> 读取,传入则覆盖工程配置(用于临时测试版本号)
[string]$Version,
[string]$PackId = "Hexagon.XplorePlane",
[string]$MainExe = "XplorePlane.exe",
[string]$DeployDir = "C:\wamp64\www\updates\xploreplane",
[switch]$SkipBuild,
[string]$Configuration = "Release",
[string]$RuntimeId = "win-x64"
)
$ErrorActionPreference = "Stop"
$ProjectPath = Join-Path $PSScriptRoot "XplorePlane\XplorePlane.csproj"
$PublishDir = Join-Path $PSScriptRoot "publish"
$ReleasesDir = Join-Path $PSScriptRoot "Releases"
# 版本号来源:命令行 -Version 优先,否则从 csproj 的 <Version> 属性读取,
# 确保发布包版本号与工程配置保持单一来源,不再需要每次手动传参维护。
if (-not $Version) {
Write-Host "Reading version from csproj..." -ForegroundColor DarkGray
$Version = (dotnet msbuild $ProjectPath -nologo -getProperty:Version).Trim()
if ($LASTEXITCODE -ne 0 -or -not $Version) {
Write-Host "FAILED: Could not read <Version> from $ProjectPath. Pass -Version explicitly or add <Version> to the csproj." -ForegroundColor Red
exit 1
}
}
Write-Host ""
Write-Host "========================================================" -ForegroundColor Cyan
Write-Host " XplorePlane Build and Release Script" -ForegroundColor Cyan
Write-Host "========================================================" -ForegroundColor Cyan
Write-Host " Version: $Version" -ForegroundColor Cyan
Write-Host " PackId: $PackId" -ForegroundColor Cyan
Write-Host " Config: $Configuration" -ForegroundColor Cyan
Write-Host " Runtime: $RuntimeId" -ForegroundColor Cyan
Write-Host " DeployDir: $DeployDir" -ForegroundColor Cyan
Write-Host "========================================================" -ForegroundColor Cyan
Write-Host ""
# Step 1: Clean
Write-Host "[1/5] Cleaning publish directory..." -ForegroundColor Yellow
if (Test-Path $PublishDir) { Remove-Item $PublishDir -Recurse -Force }
# Step 2: Build and Publish
if (-not $SkipBuild) {
Write-Host "[2/5] Building and publishing ($Configuration, $RuntimeId)..." -ForegroundColor Yellow
dotnet publish $ProjectPath -c $Configuration --self-contained -r $RuntimeId -o $PublishDir
if ($LASTEXITCODE -ne 0) {
Write-Host "FAILED: dotnet publish failed!" -ForegroundColor Red
exit 1
}
Write-Host "OK: Build succeeded" -ForegroundColor Green
} else {
Write-Host "[2/5] Skipped build (-SkipBuild)" -ForegroundColor DarkGray
if (-not (Test-Path $PublishDir)) {
Write-Host "FAILED: publish directory not found, run without -SkipBuild first" -ForegroundColor Red
exit 1
}
}
# Step 3: Velopack Pack
Write-Host "[3/5] Packing with vpk..." -ForegroundColor Yellow
$vpkCmd = Get-Command vpk -ErrorAction SilentlyContinue
if (-not $vpkCmd) {
Write-Host " vpk not found, installing..." -ForegroundColor Yellow
dotnet tool install -g vpk
if ($LASTEXITCODE -ne 0) {
Write-Host "FAILED: vpk install failed" -ForegroundColor Red
exit 1
}
}
vpk pack --packId $PackId --packVersion $Version --packDir $PublishDir --mainExe $MainExe
if ($LASTEXITCODE -ne 0) {
Write-Host "FAILED: vpk pack failed!" -ForegroundColor Red
exit 1
}
Write-Host "OK: Pack succeeded, output in $ReleasesDir" -ForegroundColor Green
# Step 4: Deploy to WampServer
Write-Host "[4/5] Deploying to WampServer..." -ForegroundColor Yellow
if (-not (Test-Path $DeployDir)) {
New-Item -ItemType Directory -Path $DeployDir -Force | Out-Null
Write-Host " Created directory: $DeployDir" -ForegroundColor DarkGray
}
Copy-Item -Path (Join-Path $ReleasesDir "*") -Destination $DeployDir -Force -Recurse
Write-Host "OK: Deployed to $DeployDir" -ForegroundColor Green
# Step 5: Verify
Write-Host "[5/5] Verifying deployment..." -ForegroundColor Yellow
$releasesFile = Join-Path $DeployDir "RELEASES"
if (Test-Path $releasesFile) {
Write-Host " OK: RELEASES file exists" -ForegroundColor Green
$fullPkg = Get-ChildItem $DeployDir -Filter "*-full.nupkg" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if ($fullPkg) {
$sizeMB = [math]::Round($fullPkg.Length / 1MB, 1)
Write-Host " OK: Full package: $($fullPkg.Name) ($sizeMB MB)" -ForegroundColor Green
}
$deltaPkg = Get-ChildItem $DeployDir -Filter "*-delta.nupkg" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if ($deltaPkg) {
$sizeMB = [math]::Round($deltaPkg.Length / 1MB, 1)
Write-Host " OK: Delta package: $($deltaPkg.Name) ($sizeMB MB)" -ForegroundColor Green
}
$setupExe = Get-ChildItem $DeployDir -Filter "Setup*.exe" | Select-Object -First 1
if ($setupExe) {
Write-Host " OK: Setup: $($setupExe.Name)" -ForegroundColor Green
}
} else {
Write-Host " WARN: RELEASES file not found, deployment may be incomplete" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "========================================================" -ForegroundColor Cyan
Write-Host " Release complete!" -ForegroundColor Green
Write-Host ""
Write-Host " Update URL: http://localhost/updates/xploreplane" -ForegroundColor White
Write-Host " Setup: $DeployDir\Setup.exe" -ForegroundColor White
Write-Host ""
Write-Host " Make sure WampServer is running (Apache online)." -ForegroundColor DarkGray
Write-Host " Client App.config Update:ServerUrl should be:" -ForegroundColor DarkGray
Write-Host " http://<server-ip>/updates/xploreplane" -ForegroundColor White
Write-Host "========================================================" -ForegroundColor Cyan