Rebrand as TPSchedule and refine clear liquid glass dock
This commit is contained in:
@@ -1,15 +1,32 @@
|
||||
param([string]$ToolchainRoot = 'C:/Users/david/Desktop/app/.tools')
|
||||
param(
|
||||
[string]$ToolchainRoot = 'C:/Users/david/Desktop/app/.tools',
|
||||
[ValidateSet('debug', 'release')][string]$Mode = 'release'
|
||||
)
|
||||
$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
|
||||
# Refresh local dependency metadata without network. The build then regenerates
|
||||
# plugin registration for its mode, excluding test-only plugins from release.
|
||||
flutter.bat pub get --offline
|
||||
if($LASTEXITCODE -ne 0) { throw '本地依赖准备失败,未开始构建' }
|
||||
flutter.bat build apk "--$Mode"
|
||||
if($LASTEXITCODE -ne 0) { throw 'Android 构建失败,未复制 APK' }
|
||||
$built=Join-Path (Get-Location) 'build/app/outputs/flutter-apk/app-debug.apk'
|
||||
$built=Join-Path (Get-Location) "build/app/outputs/flutter-apk/app-$Mode.apk"
|
||||
if(!(Test-Path -LiteralPath $built)) { throw '本次构建未生成 APK' }
|
||||
$taskSigner = Join-Path $env:ANDROID_HOME 'build-tools/36.0.0/apksigner.bat'
|
||||
$taskSignature = & $taskSigner verify --print-certs $built
|
||||
if ($LASTEXITCODE -ne 0) { throw 'APK 签名验证失败,未复制 APK' }
|
||||
$taskExpectedCertificate = 'AF5C21B1BA1E48E461D8EA38DF0FE1C3653F64EB7E8E7728BAE6E5D988BA0D0A'
|
||||
$taskSignatureText = $taskSignature -join "`n"
|
||||
if ($taskSignatureText -notmatch 'certificate SHA-256 digest:\s*([a-fA-F0-9]{64})' -or
|
||||
$Matches[1].ToUpperInvariant() -ne $taskExpectedCertificate) {
|
||||
throw '签名证书与原证书不一致,未复制 APK。请保留原有签名文件,不要重新生成。'
|
||||
}
|
||||
New-Item -ItemType Directory -Force "$projectRoot/dist" | Out-Null
|
||||
Copy-Item -LiteralPath $built -Destination "$projectRoot/dist/RSchedule-debug.apk" -Force
|
||||
Get-Item -LiteralPath "$projectRoot/dist/RSchedule-debug.apk" | Select-Object FullName,Length,LastWriteTime
|
||||
$taskArtifact = if ($Mode -eq 'release') { 'TPSchedule.apk' } else { 'TPSchedule-debug.apk' }
|
||||
Copy-Item -LiteralPath $built -Destination "$projectRoot/dist/$taskArtifact" -Force
|
||||
Get-Item -LiteralPath "$projectRoot/dist/$taskArtifact" | Select-Object FullName,Length,LastWriteTime
|
||||
} finally { Pop-Location }
|
||||
|
||||
Reference in New Issue
Block a user