feat: v1.2.0 开发进度更新
### 新增功能 - **Linux 官方支持**:新增 Hua.Todo.Avalonia 项目,正式适配 Linux 平台,同时支持 Windows 和 macOS - **Avalonia 桌面交互**:增加托盘菜单(显示/退出)、关闭隐藏到托盘、Windows 全局热键唤起主窗口、热键配置本地持久化 - **SQLite DateTime 兼容修复**:新增 LenientUtcDateTimeStringConverter,解决历史遗留的 DateTime 脏数据解析问题 - **用户文档完善**:新增 docs/manual/新手指南.md 和 docs/manual/用户指南.md - **部署文档**:新增 docs/manual/部署文档.md,详细说明多平台发布流程 ### 优化与修复 - **发布脚本整理**:拆分/对齐各平台发布入口,新增 publish.ps1 作为统一入口 - **Windows WebView2 优化**:数据目录调整到 %LocalAppData%\Hua.Todo\WebView2,修复 Runtime 误判问题 - **MAUI 多平台构建**:在 Windows 开发机上默认仅构建 Android + Windows 目标 - **SPA 路由回落**:修复 Release 模式下 /swagger 路径的 404 问题 - **Swagger 输出**:补齐 Dynamic API 端点,避免接口缺失 ### 文档更新 - **版本记录**:更新 v1.2.0 开发进度和功能列表 - **技术设计文档**:添加 Avalonia 项目架构和模块设计 - **项目结构**:更新 README.md 中的项目结构说明 ### 其他变更 - 新增 Directory.Build.props 和更新 Directory.Build.targets - 调整 src/Hua.Todo.Avalonia 项目配置和资源文件 - 更新 src/Hua.Todo.Web 前端资源文件 - 修复 src/Hua.Todo.Maui 相关配置和打包脚本
This commit is contained in:
+111
-27
@@ -7,6 +7,7 @@ param(
|
||||
|
||||
[switch]$LinuxSelfContained,
|
||||
|
||||
[ValidateSet("Release", "Debug")]
|
||||
[string]$Configuration = "Release",
|
||||
|
||||
[switch]$SkipWindowsInnoSetup,
|
||||
@@ -17,9 +18,92 @@ param(
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$ScriptPath = $PSScriptRoot
|
||||
|
||||
$WebDir = Join-Path $ScriptPath "src\Hua.Todo.Web"
|
||||
$publishWindowsScript = Join-Path $ScriptPath "publish-windows.ps1"
|
||||
$publishLinuxScript = Join-Path $ScriptPath "publish-linux.ps1"
|
||||
$DirectoryBuildProps = Join-Path $ScriptPath "Directory.Build.props"
|
||||
|
||||
function Stop-ProjectProcesses {
|
||||
Write-Host "Shutting down dotnet build servers..." -ForegroundColor Yellow
|
||||
dotnet build-server shutdown | Out-Null
|
||||
|
||||
Write-Host "Checking for running processes to prevent file locks..." -ForegroundColor Yellow
|
||||
|
||||
$processesToKill = Get-Process | Where-Object {
|
||||
$_.ProcessName -like "*Hua.Todo*" -or
|
||||
$_.ProcessName -eq "MSBuild" -or
|
||||
($_.ProcessName -eq "dotnet" -and ($_.CommandLine -like "*Hua.Todo*" -or $_.CommandLine -like "*msbuild*"))
|
||||
}
|
||||
|
||||
if ($processesToKill) {
|
||||
Write-Host "Stopping $($processesToKill.Count) running processes..." -ForegroundColor Yellow
|
||||
foreach ($p in $processesToKill) {
|
||||
try {
|
||||
Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
Write-Warning "Failed to stop process $($p.ProcessName) (ID: $($p.Id))"
|
||||
}
|
||||
}
|
||||
Start-Sleep -Seconds 2
|
||||
} else {
|
||||
Write-Host "No conflicting processes found." -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
function Build-Web {
|
||||
Write-Host "Building Web artifacts..." -ForegroundColor Cyan
|
||||
if (!(Test-Path $WebDir)) {
|
||||
Write-Error "Web directory not found: $WebDir"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (!(Test-Path (Join-Path $WebDir "node_modules"))) {
|
||||
Write-Host "Installing npm dependencies..." -ForegroundColor Yellow
|
||||
Push-Location $WebDir
|
||||
npm install
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
Write-Host "Running Web builds in parallel..." -ForegroundColor Yellow
|
||||
$webJobs = @()
|
||||
$webJobs += Start-Job -ScriptBlock {
|
||||
param($dir)
|
||||
Set-Location $dir
|
||||
npm run build
|
||||
} -ArgumentList $WebDir
|
||||
|
||||
$webJobs += Start-Job -ScriptBlock {
|
||||
param($dir)
|
||||
Set-Location $dir
|
||||
npm run build -- --mode maui
|
||||
} -ArgumentList $WebDir
|
||||
|
||||
$webJobs | Wait-Job | Receive-Job
|
||||
}
|
||||
|
||||
function Bump-Version {
|
||||
if (Test-Path $DirectoryBuildProps) {
|
||||
[xml]$props = Get-Content $DirectoryBuildProps -Raw
|
||||
$versionNode = $props.SelectSingleNode("//Version")
|
||||
if ($null -ne $versionNode -and -not [string]::IsNullOrWhiteSpace($versionNode.InnerText)) {
|
||||
$currentVersion = $versionNode.InnerText.Trim()
|
||||
$versionMatch = [regex]::Match($currentVersion, '^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)$')
|
||||
if ($versionMatch.Success) {
|
||||
$newVersion = "{0}.{1}.{2}" -f $versionMatch.Groups["major"].Value, $versionMatch.Groups["minor"].Value, ([int]$versionMatch.Groups["patch"].Value + 1)
|
||||
$propsContent = Get-Content $DirectoryBuildProps -Raw
|
||||
$propsContent = $propsContent -replace "<Version>[^<]*</Version>", "<Version>$newVersion</Version>"
|
||||
Set-Content $DirectoryBuildProps -Value $propsContent -Encoding UTF8
|
||||
Write-Host "Bumped version in Directory.Build.props: $currentVersion -> $newVersion" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($Configuration -ne "Release") {
|
||||
Write-Host "⚠️ WARNING: You are publishing in $Configuration configuration!" -ForegroundColor Yellow
|
||||
Write-Host " Typically, production artifacts MUST be in Release configuration." -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
$shouldPublishWindows = $Windows.IsPresent
|
||||
$shouldPublishLinux = $Linux.IsPresent
|
||||
@@ -28,36 +112,36 @@ if (!$shouldPublishWindows -and !$shouldPublishLinux) {
|
||||
$shouldPublishLinux = $true
|
||||
}
|
||||
|
||||
# 1. Cleanup
|
||||
Stop-ProjectProcesses
|
||||
|
||||
# 2. Build Web
|
||||
Build-Web
|
||||
|
||||
# 3. App Publishing
|
||||
# NOTE: To avoid file locks in 'obj' and 'bin' folders, we publish the .NET apps sequentially.
|
||||
# However, we can parallelize the Inno Setup packaging later if needed.
|
||||
Write-Host "Starting app publishing..." -ForegroundColor Cyan
|
||||
|
||||
if ($shouldPublishWindows) {
|
||||
if (!(Test-Path $publishWindowsScript)) {
|
||||
Write-Error "publish-windows.ps1 not found: $publishWindowsScript"
|
||||
exit 1
|
||||
}
|
||||
|
||||
& $publishWindowsScript `
|
||||
-Configuration $Configuration `
|
||||
-SkipInnoSetup:$SkipWindowsInnoSetup `
|
||||
-SkipVersionBump:$SkipWindowsVersionBump
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
Write-Host "Publishing Windows Apps..." -ForegroundColor Cyan
|
||||
# Maui Windows (Skip ISS here, we'll do it later if parallel is needed, or just let it run)
|
||||
& $publishWindowsScript -AppType Maui -Configuration $Configuration -SkipInnoSetup:$SkipWindowsInnoSetup -SkipVersionBump -SkipProcessStop
|
||||
|
||||
# Avalonia Windows
|
||||
& $publishWindowsScript -AppType Avalonia -Configuration $Configuration -SkipInnoSetup:$SkipWindowsInnoSetup -SkipVersionBump -SkipProcessStop
|
||||
}
|
||||
|
||||
if ($shouldPublishLinux) {
|
||||
if (!(Test-Path $publishLinuxScript)) {
|
||||
Write-Error "publish-linux.ps1 not found: $publishLinuxScript"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Publishing Linux Apps..." -ForegroundColor Cyan
|
||||
foreach ($rid in $LinuxRuntimes) {
|
||||
& $publishLinuxScript `
|
||||
-RuntimeIdentifier $rid `
|
||||
-SelfContained:$LinuxSelfContained `
|
||||
-Configuration $Configuration
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
& $publishLinuxScript -RuntimeIdentifier $rid -SelfContained:$LinuxSelfContained -Configuration $Configuration -SkipProcessStop
|
||||
}
|
||||
}
|
||||
|
||||
# 4. Finalizing
|
||||
if (!$SkipWindowsVersionBump.IsPresent) {
|
||||
Bump-Version
|
||||
}
|
||||
|
||||
Write-Host "All publishing tasks completed!" -ForegroundColor Green
|
||||
|
||||
Reference in New Issue
Block a user