Add Android native package smoke checks

This commit is contained in:
2026-06-05 12:35:47 +02:00
parent c761cd39fd
commit 711a9b5037
6 changed files with 162 additions and 20 deletions

View File

@@ -4,6 +4,7 @@ param(
[string]$Configuration = "Debug",
[string]$Target = "PanoPainter",
[switch]$ReadinessOnly,
[switch]$AndroidNativeChecks,
[string[]]$PackageKinds = @(
"windows-appx",
"android-standard-apk",
@@ -23,6 +24,21 @@ function Test-CommandAvailable {
return [bool](Get-Command $Name -ErrorAction SilentlyContinue)
}
function Expand-ArgumentList {
param([string[]]$Values)
$expanded = @()
foreach ($value in $Values) {
foreach ($part in ($value -split ",")) {
$trimmed = $part.Trim()
if ($trimmed.Length -gt 0) {
$expanded += $trimmed
}
}
}
return $expanded
}
function New-ArtifactCheck {
param(
[string]$Name,
@@ -81,6 +97,85 @@ function New-PackageReadiness {
}
}
function Get-AndroidNativeCheckPlan {
param([string[]]$Kinds)
$packages = @()
if ($Kinds -contains "android-standard-apk") {
$packages += [ordered]@{
packages = @("standard")
configureOnly = $false
}
}
$configureOnlyPackages = @()
if ($Kinds -contains "android-quest-apk") {
$configureOnlyPackages += "quest"
}
if ($Kinds -contains "android-focus-apk") {
$configureOnlyPackages += "focus"
}
if ($configureOnlyPackages.Count -gt 0) {
$packages += [ordered]@{
packages = $configureOnlyPackages
configureOnly = $true
}
}
return $packages
}
function Invoke-AndroidNativePackageChecks {
param([string[]]$Kinds)
$plans = @(Get-AndroidNativeCheckPlan -Kinds $Kinds)
$results = @()
$overallExitCode = 0
foreach ($plan in $plans) {
$arguments = @(
"-ExecutionPolicy", "Bypass",
"-File", (Join-Path $root "scripts/automation/android-legacy-package-build.ps1"),
"-Packages", ($plan.packages -join ",")
)
if ($plan.configureOnly) {
$arguments += "-ConfigureOnly"
}
$output = @(& powershell @arguments 2>&1)
$exitCode = $LASTEXITCODE
if ($exitCode -ne 0 -and $overallExitCode -eq 0) {
$overallExitCode = $exitCode
}
$jsonLine = @($output | ForEach-Object { $_.ToString() } | Where-Object { $_.TrimStart().StartsWith("{") } | Select-Object -Last 1)
$summary = $null
if ($jsonLine.Count -gt 0) {
try {
$summary = $jsonLine[-1] | ConvertFrom-Json
} catch {
$summary = $null
}
}
$results += [ordered]@{
packages = $plan.packages
configureOnly = [bool]$plan.configureOnly
exitCode = $exitCode
command = "powershell -ExecutionPolicy Bypass -File scripts\automation\android-legacy-package-build.ps1 -Packages $($plan.packages -join ',')$(if ($plan.configureOnly) { ' -ConfigureOnly' } else { '' })"
summary = $summary
}
}
[ordered]@{
requested = $plans.Count -gt 0
exitCode = $overallExitCode
results = $results
}
}
$PackageKinds = @(Expand-ArgumentList -Values $PackageKinds)
function Get-PackageReadiness {
param([string[]]$Kinds)
@@ -120,6 +215,7 @@ function Get-PackageReadiness {
(New-Prerequisite -Name "gradle-build" -Available (Test-Path -LiteralPath $gradle -PathType Leaf) -Detail $gradle),
(New-Prerequisite -Name "android-manifest" -Available (Test-Path -LiteralPath $manifest -PathType Leaf) -Detail $manifest),
(New-Prerequisite -Name "gradle" -Available (Test-CommandAvailable "gradle") -Detail "Android package builder"),
(New-Prerequisite -Name "retained-native-cmake-check" -Available $true -Detail "powershell -ExecutionPolicy Bypass -File scripts\automation\android-legacy-package-build.ps1 -Packages standard"),
(New-Prerequisite -Name "root-cmake-preset" -Available $true -Detail "android-arm64/android-x64"),
(New-Prerequisite -Name "root-cmake-package-target" -Available $false -Detail "Not migrated yet")
) `
@@ -140,6 +236,7 @@ function Get-PackageReadiness {
(New-Prerequisite -Name "gradle-build" -Available (Test-Path -LiteralPath $gradle -PathType Leaf) -Detail $gradle),
(New-Prerequisite -Name "android-manifest" -Available (Test-Path -LiteralPath $manifest -PathType Leaf) -Detail $manifest),
(New-Prerequisite -Name "gradle" -Available (Test-CommandAvailable "gradle") -Detail "Android package builder"),
(New-Prerequisite -Name "retained-native-cmake-check" -Available $true -Detail "powershell -ExecutionPolicy Bypass -File scripts\automation\android-legacy-package-build.ps1 -Packages quest -ConfigureOnly"),
(New-Prerequisite -Name "root-cmake-preset" -Available $true -Detail "android-quest-arm64"),
(New-Prerequisite -Name "root-cmake-package-target" -Available $false -Detail "Not migrated yet")
) `
@@ -160,6 +257,7 @@ function Get-PackageReadiness {
(New-Prerequisite -Name "gradle-build" -Available (Test-Path -LiteralPath $gradle -PathType Leaf) -Detail $gradle),
(New-Prerequisite -Name "android-manifest" -Available (Test-Path -LiteralPath $manifest -PathType Leaf) -Detail $manifest),
(New-Prerequisite -Name "gradle" -Available (Test-CommandAvailable "gradle") -Detail "Android package builder"),
(New-Prerequisite -Name "retained-native-cmake-check" -Available $true -Detail "powershell -ExecutionPolicy Bypass -File scripts\automation\android-legacy-package-build.ps1 -Packages focus -ConfigureOnly"),
(New-Prerequisite -Name "root-cmake-preset" -Available $true -Detail "android-focus-arm64"),
(New-Prerequisite -Name "root-cmake-package-target" -Available $false -Detail "Not migrated yet")
) `
@@ -208,6 +306,16 @@ function Get-PackageReadiness {
return $readiness
}
$androidNativeValidation = if ($AndroidNativeChecks) {
Invoke-AndroidNativePackageChecks -Kinds $PackageKinds
} else {
[ordered]@{
requested = $false
exitCode = 0
results = @()
}
}
if ($ReadinessOnly) {
$elapsed = [int]((Get-Date) - $started).TotalMilliseconds
[ordered]@{
@@ -218,9 +326,10 @@ if ($ReadinessOnly) {
stage = "readiness"
exitCode = 0
elapsedMs = $elapsed
packageReadiness = Get-PackageReadiness -Kinds $PackageKinds
} | ConvertTo-Json -Compress -Depth 5
exit 0
androidNativeValidation = $androidNativeValidation
packageReadiness = @(Get-PackageReadiness -Kinds $PackageKinds)
} | ConvertTo-Json -Compress -Depth 8
exit $androidNativeValidation.exitCode
}
& cmake --build --preset $Preset --config $Configuration --target $Target
@@ -235,8 +344,9 @@ if ($buildExitCode -ne 0) {
stage = "build"
exitCode = $buildExitCode
elapsedMs = $elapsed
packageReadiness = Get-PackageReadiness -Kinds $PackageKinds
} | ConvertTo-Json -Compress
androidNativeValidation = $androidNativeValidation
packageReadiness = @(Get-PackageReadiness -Kinds $PackageKinds)
} | ConvertTo-Json -Compress -Depth 8
exit $buildExitCode
}
@@ -249,6 +359,9 @@ $checks = @(
$failed = @($checks | Where-Object { -not $_.exists })
$exitCode = if ($failed.Count -eq 0) { 0 } else { 2 }
if ($androidNativeValidation.exitCode -ne 0 -and $exitCode -eq 0) {
$exitCode = $androidNativeValidation.exitCode
}
$elapsedMs = [int]((Get-Date) - $started).TotalMilliseconds
[ordered]@{
@@ -259,7 +372,8 @@ $elapsedMs = [int]((Get-Date) - $started).TotalMilliseconds
exitCode = $exitCode
elapsedMs = $elapsedMs
checks = $checks
packageReadiness = Get-PackageReadiness -Kinds $PackageKinds
} | ConvertTo-Json -Compress -Depth 5
androidNativeValidation = $androidNativeValidation
packageReadiness = @(Get-PackageReadiness -Kinds $PackageKinds)
} | ConvertTo-Json -Compress -Depth 8
exit $exitCode

View File

@@ -84,9 +84,9 @@ package_readiness_json() {
printf '['
printf '{"kind":"windows-appx","status":"blocked","reason":"legacy-wapproj-present-but-root-cmake-package-target-missing","debt":"DEBT-0011","validationCommand":"msbuild PanoPainterPackage/PanoPainterPackage.wapproj /p:Configuration=%s /p:Platform=x64","prerequisites":[{"name":"legacy-wapproj","available":%s,"detail":%s},{"name":"appx-manifest","available":%s,"detail":%s},{"name":"makeappx","available":%s,"detail":"Windows SDK packaging tool"},{"name":"signtool","available":%s,"detail":"Windows SDK signing tool"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"app-packages","path":%s,"pathType":"Container","exists":%s}]}' "$configuration" "$(json_bool "$windows_wapproj_exists")" "$(json_string "$windows_wapproj")" "$(json_bool "$windows_manifest_exists")" "$(json_string "$windows_manifest")" "$(json_bool "$makeappx_exists")" "$(json_bool "$signtool_exists")" "$(json_string "$windows_output")" "$(json_bool "$windows_output_exists")"
printf ',{"kind":"android-standard-apk","status":"blocked","reason":"legacy-gradle-package-not-consuming-root-cmake-targets","debt":"DEBT-0011","validationCommand":"gradle -p android/android assembleDebug","prerequisites":[{"name":"gradle-build","available":%s,"detail":%s},{"name":"android-manifest","available":%s,"detail":%s},{"name":"gradle","available":%s,"detail":"Android package builder"},{"name":"root-cmake-preset","available":true,"detail":"android-arm64/android-x64"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"apk-output","path":%s,"pathType":"Container","exists":%s}]}' "$(json_bool "$android_standard_gradle_exists")" "$(json_string "$android_standard_gradle")" "$(json_bool "$android_standard_manifest_exists")" "$(json_string "$android_standard_manifest")" "$(json_bool "$gradle_exists")" "$(json_string "$android_standard_output")" "$(json_bool "$android_standard_output_exists")"
printf ',{"kind":"android-quest-apk","status":"blocked","reason":"legacy-gradle-package-not-consuming-root-cmake-targets","debt":"DEBT-0011","validationCommand":"gradle -p android/quest assembleDebug","prerequisites":[{"name":"gradle-build","available":%s,"detail":%s},{"name":"android-manifest","available":%s,"detail":%s},{"name":"gradle","available":%s,"detail":"Android package builder"},{"name":"root-cmake-preset","available":true,"detail":"android-quest-arm64"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"apk-output","path":%s,"pathType":"Container","exists":%s}]}' "$(json_bool "$android_quest_gradle_exists")" "$(json_string "$android_quest_gradle")" "$(json_bool "$android_quest_manifest_exists")" "$(json_string "$android_quest_manifest")" "$(json_bool "$gradle_exists")" "$(json_string "$android_quest_output")" "$(json_bool "$android_quest_output_exists")"
printf ',{"kind":"android-focus-apk","status":"blocked","reason":"legacy-gradle-package-not-consuming-root-cmake-targets","debt":"DEBT-0011","validationCommand":"gradle -p android/focus assembleDebug","prerequisites":[{"name":"gradle-build","available":%s,"detail":%s},{"name":"android-manifest","available":%s,"detail":%s},{"name":"gradle","available":%s,"detail":"Android package builder"},{"name":"root-cmake-preset","available":true,"detail":"android-focus-arm64"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"apk-output","path":%s,"pathType":"Container","exists":%s}]}' "$(json_bool "$android_focus_gradle_exists")" "$(json_string "$android_focus_gradle")" "$(json_bool "$android_focus_manifest_exists")" "$(json_string "$android_focus_manifest")" "$(json_bool "$gradle_exists")" "$(json_string "$android_focus_output")" "$(json_bool "$android_focus_output_exists")"
printf ',{"kind":"android-standard-apk","status":"blocked","reason":"legacy-gradle-package-not-consuming-root-cmake-targets","debt":"DEBT-0011","validationCommand":"gradle -p android/android assembleDebug","prerequisites":[{"name":"gradle-build","available":%s,"detail":%s},{"name":"android-manifest","available":%s,"detail":%s},{"name":"gradle","available":%s,"detail":"Android package builder"},{"name":"retained-native-cmake-check","available":true,"detail":"powershell -ExecutionPolicy Bypass -File scripts/automation/android-legacy-package-build.ps1 -Packages standard"},{"name":"root-cmake-preset","available":true,"detail":"android-arm64/android-x64"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"apk-output","path":%s,"pathType":"Container","exists":%s}]}' "$(json_bool "$android_standard_gradle_exists")" "$(json_string "$android_standard_gradle")" "$(json_bool "$android_standard_manifest_exists")" "$(json_string "$android_standard_manifest")" "$(json_bool "$gradle_exists")" "$(json_string "$android_standard_output")" "$(json_bool "$android_standard_output_exists")"
printf ',{"kind":"android-quest-apk","status":"blocked","reason":"legacy-gradle-package-not-consuming-root-cmake-targets","debt":"DEBT-0011","validationCommand":"gradle -p android/quest assembleDebug","prerequisites":[{"name":"gradle-build","available":%s,"detail":%s},{"name":"android-manifest","available":%s,"detail":%s},{"name":"gradle","available":%s,"detail":"Android package builder"},{"name":"retained-native-cmake-check","available":true,"detail":"powershell -ExecutionPolicy Bypass -File scripts/automation/android-legacy-package-build.ps1 -Packages quest -ConfigureOnly"},{"name":"root-cmake-preset","available":true,"detail":"android-quest-arm64"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"apk-output","path":%s,"pathType":"Container","exists":%s}]}' "$(json_bool "$android_quest_gradle_exists")" "$(json_string "$android_quest_gradle")" "$(json_bool "$android_quest_manifest_exists")" "$(json_string "$android_quest_manifest")" "$(json_bool "$gradle_exists")" "$(json_string "$android_quest_output")" "$(json_bool "$android_quest_output_exists")"
printf ',{"kind":"android-focus-apk","status":"blocked","reason":"legacy-gradle-package-not-consuming-root-cmake-targets","debt":"DEBT-0011","validationCommand":"gradle -p android/focus assembleDebug","prerequisites":[{"name":"gradle-build","available":%s,"detail":%s},{"name":"android-manifest","available":%s,"detail":%s},{"name":"gradle","available":%s,"detail":"Android package builder"},{"name":"retained-native-cmake-check","available":true,"detail":"powershell -ExecutionPolicy Bypass -File scripts/automation/android-legacy-package-build.ps1 -Packages focus -ConfigureOnly"},{"name":"root-cmake-preset","available":true,"detail":"android-focus-arm64"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"apk-output","path":%s,"pathType":"Container","exists":%s}]}' "$(json_bool "$android_focus_gradle_exists")" "$(json_string "$android_focus_gradle")" "$(json_bool "$android_focus_manifest_exists")" "$(json_string "$android_focus_manifest")" "$(json_bool "$gradle_exists")" "$(json_string "$android_focus_output")" "$(json_bool "$android_focus_output_exists")"
printf ',{"kind":"apple-bundle","status":"blocked","reason":"legacy-xcode-project-and-host-toolchain-not-aligned-with-root-cmake-package-target","debt":"DEBT-0011","validationCommand":"xcodebuild -project PanoPainter.xcodeproj -configuration %s","prerequisites":[{"name":"legacy-xcode-project","available":%s,"detail":%s},{"name":"xcodebuild","available":%s,"detail":"Apple package builder"},{"name":"root-cmake-preset","available":true,"detail":"macos/ios-device/ios-simulator"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"apple-package-output","path":%s,"pathType":"Container","exists":%s}]}' "$configuration" "$(json_bool "$apple_project_exists")" "$(json_string "$apple_project")" "$(json_bool "$xcodebuild_exists")" "$(json_string "$apple_output")" "$(json_bool "$apple_output_exists")"
printf ',{"kind":"webgl","status":"blocked","reason":"emscripten-preset-exists-but-webgl-package-target-missing","debt":"DEBT-0011","validationCommand":"cmake --build --preset emscripten --target PanoPainter","prerequisites":[{"name":"emcc","available":%s,"detail":"Emscripten compiler"},{"name":"emcmake","available":%s,"detail":"Emscripten CMake wrapper"},{"name":"root-cmake-preset","available":true,"detail":"emscripten"},{"name":"root-cmake-package-target","available":false,"detail":"Not migrated yet"}],"artifacts":[{"name":"webgl-output","path":%s,"pathType":"Container","exists":%s}]}' "$(json_bool "$emcc_exists")" "$(json_bool "$emcmake_exists")" "$(json_string "$webgl_output")" "$(json_bool "$webgl_output_exists")"
printf ']'

View File

@@ -61,6 +61,10 @@ def main() -> int:
"package-smoke.ps1": (root / "scripts" / "automation" / "package-smoke.ps1").read_text(encoding="utf-8").count("ReadinessOnly"),
"package-smoke.sh": (root / "scripts" / "automation" / "package-smoke.sh").read_text(encoding="utf-8").count("readiness_only"),
}
retained_android_native_counts = count_regex(root, {
"package-smoke.ps1": r"retained-native-cmake-check",
"package-smoke.sh": r"retained-native-cmake-check",
})
missing = {
"package-smoke.ps1": [kind for kind in expected if kind not in ps_kinds],
@@ -77,6 +81,9 @@ def main() -> int:
debt_complete = {name: count >= debt_thresholds[name] for name, count in debt_counts.items()}
blocked_complete = {name: count >= len(expected) for name, count in blocked_counts.items()}
readiness_mode_present = {name: count > 0 for name, count in readiness_mode_counts.items()}
retained_android_native_complete = {
name: count >= 3 for name, count in retained_android_native_counts.items()
}
ok = (
all(not values for values in missing.values())
@@ -84,6 +91,7 @@ def main() -> int:
and all(debt_complete.values())
and all(blocked_complete.values())
and all(readiness_mode_present.values())
and all(retained_android_native_complete.values())
)
print(json.dumps({
@@ -98,6 +106,7 @@ def main() -> int:
"debtComplete": debt_complete,
"blockedComplete": blocked_complete,
"readinessModePresent": readiness_mode_present,
"retainedAndroidNativeComplete": retained_android_native_complete,
}, separators=(",", ":")))
return 0 if ok else 1