16 lines
849 B
PowerShell
16 lines
849 B
PowerShell
param([string]$ToolchainRoot = 'C:/Users/david/Desktop/app/.tools')
|
|
$ErrorActionPreference = 'Stop'
|
|
$env:HEPAN_TOOLCHAIN_ROOT=$ToolchainRoot
|
|
. "$PSScriptRoot/android-env.ps1"
|
|
$projectRoot=Split-Path $PSScriptRoot -Parent
|
|
Push-Location "$projectRoot/mobile"
|
|
try {
|
|
flutter.bat build apk --debug
|
|
if($LASTEXITCODE -ne 0) { throw 'Android 构建失败,未复制 APK' }
|
|
$built=Join-Path (Get-Location) 'build/app/outputs/flutter-apk/app-debug.apk'
|
|
if(!(Test-Path -LiteralPath $built)) { throw '本次构建未生成 APK' }
|
|
New-Item -ItemType Directory -Force "$projectRoot/dist" | Out-Null
|
|
Copy-Item -LiteralPath $built -Destination "$projectRoot/dist/hepan-everyday-debug.apk" -Force
|
|
Get-Item -LiteralPath "$projectRoot/dist/hepan-everyday-debug.apk" | Select-Object FullName,Length,LastWriteTime
|
|
} finally { Pop-Location }
|