Record project continuation changes
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
#requires -Version 5
|
||||
|
||||
param(
|
||||
[string]$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).ProviderPath,
|
||||
[string]$BuildType = "release",
|
||||
[string]$AndroidHome = $env:ANDROID_HOME,
|
||||
[switch]$InstallMissing,
|
||||
[switch]$SkipWorkspaceCleanup,
|
||||
[switch]$PrintOnly,
|
||||
[switch]$SkipPrepare,
|
||||
[bool]$PublishToTestDockerDownloads = $true,
|
||||
[string]$TestDockerSshAlias = "test-docker",
|
||||
[string]$TestDockerDownloadPath = "/tmp/rap-web-admin/html/downloads",
|
||||
[int]$PreparationRetryDelaySeconds = 0
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Fail([string]$Message) {
|
||||
Write-Error $Message
|
||||
exit 1
|
||||
}
|
||||
|
||||
function Run-Step([string]$Name, [scriptblock]$Action) {
|
||||
Write-Host "=== $Name ==="
|
||||
$global:LASTEXITCODE = 0
|
||||
try {
|
||||
& $Action
|
||||
} catch {
|
||||
Fail "$Name завершился с ошибкой: $($_.Exception.Message)"
|
||||
}
|
||||
if (-not $?) {
|
||||
Fail "$Name завершился с кодом ошибки"
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Fail "$Name завершился с кодом $LASTEXITCODE"
|
||||
}
|
||||
}
|
||||
|
||||
$scriptDir = Split-Path -Parent (Resolve-Path $PSCommandPath).ProviderPath
|
||||
$prepareScript = Join-Path $scriptDir "prepare-android-build-environment.ps1"
|
||||
$buildScript = Join-Path $scriptDir "build-android-apk.ps1"
|
||||
|
||||
if (-not (Test-Path $prepareScript)) {
|
||||
Fail "Не найден скрипт подготовки окружения: $prepareScript"
|
||||
}
|
||||
if (-not (Test-Path $buildScript)) {
|
||||
Fail "Не найден скрипт сборки: $buildScript"
|
||||
}
|
||||
|
||||
if ($PreparationRetryDelaySeconds -lt 0 -or $PreparationRetryDelaySeconds -gt 3600) {
|
||||
Fail "PreparationRetryDelaySeconds должен быть в диапазоне 0..3600."
|
||||
}
|
||||
|
||||
if (-not $SkipPrepare) {
|
||||
Run-Step "Подготовка Android окружения" {
|
||||
& $prepareScript -RepoRoot $RepoRoot -AndroidHome $AndroidHome -SetEnvironment -InstallMissing:$InstallMissing
|
||||
}
|
||||
if ($PreparationRetryDelaySeconds -gt 0) {
|
||||
Start-Sleep -Seconds $PreparationRetryDelaySeconds
|
||||
}
|
||||
} else {
|
||||
Write-Host "Подготовка окружения пропущена (-SkipPrepare)."
|
||||
}
|
||||
|
||||
if ($PrintOnly) {
|
||||
Run-Step "Проверка параметров и печать (без сборки)" {
|
||||
& $buildScript -RepoRoot $RepoRoot -BuildType $BuildType -AndroidHome $AndroidHome -PrintOnly `
|
||||
-SkipWorkspaceCleanup:$SkipWorkspaceCleanup `
|
||||
-PublishToTestDockerDownloads:$PublishToTestDockerDownloads `
|
||||
-TestDockerSshAlias $TestDockerSshAlias `
|
||||
-TestDockerDownloadPath $TestDockerDownloadPath
|
||||
}
|
||||
exit 0
|
||||
}
|
||||
|
||||
Run-Step "Сборка и публикация Android APK" {
|
||||
& $buildScript -RepoRoot $RepoRoot -BuildType $BuildType -AndroidHome $AndroidHome -SkipWorkspaceCleanup:$SkipWorkspaceCleanup `
|
||||
-PublishToTestDockerDownloads:$PublishToTestDockerDownloads `
|
||||
-TestDockerSshAlias $TestDockerSshAlias `
|
||||
-TestDockerDownloadPath $TestDockerDownloadPath
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Готово. APK опубликован для веб-панели по ссылке: downloads/rap-android-rdp-vpn-latest-$BuildType.apk"
|
||||
Reference in New Issue
Block a user