$ErrorActionPreference = 'Stop' Set-Location $PSScriptRoot $env:PUB_HOSTED_URL = 'https://pub.dev' $env:FLUTTER_STORAGE_BASE_URL = 'https://storage.googleapis.com' $flutter = $null foreach ($c in @( 'D:\flutter\bin\flutter.bat', 'C:\flutter\bin\flutter.bat', (Join-Path $env:LOCALAPPDATA 'flutter\bin\flutter.bat') )) { if (Test-Path $c) { $flutter = $c; break } } if (-not $flutter) { $cmd = Get-Command flutter -ErrorAction SilentlyContinue if ($cmd) { $flutter = $cmd.Source } } if (-not $flutter) { throw '未找到 Flutter。请先运行 installer\bootstrap-windows.ps1' } & $flutter pub get if ($LASTEXITCODE -ne 0) { throw "flutter pub get failed: $LASTEXITCODE" } & $flutter build windows --release --build-name=3.1.10 --build-number=324 if ($LASTEXITCODE -ne 0) { throw "flutter build windows failed: $LASTEXITCODE" } $release = Join-Path $PSScriptRoot 'build\windows\x64\runner\Release' $exe = Join-Path $release 'fengying_oa.exe' if (-not (Test-Path $exe)) { throw "missing $exe" } $iscc = @( "${env:ProgramFiles}\Inno Setup 7\ISCC.exe", "${env:ProgramFiles(x86)}\Inno Setup 7\ISCC.exe", "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe", "${env:ProgramFiles}\Inno Setup 6\ISCC.exe", 'C:\Program Files\Inno Setup 7\ISCC.exe', 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' ) | Where-Object { Test-Path $_ } | Select-Object -First 1 if (-not $iscc) { throw '未找到 Inno Setup(ISCC.exe)。请先运行 installer\bootstrap-windows.ps1' } $iss = Join-Path $PSScriptRoot 'installer\fengying-oa.iss' & $iscc $iss if ($LASTEXITCODE -ne 0) { throw "ISCC failed: $LASTEXITCODE" } $setup = Join-Path $PSScriptRoot 'build\fengying-oa-setup.exe' if (-not (Test-Path $setup)) { throw "missing $setup" } Write-Host "Windows setup: $setup" Write-Host "Windows exe: $exe"