Add Windows Gradle smoke test for Android agent-app project.
Validates APK module layout and tolerates missing JDK 17 for gradlew help on developer machines.
This commit is contained in:
45
android/smoke-gradle.ps1
Normal file
45
android/smoke-gradle.ps1
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Smoke-check that the Android Gradle project is structurally valid.
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
|
$App = Join-Path $Root "agent-app"
|
||||||
|
|
||||||
|
$required = @(
|
||||||
|
(Join-Path $App "build.gradle.kts"),
|
||||||
|
(Join-Path $App "settings.gradle.kts"),
|
||||||
|
(Join-Path $App "src\main\AndroidManifest.xml"),
|
||||||
|
(Join-Path $App "src\main\java\com\aetherforge\agent\MainActivity.kt"),
|
||||||
|
(Join-Path $App "src\main\java\com\aetherforge\agent\AgentService.kt"),
|
||||||
|
(Join-Path $App "src\main\java\com\aetherforge\agent\BootReceiver.kt"),
|
||||||
|
(Join-Path $App "src\main\assets\config.json")
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach ($f in $required) {
|
||||||
|
if (-not (Test-Path $f)) { throw "missing required file: $f" }
|
||||||
|
}
|
||||||
|
|
||||||
|
$manifest = Get-Content (Join-Path $App "src\main\AndroidManifest.xml") -Raw
|
||||||
|
foreach ($needle in @("FOREGROUND_SERVICE", "RECEIVE_BOOT_COMPLETED", "AgentService")) {
|
||||||
|
if ($manifest -notmatch [regex]::Escape($needle)) {
|
||||||
|
throw "AndroidManifest missing $needle"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$gradlew = Join-Path $App "gradlew.bat"
|
||||||
|
if (Test-Path $gradlew) {
|
||||||
|
Push-Location $App
|
||||||
|
$prevEap = $ErrorActionPreference
|
||||||
|
$ErrorActionPreference = "Continue"
|
||||||
|
try {
|
||||||
|
& $gradlew help -q --no-daemon 2>&1 | Out-Null
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "gradle help skipped (JDK 17+ required for AGP 8.x)" -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
$ErrorActionPreference = $prevEap
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Write-Host "gradlew missing - structural checks only"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "android gradle smoke: OK" -ForegroundColor Green
|
||||||
Reference in New Issue
Block a user