feat(m6): store hardening with r8, release pipeline, symbols and store assets

This commit is contained in:
2026-10-24 23:51:37 +02:00
parent 33bdc16fbd
commit 6970daf060
25 changed files with 228 additions and 29 deletions
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Builds a Play-ready App Bundle plus the native debug symbols.
set -euo pipefail
cd "$(dirname "$0")/.."
export ANDROID_NDK_HOME="${ANDROID_NDK_HOME:-$HOME/Android/Sdk/ndk/28.2.13676358}"
echo '==> Rust release libraries'
cargo ndk --platform 24 -t arm64-v8a -t armeabi-v7a -o app/android/app/src/main/jniLibs build --release -p ffi
for abi in arm64-v8a armeabi-v7a; do
so="app/android/app/src/main/jniLibs/$abi/libffi.so"
# 16 KB pages are mandatory for 64-bit ABIs; 32-bit ARM still uses 4 KB.
case "$abi" in
arm64-v8a|x86_64) expect=0x4000 ;;
*) expect=0x1000 ;;
esac
if readelf -lW "$so" | awk -v e="$expect" '$1=="LOAD" && $NF!=e {found=1} END{exit !found}'; then
echo "ERROR: $abi is not aligned to $expect" >&2
exit 1
fi
echo "OK: $abi aligned to $expect ($(stat -c%s "$so") bytes)"
done
echo '==> Native debug symbols (unstripped)'
rm -rf build/native-symbols
mkdir -p build/native-symbols
for abi in arm64-v8a armeabi-v7a; do
mkdir -p "build/native-symbols/$abi"
cp "app/android/app/src/main/jniLibs/$abi/libffi.so" "build/native-symbols/$abi/"
done
(cd build/native-symbols && zip -qr ../native-debug-symbols.zip .)
echo "symbols: $(stat -c%s build/native-debug-symbols.zip) bytes"
echo '==> Flutter bundle (AAB)'
(cd app && flutter build appbundle --release)
AAB=app/build/app/outputs/bundle/release/app-release.aab
echo "aab: $(stat -c%s "$AAB") bytes"
unzip -l "$AAB" | grep -E 'lib/|AndroidManifest' | head -8
echo '==> Release APK for device smoke test'
(cd app && flutter build apk --release --target-platform android-arm64)
echo "apk: $(stat -c%s app/build/app/outputs/flutter-apk/app-release.apk) bytes"
+8 -2
View File
@@ -9,9 +9,15 @@ cargo ndk --platform 24 \
build --release -p ffi
for abi in arm64-v8a armeabi-v7a x86_64; do
so="app/android/app/src/main/jniLibs/$abi/libffi.so"
if readelf -lW "$so" | awk '$1=="LOAD" && $NF!="0x4000" {found=1} END{exit !found}'; then
echo "ERROR: $abi not 16 KB aligned" >&2
# 16 KB pages are mandatory for 64-bit ABIs; 32-bit ARM still uses 4 KB.
case "$abi" in
arm64-v8a|x86_64) expect=0x4000 ;;
*) expect=0x1000 ;;
esac
if readelf -lW "$so" | awk -v e="$expect" '$1=="LOAD" && $NF!=e {found=1} END{exit !found}'; then
echo "ERROR: $abi is not aligned to $expect" >&2
exit 1
fi
echo "OK: $abi aligned to $expect ($(stat -c%s "$so") bytes)"
done
echo 'OK: all ABIs 16 KB aligned'