Route Android parity through Flutter
This commit is contained in:
parent
b9172cd8dc
commit
290b49d2e8
7 changed files with 168 additions and 49 deletions
85
scripts/capture-android-flutter-parity.ps1
Normal file
85
scripts/capture-android-flutter-parity.ps1
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
param(
|
||||
[string] $FixtureId = "cultui-inspector",
|
||||
[string] $OutputPath = "artifacts\parity\android-flutter-cultui-inspector.png",
|
||||
[int] $Width = 0,
|
||||
[int] $Height = 0,
|
||||
[ValidateSet("portrait", "landscape", "natural")]
|
||||
[string] $Orientation = "natural",
|
||||
[int] $LaunchDelaySeconds = 4,
|
||||
[switch] $SkipBuild,
|
||||
[switch] $ForceInstall
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$flutterRoot = Join-Path $projectRoot "flutter\eve_parity"
|
||||
$flutter = Join-Path $projectRoot "tools\deps\flutter\bin\flutter.bat"
|
||||
$assetPath = Join-Path $flutterRoot "assets\current-surface.json"
|
||||
$fontDir = Join-Path $flutterRoot "assets\fonts"
|
||||
$repixelizerAssetDir = Join-Path $flutterRoot "assets\repixelizer"
|
||||
$apkPath = Join-Path $flutterRoot "build\app\outputs\flutter-apk\app-debug.apk"
|
||||
|
||||
if (-not (Test-Path $flutter)) {
|
||||
throw "Flutter is not installed at $flutter"
|
||||
}
|
||||
|
||||
if (-not $SkipBuild) {
|
||||
New-Item -ItemType Directory -Force (Split-Path -Parent $assetPath) | Out-Null
|
||||
New-Item -ItemType Directory -Force $fontDir | Out-Null
|
||||
New-Item -ItemType Directory -Force $repixelizerAssetDir | Out-Null
|
||||
|
||||
Copy-Item -LiteralPath (Join-Path $projectRoot "tools\deps\flutter\bin\cache\artifacts\material_fonts\roboto-regular.ttf") -Destination (Join-Path $fontDir "Roboto-Regular.ttf") -Force
|
||||
Copy-Item -LiteralPath (Join-Path $projectRoot "tools\deps\flutter\bin\cache\artifacts\material_fonts\roboto-bold.ttf") -Destination (Join-Path $fontDir "Roboto-Bold.ttf") -Force
|
||||
curl.exe -L "https://repixelizer.gamecult.org/app/landing-assets/character-input.png" -o (Join-Path $repixelizerAssetDir "character-input.png") | Out-Host
|
||||
curl.exe -L "https://repixelizer.gamecult.org/app/landing-assets/character-repixelized.png" -o (Join-Path $repixelizerAssetDir "character-repixelized.png") | Out-Host
|
||||
|
||||
node .\tools\parity\export-fixture.mjs $FixtureId $assetPath | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Fixture export failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
Push-Location $flutterRoot
|
||||
try {
|
||||
& $flutter pub get
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Flutter pub get failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
& $flutter build apk --debug "--dart-define=EVE_PARITY_FIXTURE=$FixtureId"
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Flutter Android APK build failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path $apkPath)) {
|
||||
throw "Flutter Android APK not found: $apkPath"
|
||||
}
|
||||
|
||||
$captureArgs = @(
|
||||
"-ExecutionPolicy", "Bypass",
|
||||
"-File", ".\scripts\capture-android-screenshot.ps1",
|
||||
"-OutputPath", $OutputPath,
|
||||
"-ApkPath", $apkPath,
|
||||
"-PackageName", "com.example.eve_parity",
|
||||
"-ActivityName", ".MainActivity",
|
||||
"-LaunchDelaySeconds", $LaunchDelaySeconds,
|
||||
"-Orientation", $Orientation
|
||||
)
|
||||
|
||||
if ($Width -gt 0) {
|
||||
$captureArgs += @("-Width", $Width)
|
||||
}
|
||||
if ($Height -gt 0) {
|
||||
$captureArgs += @("-Height", $Height)
|
||||
}
|
||||
if ($ForceInstall -or -not $SkipBuild) {
|
||||
$captureArgs += "-ForceInstall"
|
||||
}
|
||||
|
||||
powershell @captureArgs
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Android Flutter screenshot failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ $runRoot = Join-Path $projectRoot (Join-Path $OutputDirectory $stamp)
|
|||
New-Item -ItemType Directory -Force $runRoot | Out-Null
|
||||
$manifest = Get-Content (Join-Path $projectRoot "tools\parity\parity-manifest.json") | ConvertFrom-Json
|
||||
$responsiveCases = @($manifest.responsiveCases)
|
||||
$androidNativeCases = @($manifest.androidNativeCases)
|
||||
$androidDeviceCases = @($manifest.androidDeviceCases)
|
||||
|
||||
$results = [ordered]@{
|
||||
schema = "gamecult.eve.parity_smoke.v1"
|
||||
|
|
@ -101,36 +101,35 @@ try {
|
|||
-FixturePath $iosFixture
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force .\android\app\src\main\assets | Out-Null
|
||||
node .\tools\parity\export-fixture.mjs $ProviderId .\android\app\src\main\assets\current-surface.json | Out-Host
|
||||
if ($ProviderId -eq "repixelizer") {
|
||||
New-Item -ItemType Directory -Force .\android\app\src\main\assets\repixelizer | Out-Null
|
||||
curl.exe -L "https://repixelizer.gamecult.org/app/landing-assets/character-input.png" -o .\android\app\src\main\assets\repixelizer\character-input.png | Out-Host
|
||||
curl.exe -L "https://repixelizer.gamecult.org/app/landing-assets/character-repixelized.png" -o .\android\app\src\main\assets\repixelizer\character-repixelized.png | Out-Host
|
||||
}
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\build-android.ps1 | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Android fixture APK build failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
$androidFlutterBuilt = $false
|
||||
foreach ($case in $responsiveCases) {
|
||||
Invoke-Capture "android-$($case.id)" {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\capture-android-screenshot.ps1 `
|
||||
-OutputPath (Join-Path $runRoot "android-periwinkle-$($case.id).png") `
|
||||
-Width $case.width `
|
||||
-Height $case.height `
|
||||
-Orientation $case.orientation `
|
||||
-UseFixture `
|
||||
-ForceInstall
|
||||
Invoke-Capture "android-flutter-$($case.id)" {
|
||||
$args = @(
|
||||
"-ExecutionPolicy", "Bypass",
|
||||
"-File", ".\scripts\capture-android-flutter-parity.ps1",
|
||||
"-FixtureId", $ProviderId,
|
||||
"-OutputPath", (Join-Path $runRoot "android-flutter-periwinkle-$($case.id).png"),
|
||||
"-Width", $case.width,
|
||||
"-Height", $case.height,
|
||||
"-Orientation", $case.orientation
|
||||
)
|
||||
if ($androidFlutterBuilt) {
|
||||
$args += "-SkipBuild"
|
||||
} else {
|
||||
$args += "-ForceInstall"
|
||||
}
|
||||
powershell @args
|
||||
$androidFlutterBuilt = $true
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($case in $androidNativeCases) {
|
||||
Invoke-Capture "android-$($case.id)" {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\capture-android-screenshot.ps1 `
|
||||
-OutputPath (Join-Path $runRoot "android-periwinkle-$($case.id).png") `
|
||||
foreach ($case in $androidDeviceCases) {
|
||||
Invoke-Capture "android-flutter-$($case.id)" {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\capture-android-flutter-parity.ps1 `
|
||||
-FixtureId $ProviderId `
|
||||
-OutputPath (Join-Path $runRoot "android-flutter-periwinkle-$($case.id).png") `
|
||||
-Orientation $case.orientation `
|
||||
-UseFixture
|
||||
-SkipBuild
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue