21 lines
1.0 KiB
PowerShell
21 lines
1.0 KiB
PowerShell
# Builds the Android debug APK and the Windows portable exe into .\release
|
|
$ErrorActionPreference = 'Stop'
|
|
Set-Location $PSScriptRoot\..
|
|
$version = (Get-Content package.json -Raw | ConvertFrom-Json).version
|
|
if (-not $env:JAVA_HOME) { $env:JAVA_HOME = 'C:\Program Files\Android\Android Studio\jbr' }
|
|
if (-not $env:ANDROID_HOME) { $env:ANDROID_HOME = Join-Path $env:LOCALAPPDATA 'Android\Sdk' }
|
|
New-Item -ItemType Directory -Force release | Out-Null
|
|
|
|
Write-Host "== Building APK $version =="
|
|
npm run android:apk
|
|
if ($LASTEXITCODE) { throw 'APK build failed' }
|
|
Write-Warning "The legacy ep-mail $version.apk copy is a debug APK and overwrites any existing file with that name."
|
|
Copy-Item android\app\build\outputs\apk\debug\app-debug.apk "release\ep-mail $version.apk" -Force
|
|
|
|
Write-Host "== Building portable exe $version =="
|
|
npm run dist:win:portable
|
|
if ($LASTEXITCODE) { throw 'Portable build failed' }
|
|
|
|
Write-Host "`nDone:"
|
|
Get-ChildItem release | Where-Object { $_.Name -like "ep-mail $version.*" } | ForEach-Object { " $($_.FullName)" }
|