Initialize generic Eve Flutter runtime
This commit is contained in:
commit
5998044f2b
108 changed files with 5784 additions and 0 deletions
80
scripts/capture-android-flutter-parity.ps1
Normal file
80
scripts/capture-android-flutter-parity.ps1
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
param(
|
||||
[string] $FixtureId = "cultui-inspector",
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string] $SurfacePath,
|
||||
[string] $FlutterExe = "E:\Projects\Eve\tools\deps\flutter\bin\flutter.bat",
|
||||
[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 = $projectRoot
|
||||
$flutter = $FlutterExe
|
||||
$flutterSdkRoot = Split-Path -Parent (Split-Path -Parent $flutter)
|
||||
$assetPath = Join-Path $flutterRoot "assets\current-surface.json"
|
||||
$fontDir = Join-Path $flutterRoot "assets\fonts"
|
||||
$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
|
||||
Copy-Item -LiteralPath (Join-Path $flutterSdkRoot "bin\cache\artifacts\material_fonts\roboto-regular.ttf") -Destination (Join-Path $fontDir "Roboto-Regular.ttf") -Force
|
||||
Copy-Item -LiteralPath (Join-Path $flutterSdkRoot "bin\cache\artifacts\material_fonts\roboto-bold.ttf") -Destination (Join-Path $fontDir "Roboto-Bold.ttf") -Force
|
||||
Copy-Item -LiteralPath $SurfacePath -Destination $assetPath -Force
|
||||
|
||||
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"
|
||||
}
|
||||
Reference in a new issue