Register alpha.0 B4A prototype
This commit is contained in:
51
tools/build-b4a.ps1
Normal file
51
tools/build-b4a.ps1
Normal file
@@ -0,0 +1,51 @@
|
||||
param(
|
||||
[string]$ProjectRoot = (Resolve-Path "$PSScriptRoot\..").Path,
|
||||
[string]$ProjectFile = "swarm.b4a",
|
||||
[string]$BuilderPath = "C:\Program Files\Anywhere Software\B4A\B4ABuilder.exe",
|
||||
[ValidateSet("Build", "BuildBundle", "BuildLibrary")]
|
||||
[string]$Task = "Build",
|
||||
[switch]$NoSign,
|
||||
[switch]$Obfuscate,
|
||||
[switch]$NoClean,
|
||||
[string]$Configuration = "",
|
||||
[string]$Output = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $BuilderPath)) {
|
||||
throw "B4ABuilder.exe non trovato: $BuilderPath"
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $ProjectRoot $ProjectFile))) {
|
||||
throw "Progetto B4A non trovato: $(Join-Path $ProjectRoot $ProjectFile)"
|
||||
}
|
||||
|
||||
$arguments = @(
|
||||
"-Task=$Task",
|
||||
"-BaseFolder=$ProjectRoot",
|
||||
"-Project=$ProjectFile",
|
||||
"-Obfuscate=$($Obfuscate.IsPresent)",
|
||||
"-ShowWarnings=True",
|
||||
"-NoSign=$($NoSign.IsPresent)",
|
||||
"-NoClean=$($NoClean.IsPresent)"
|
||||
)
|
||||
|
||||
if ($Configuration.Trim().Length -gt 0) {
|
||||
$arguments += "-Configuration=$Configuration"
|
||||
}
|
||||
|
||||
if ($Output.Trim().Length -gt 0) {
|
||||
$arguments += "-Output=$Output"
|
||||
}
|
||||
|
||||
Write-Host "B4A build: $ProjectFile"
|
||||
Write-Host "Root: $ProjectRoot"
|
||||
Write-Host ""
|
||||
|
||||
& $BuilderPath @arguments
|
||||
$exitCode = $LASTEXITCODE
|
||||
|
||||
if ($exitCode -ne 0) {
|
||||
throw "Build B4A fallita. Exit code: $exitCode"
|
||||
}
|
||||
40
tools/deploy-emulator.ps1
Normal file
40
tools/deploy-emulator.ps1
Normal file
@@ -0,0 +1,40 @@
|
||||
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"
|
||||
}
|
||||
31
tools/watch-logcat.ps1
Normal file
31
tools/watch-logcat.ps1
Normal file
@@ -0,0 +1,31 @@
|
||||
param(
|
||||
[string]$ProjectRoot = (Resolve-Path "$PSScriptRoot\..").Path,
|
||||
[string]$AdbPath = "C:\android\platform-tools\adb.exe",
|
||||
[string]$PackageName = "anywheresoftware.b4a.swarm",
|
||||
[switch]$KeepExisting
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $AdbPath)) {
|
||||
throw "adb.exe non trovato: $AdbPath"
|
||||
}
|
||||
|
||||
$logDir = Join-Path $ProjectRoot "logs"
|
||||
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
|
||||
|
||||
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
|
||||
$logFile = Join-Path $logDir "logcat-$stamp.txt"
|
||||
|
||||
& $AdbPath wait-for-device
|
||||
|
||||
if (-not $KeepExisting) {
|
||||
& $AdbPath logcat -c
|
||||
}
|
||||
|
||||
Write-Host "Logcat live. Premi Ctrl+C per fermare."
|
||||
Write-Host "File: $logFile"
|
||||
Write-Host "Filtro mentale utile: cerca '$PackageName', 'AndroidRuntime', 'FATAL EXCEPTION', 'System.err', 'B4A'."
|
||||
Write-Host ""
|
||||
|
||||
& $AdbPath logcat -v time | Tee-Object -FilePath $logFile
|
||||
Reference in New Issue
Block a user