build: package Avalonia and Flutter Windows installers

This commit is contained in:
tongtong committed 2026-11-12 21:29:28 +08:00
1 parent 82a84a0223
commit 9aa39d7a5a
5 files changed
+85 -2

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@
| `desktop/Ads.Desktop.Tests/` | 桌面客户端单元测试 | C#、XML(csproj) | | `desktop/Ads.Desktop.Tests/` | 桌面客户端单元测试 | C#、XML(csproj) |
| `desktop/Ads.Desktop.Smoke/` | 桌面离屏布局、连接及可选真机冒烟验证入口 | C#、XML(csproj) | | `desktop/Ads.Desktop.Smoke/` | 桌面离屏布局、连接及可选真机冒烟验证入口 | C#、XML(csproj) |
| `deploy/` | 服务器/设备端部署脚本与 Caddy、Nginx、systemd、launchd 配置示例 | Shell、服务/代理配置、XML(plist)、Markdown | | `deploy/` | 服务器/设备端部署脚本与 Caddy、Nginx、systemd、launchd 配置示例 | Shell、服务/代理配置、XML(plist)、Markdown |
| `deploy/windows/` | Windows 设备端准备、安装和运行脚本,通过计划任务托管 agent,附配置示例 | PowerShell、JSON、Markdown | | `deploy/windows/` | Windows 设备端准备与计划任务部署、桌面安装包定义及配置示例 | PowerShell、Inno Setup(ISS)、JSON、Markdown |
| `scripts/` | 项目构建、打包及本地启动脚本 | PowerShell、Shell | | `scripts/` | 项目构建、打包及本地启动脚本 | PowerShell、Shell |
| `tests/` | Python 桥接测试、三端集成测试及可选真机验证 | Python | | `tests/` | Python 桥接测试、三端集成测试及可选真机验证 | Python |
| `docs/` | 协议、部署、验证及旧局域网桥接说明 | Markdown | | `docs/` | 协议、部署、验证及旧局域网桥接说明 | Markdown |
+1 -1
View File
@@ -38,7 +38,7 @@ Windows 现支持可选的 [USB ADB 模拟](docs/windows-usb.md),默认网络
| `desktop/Ads.Desktop.Tests/` | 桌面客户端单元测试 | C#、XML(csproj) | | `desktop/Ads.Desktop.Tests/` | 桌面客户端单元测试 | C#、XML(csproj) |
| `desktop/Ads.Desktop.Smoke/` | 桌面离屏布局、连接及可选真机冒烟验证入口 | C#、XML(csproj) | | `desktop/Ads.Desktop.Smoke/` | 桌面离屏布局、连接及可选真机冒烟验证入口 | C#、XML(csproj) |
| `deploy/` | 服务器/设备端部署脚本与 Caddy、Nginx、systemd、launchd 配置示例 | Shell、服务/代理配置、XML(plist)、Markdown | | `deploy/` | 服务器/设备端部署脚本与 Caddy、Nginx、systemd、launchd 配置示例 | Shell、服务/代理配置、XML(plist)、Markdown |
| `deploy/windows/` | Windows 设备端准备、安装和运行脚本,通过计划任务托管 agent,附配置示例 | PowerShell、JSON、Markdown | | `deploy/windows/` | Windows 设备端准备与计划任务部署、桌面安装包定义及配置示例 | PowerShell、Inno Setup(ISS)、JSON、Markdown |
| `scripts/` | 项目构建、打包及本地启动脚本 | PowerShell、Shell | | `scripts/` | 项目构建、打包及本地启动脚本 | PowerShell、Shell |
| `tests/` | Python 桥接测试、三端集成测试及可选真机验证 | Python | | `tests/` | Python 桥接测试、三端集成测试及可选真机验证 | Python |
| `docs/` | 协议、部署、验证及旧局域网桥接说明 | Markdown | | `docs/` | 协议、部署、验证及旧局域网桥接说明 | Markdown |
+6
View File
@@ -70,3 +70,9 @@ Get-ScheduledTask -TaskName ADS-Agent-home-pc
``` ```
The managed log buffer is in memory; the old runner log is historical. See [Agent management](../../docs/agent-management.md) for Linux and Windows headless setup, CLI commands, role credentials and both GUIs. The managed log buffer is in memory; the old runner log is historical. See [Agent management](../../docs/agent-management.md) for Linux and Windows headless setup, CLI commands, role credentials and both GUIs.
## Desktop installers
Run `scripts/build-installers.ps1` from the repository root to build separate Avalonia and Flutter Windows x64 installers. Requires Inno Setup 6/7 (`-Compiler` selects ISCC.exe). Build Rust binaries first with `scripts/build.ps1`; `-SkipBuild` packages existing release folders. `-Edition Avalonia` or `Flutter` selects one client. Outputs and SHA-256 sidecars are in `bin/installers/`.
Installers use per-user installation, Start menu entries, optional desktop shortcuts, and Windows uninstall registration. Editions have separate install identities and can coexist; installing the same edition upgrades it in place. Close the client and stop any Agent hosted from its installation folder before upgrading. Credentials, local settings and device configuration are excluded; import credentials after installation. Uninstall retains settings in user data and does not remove separately installed Agent tasks or USB drivers. USB driver installation remains an explicit optional step. Setup executables are currently unsigned; distribution signing requires the publisher certificate.
+35
View File
@@ -0,0 +1,35 @@
#ifndef Version
#define Version "0.2.0"
#endif
[Setup]
AppId=TTSTD.ADS.{#Edition}
AppName=ADS {#Edition}
AppVersion={#Version}
AppPublisher=TongTong Studio
DefaultDirName={localappdata}\Programs\TTSTD\ADS-{#Edition}
DefaultGroupName=ADS {#Edition}
PrivilegesRequired=lowest
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
MinVersion=10.0
OutputDir={#Output}
OutputBaseFilename=ADS-{#Edition}-{#Version}-win-x64-Setup
Compression=lzma2
SolidCompression=yes
WizardStyle=modern
UninstallDisplayIcon={app}\{#Executable}
CloseApplications=yes
RestartApplications=no
SetupLogging=yes
[Tasks]
Name: desktopicon; Description: "Create a desktop shortcut"; Flags: unchecked
[Files]
Source: "{#Source}\*"; DestDir: "{app}"; Excludes: "*.env,*.log,*.pdb,settings.json,agent.json,*.sock"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\ADS {#Edition}"; Filename: "{app}\{#Executable}"
Name: "{autodesktop}\ADS {#Edition}"; Filename: "{app}\{#Executable}"; Tasks: desktopicon
#if Edition == "Avalonia"
Name: "{group}\ADS Agent Manager"; Filename: "{app}\{#Executable}"; Parameters: "--agent-tray"
#endif
[Run]
Filename: "{app}\{#Executable}"; Description: "Launch ADS {#Edition}"; Flags: nowait postinstall skipifsilent
+42
View File
@@ -0,0 +1,42 @@
param(
[ValidateSet('All','Avalonia','Flutter')][string]$Edition='All',
[string]$Compiler,
[switch]$SkipBuild
)
$ErrorActionPreference='Stop'
$root=Split-Path $PSScriptRoot -Parent
if (-not $Compiler) {
$candidates=@((Join-Path $root 'work/installer-tools/inno/ISCC.exe'),"${env:ProgramFiles(x86)}/Inno Setup 6/ISCC.exe", "$env:ProgramFiles/Inno Setup 7/ISCC.exe")
$Compiler=$candidates | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1
}
if (-not $Compiler) { throw 'Install Inno Setup 6/7 or specify -Compiler path/to/ISCC.exe' }
$version=[regex]::Match((Get-Content (Join-Path $root 'Cargo.toml') -Raw),'(?m)^version = "([0-9.]+)"').Groups[1].Value
if (-not $version) { throw 'Workspace version missing' }
$output=Join-Path $root 'bin/installers'
New-Item -ItemType Directory -Force -Path $output | Out-Null
foreach ($name in @('Avalonia','Flutter')) {
if ($Edition -ne 'All' -and $Edition -ne $name) { continue }
$folder=if ($name -eq 'Avalonia') { 'desktop-win-x64' } else { 'flutter-win-x64' }
$exe=if ($name -eq 'Avalonia') { 'Ads.Desktop.exe' } else { 'ads_manager.exe' }
if (-not $SkipBuild) {
$build=if ($name -eq 'Avalonia') { 'build-desktop.ps1' } else { 'build-flutter.ps1' }
& (Join-Path $PSScriptRoot $build)
if ($LASTEXITCODE) { throw "$name build failed" }
}
$source=Join-Path $root "bin/$folder"
if ($name -eq 'Flutter') {
$crt=Get-ChildItem "$env:ProgramFiles/Microsoft Visual Studio/2022/*/VC/Redist/MSVC/*/x64/Microsoft.VC143.CRT" -Directory -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1
if ($crt) { Copy-Item -Path (Join-Path $crt.FullName '*.dll') -Destination $source -Force }
foreach ($runtime in @('msvcp140.dll','vcruntime140.dll','vcruntime140_1.dll')) {
if (-not (Test-Path -LiteralPath (Join-Path $source $runtime))) { throw "Missing redistributable C++ runtime: $runtime" }
}
}
foreach ($file in @($exe,'adsctl.exe','ads-agent.exe','ads-client.exe','tools/scrcpy/adb.exe','tools/scrcpy/scrcpy.exe')) {
if (-not (Test-Path -LiteralPath (Join-Path $source $file))) { throw "Missing payload: $folder/$file" }
}
if (Get-ChildItem -LiteralPath $source -Recurse -File -Filter '*.env') { throw 'Credential file found in release payload; remove it before packaging' }
& $Compiler "/DVersion=$version" "/DEdition=$name" "/DExecutable=$exe" "/DSource=$source" "/DOutput=$output" (Join-Path $root 'deploy/windows/desktop-installer.iss')
if ($LASTEXITCODE) { throw "$name installer compilation failed" }
$package=Join-Path $output "ADS-$name-$version-win-x64-Setup.exe"
(Get-FileHash -LiteralPath $package -Algorithm SHA256).Hash.ToLowerInvariant()+' '+[IO.Path]::GetFileName($package) | Set-Content -LiteralPath ($package+'.sha256') -Encoding ascii
}