41 lines
975 B
PowerShell
41 lines
975 B
PowerShell
param(
|
|
[string]$ProjectRoot = (Resolve-Path "$PSScriptRoot\..").Path,
|
|
[string]$AdbPath = "C:\android\platform-tools\adb.exe",
|
|
[string]$PackageName = "anywheresoftware.b4a.swarm",
|
|
[string]$MainActivity = ".main",
|
|
[switch]$NoBuild,
|
|
[switch]$NoLaunch,
|
|
[switch]$KeepLogcat
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
if (-not (Test-Path -LiteralPath $AdbPath)) {
|
|
throw "adb.exe non trovato: $AdbPath"
|
|
}
|
|
|
|
if (-not $NoBuild) {
|
|
& "$PSScriptRoot\build-b4a.ps1" -ProjectRoot $ProjectRoot
|
|
}
|
|
|
|
$apkPath = Join-Path $ProjectRoot "Objects\swarm.apk"
|
|
if (-not (Test-Path -LiteralPath $apkPath)) {
|
|
throw "APK non trovato: $apkPath"
|
|
}
|
|
|
|
& $AdbPath wait-for-device
|
|
|
|
if (-not $KeepLogcat) {
|
|
& $AdbPath logcat -c
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Installo APK: $apkPath"
|
|
& $AdbPath install -r -d $apkPath
|
|
|
|
if (-not $NoLaunch) {
|
|
Write-Host ""
|
|
Write-Host "Avvio app: $PackageName/$MainActivity"
|
|
& $AdbPath shell am start -n "$PackageName/$MainActivity"
|
|
}
|