Files
Password-Manager/android-client/repack-apk.ps1
T
r-zakarya 202b93c246 feat(android): a padlock icon instead of Delphi's default
Cyan on slate, the accent the desktop app already uses. Adaptive vectors for
Android 8+ - background covering the full 108 units since the launcher applies
its own mask, foreground kept inside the central 66 that no mask can crop -
plus a monochrome layer for Android 13 themed icons, where the keyhole has to
be a hole in the path rather than a shape in another colour.

PNGs for older launchers come from make-icons.ps1, same drawing, and carry
their own rounded square since nothing masks them.

They are copied over Delphi's in repack-apk.ps1, for the same reason as
libsk4d.so: the Android_LauncherIcon and Android_AdaptiveIcon properties ought
to be enough, and nothing deploys them here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 16:11:31 +01:00

43 lines
2.3 KiB
PowerShell

# Refait les trois dernieres etapes de l'empaquetage Android, sur le dossier
# deja prepare - sans le vider au prealable.
#
# POURQUOI : la cible Deploy de MSBuild reconstruit library\lib avant d'appeler
# aapt, ce qui efface toute bibliotheque native ajoutee a la main. Or ce projet
# n'a pas d'entrees de deploiement fonctionnelles (voir README), donc libsk4d.so
# - le moteur Skia, indispensable au rendu de l'arabe - ne peut y arriver
# autrement. On laisse donc Deploy faire son travail, puis on remet la
# bibliotheque et on refait aapt / zipalign / signature.
#
# A lancer depuis la racine du depot, apres un Deploy reussi.
$ErrorActionPreference = 'Stop'
$sdk = 'C:\Users\Public\Documents\Embarcadero\Studio\23.0\CatalogRepository\AndroidSDK-2525-23.0.51511.6924'
$bds = 'C:\Program Files (x86)\Embarcadero\Studio\23.0'
$jdk = 'C:\Program Files\Eclipse Adoptium\jdk-11.0.15.10-hotspot'
$pac = "$bds\bin\paclient.exe"
$p = '.\Android64\Debug\pmserverApk'
# 1. Remettre Skia, que Deploy vient d'effacer.
Copy-Item "$bds\binandroid64\libsk4d.so" "$p\library\lib\arm64-v8a\libsk4d.so" -Force
# 1 bis. Nos icones par-dessus celles de Delphi. Meme raison que pour Skia :
# les proprietes Android_LauncherIcon* et Android_AdaptiveIcon* du .dproj
# devraient suffire, mais rien ne les deploie ici.
Copy-Item "$PSScriptRoot\android-res\*" "$p\res\" -Recurse -Force
# 2. aapt : reconstruit l'archive non alignee depuis library, classes, res.
& $pac -u8 --aaptpackage="$sdk\build-tools\33.0.2\Aapt.exe,$p\library,$p\classes,$p\res,$p\assets,$p\AndroidManifest.xml,$sdk\platforms\android-33\android.jar,$p\bin\pmserverApk-unaligned.apk"
if ($LASTEXITCODE -ne 0) { throw "aapt a echoue" }
# 3. zipalign refuse d'ecraser sa sortie : l'APK precedent doit disparaitre.
Remove-Item "$p\bin\pmserverApk.apk" -Force -ErrorAction SilentlyContinue
& $pac -u8 --zipalign="$sdk\build-tools\33.0.2\ZipAlign.exe,$p\bin\pmserverApk-unaligned.apk,$p\bin\pmserverApk.apk,4"
if ($LASTEXITCODE -ne 0) { throw "zipalign a echoue" }
& $pac -u8 --apksign="$jdk\bin\java.exe,$sdk\build-tools\33.0.2\lib\apksigner.jar,$p\bin\pmserverApk.apk,androiddebugkey,$env:APPDATA\Embarcadero\BDS\23.0\debug.keystore,android,android"
if ($LASTEXITCODE -ne 0) { throw "signature echouee" }
$apk = Get-Item "$p\bin\pmserverApk.apk"
"APK {0:N1} Mo" -f ($apk.Length / 1MB)