release ohos

This commit is contained in:
Developer
2026-04-21 10:14:37 +08:00
parent b1acdbdf05
commit 32f5aa53fa
229 changed files with 5690 additions and 28709 deletions

View File

@@ -0,0 +1,65 @@
# ============================================================================
# 小妈厨房 - Windows 打包脚本
# ============================================================================
# 使用方法:
# .\scripts\package_windows.ps1 # 完整流程:构建+打包
# .\scripts\package_windows.ps1 -SkipBuild # 跳过构建,仅打包
#
# 版本号自动从 pubspec.yaml 读取,无需手动同步
# ============================================================================
param(
[switch]$SkipBuild = $false
)
$ErrorActionPreference = "Stop"
$ProjectRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
Set-Location $ProjectRoot
# ---- 从 pubspec.yaml 读取版本号 ----
$pubspec = Get-Content "pubspec.yaml" -Raw
if ($pubspec -match "version:\s*(\d+\.\d+\.\d+)(?:\+(\d+))?") {
$AppVersion = $Matches[1]
$BuildNumber = if ($Matches[2]) { $Matches[2] } else { "0" }
Write-Host "Version: $AppVersion (build $BuildNumber)" -ForegroundColor Green
} else {
Write-Host "ERROR: Cannot parse version from pubspec.yaml" -ForegroundColor Red
exit 1
}
# ---- 构建 Flutter Windows 应用 ----
if (-not $SkipBuild) {
Write-Host "`n--- Building Flutter Windows app ---" -ForegroundColor Yellow
flutter build windows
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Flutter build failed" -ForegroundColor Red
exit 1
}
Write-Host "Build successful" -ForegroundColor Green
} else {
Write-Host "`n--- Skipping build (use -SkipBuild flag) ---" -ForegroundColor Yellow
}
# ---- Inno Setup 打包(通过 /D 传递版本号) ----
Write-Host "`n--- Packaging with Inno Setup ---" -ForegroundColor Yellow
$isccPath = "d:\Program Files (x86)\Inno Setup 6\ISCC.exe"
if (-not (Test-Path $isccPath)) {
Write-Host "ERROR: ISCC.exe not found at $isccPath" -ForegroundColor Red
exit 1
}
& $isccPath "/DAppVer=$AppVersion" "installer.iss"
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Inno Setup packaging failed" -ForegroundColor Red
exit 1
}
Write-Host "`n========================================" -ForegroundColor Green
Write-Host " Package created successfully!" -ForegroundColor Green
Write-Host " Version: $AppVersion" -ForegroundColor Green
$outputFile = "dist\MomKitchen_Setup_$AppVersion.exe"
if (Test-Path $outputFile) {
$size = (Get-Item $outputFile).Length / 1MB
Write-Host " Output: $outputFile ($([math]::Round($size, 1)) MB)" -ForegroundColor Green
}
Write-Host "========================================" -ForegroundColor Green