feat: 引入 CloudSync 核心能力并新增 Avalonia 桌面端与发布脚本
- 后端:新增 CloudSync 认证/权限/端点/服务与 DTO - 数据:新增用户/会话/安全策略实体与 EF Core migrations - 前端:新增云同步设置 UI、客户端与本地存储;Vite 支持 maui 构建输出到 wwwroot - 桌面端:新增 Avalonia 项目、内置 WebServer、托盘与 Windows 全局热键 - 发布/构建:新增 Windows/Linux 发布脚本与统一入口;调整 MAUI 资源与安装包配置 - 文档:同步更新 README/docs 与协作规则
This commit is contained in:
+53
-52
@@ -1,62 +1,63 @@
|
||||
param(
|
||||
[switch]$Windows,
|
||||
|
||||
[switch]$Linux,
|
||||
|
||||
[string[]]$LinuxRuntimes = @("linux-x64", "linux-arm64"),
|
||||
|
||||
[switch]$LinuxSelfContained,
|
||||
|
||||
[string]$Configuration = "Release",
|
||||
|
||||
[switch]$SkipWindowsInnoSetup,
|
||||
|
||||
[switch]$SkipWindowsVersionBump
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$ScriptPath = $PSScriptRoot
|
||||
$ProjectDir = Join-Path $ScriptPath "src\Hua.Todo.Maui"
|
||||
$ProjectFile = Join-Path $ProjectDir "Hua.Todo.Maui.csproj"
|
||||
$SetupScript = Join-Path $ProjectDir "setup.iss"
|
||||
|
||||
# Read version from project file
|
||||
$currentVersion = "1.0.0"
|
||||
[xml]$csproj = Get-Content $ProjectFile -Raw
|
||||
$versionNode = $csproj.SelectSingleNode("//Version")
|
||||
if ($null -ne $versionNode) {
|
||||
$currentVersion = $versionNode.InnerText
|
||||
} else {
|
||||
$versionNode = $csproj.SelectSingleNode("//ApplicationDisplayVersion")
|
||||
if ($null -ne $versionNode) {
|
||||
$currentVersion = $versionNode.InnerText
|
||||
$publishWindowsScript = Join-Path $ScriptPath "publish-windows.ps1"
|
||||
$publishLinuxScript = Join-Path $ScriptPath "publish-linux.ps1"
|
||||
|
||||
$shouldPublishWindows = $Windows.IsPresent
|
||||
$shouldPublishLinux = $Linux.IsPresent
|
||||
if (!$shouldPublishWindows -and !$shouldPublishLinux) {
|
||||
$shouldPublishWindows = $true
|
||||
$shouldPublishLinux = $true
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
# Update setup script version with current version before build
|
||||
if (Test-Path $SetupScript) {
|
||||
$issContent = Get-Content $SetupScript
|
||||
$versionFound = $false
|
||||
for ($i = 0; $i -lt $issContent.Count; $i++) {
|
||||
if ($issContent[$i] -like '#define MyAppVersion *') {
|
||||
$issContent[$i] = '#define MyAppVersion "' + $currentVersion + '"'
|
||||
$versionFound = $true
|
||||
break
|
||||
if ($shouldPublishLinux) {
|
||||
if (!(Test-Path $publishLinuxScript)) {
|
||||
Write-Error "publish-linux.ps1 not found: $publishLinuxScript"
|
||||
exit 1
|
||||
}
|
||||
|
||||
foreach ($rid in $LinuxRuntimes) {
|
||||
& $publishLinuxScript `
|
||||
-RuntimeIdentifier $rid `
|
||||
-SelfContained:$LinuxSelfContained `
|
||||
-Configuration $Configuration
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
}
|
||||
if ($versionFound) {
|
||||
Set-Content $SetupScript -Value $issContent
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Building Hua.Todo.Maui (Release)..." -ForegroundColor Cyan
|
||||
dotnet publish $ProjectFile -f net10.0-windows10.0.19041.0 -c Release --self-contained false
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Error "MAUI build failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$ISCC = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
|
||||
if (Test-Path $ISCC) {
|
||||
& $ISCC $SetupScript
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "Setup package created successfully!" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Error "Packaging failed"
|
||||
}
|
||||
} else {
|
||||
Write-Error "Inno Setup compiler not found"
|
||||
}
|
||||
|
||||
$versionParts = $currentVersion.Split(".")
|
||||
$patch = [int]$versionParts[2] + 1
|
||||
$newVersion = $versionParts[0] + "." + $versionParts[1] + "." + $patch
|
||||
|
||||
$content = Get-Content $ProjectFile -Raw
|
||||
$content = $content -replace "<Version>.*</Version>", "<Version>$newVersion</Version>"
|
||||
Set-Content $ProjectFile -Value $content
|
||||
|
||||
Reference in New Issue
Block a user