commit 2c3cc9b99363c4e114abb478fa8169157c9e7359
parent 904af3e931aa882e51086de7982cc572ca017d22
Author: Florian Dold <dold@taler.net>
Date: Tue, 24 Nov 2026 12:03:52 +0100
taler-harness: build the Android test wallet with local wallet-core
Diffstat:
2 files changed, 79 insertions(+), 10 deletions(-)
diff --git a/packages/taler-harness/android/README.md b/packages/taler-harness/android/README.md
@@ -36,12 +36,25 @@ it with a temporary test key, verifies the signature, and prints its SHA-256.
It does not require the nightly publishing key. Rebuild after Android source
changes; the test runner installs the supplied APK without downloading one.
-Use an APK with wallet core built from this checkout. The core bundled with
-`net.taler:qtart:1.6.42` predates the withdrawal resume fix (`1b31cd676`) and the
-fixes included with these scenarios: KYC authentication transfer subjects,
-deposit continuation after authentication, and cancellation of proposed payments.
-Rebuilding only the Android sources with that older dependency still uses the
-older wallet core.
+To embed the wallet-core sources from this TypeScript checkout, use the local-core
+build on Linux. It needs Meson, Ninja, CMake, a host C compiler, the Android NDK,
+and a sibling `quickjs-tart` checkout. Set `QTART_CHECKOUT` for another location.
+Choose a qtart Git revision whose `VERSION_NAME` matches the version pinned in
+the Android wallet's Gradle build. For the current Android pin (1.6.49):
+
+```sh
+export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/28.2.13676358" # installed NDK
+export QTART_REV=3f58047d
+export ANDROID_ABI=x86_64 # match the emulator
+packages/taler-harness/android/build-nightly.sh --local-core \
+ "$HOME/taler/taler-android" /tmp/wallet-nightly-local.apk
+```
+
+The helper runs `make embedded`, cross-compiles the bundle into qtart in a
+temporary directory, builds its Android AAR, and selects that AAR for the
+nightly build. It checks the signed APK's native wallet library against the
+AAR and prints the revisions and checksums. The resulting wallet targets the
+selected ABI.
## Run
diff --git a/packages/taler-harness/android/build-nightly.sh b/packages/taler-harness/android/build-nightly.sh
@@ -15,8 +15,13 @@
set -euo pipefail
+local_core=false
+if [[ ${1:-} == --local-core ]]; then
+ local_core=true
+ shift
+fi
if [[ $# -ne 2 ]]; then
- echo "Usage: $0 TALER_ANDROID_CHECKOUT OUTPUT_APK" >&2
+ echo "Usage: $0 [--local-core] TALER_ANDROID_CHECKOUT OUTPUT_APK" >&2
exit 2
fi
android_checkout=$(realpath "$1")
@@ -27,13 +32,60 @@ apksigner=$(find "$ANDROID_HOME/build-tools" -mindepth 2 -maxdepth 2 -name apksi
build_tools=$(dirname "$apksigner")
mkdir -p "$(dirname "$output_apk")"
+work_dir=$(mktemp -d)
+trap 'rm -rf "$work_dir"' EXIT
+gradle_args=()
+
+if "$local_core"; then
+ core_checkout=$(git -C "$(dirname "$0")" rev-parse --show-toplevel)
+ qtart_repo=${QTART_CHECKOUT:-"$android_checkout/../quickjs-tart"}
+ qtart_rev=$(git -C "$qtart_repo" rev-parse "${QTART_REV:-HEAD}^{commit}")
+ abi=${ANDROID_ABI:-x86_64}
+ : "${ANDROID_NDK_HOME:?Set ANDROID_NDK_HOME to the installed Android NDK}"
+ qtart="$work_dir/qtart"
+ mkdir "$qtart"
+ git -C "$qtart_repo" archive "$qtart_rev" | tar -x -C "$qtart"
+ pinned=$(sed -n 's/^def qtart_version = "\([^"]*\)"/\1/p' "$android_checkout/wallet/build.gradle")
+ grep -Fxq "VERSION_NAME=$pinned" "$qtart/QuickJS-android/gradle.properties" || {
+ echo "Choose a QTART_REV matching the Android checkout's qtart $pinned" >&2
+ exit 1
+ }
+ make -C "$core_checkout" embedded
+ bundle="$core_checkout/packages/taler-wallet-embedded/dist/taler-wallet-core-qjs.mjs"
+ cp "$bundle" "$qtart/"
+ WALLET_CORE_VERSION=$(git -C "$core_checkout" describe --always --dirty)
+ export WALLET_CORE_VERSION
+ (cd "$qtart" && ./cross/build-android.sh "$abi")
+ cp "$qtart/build-android/$abi/libtalerwalletcore.so" "$qtart/QuickJS-android/qtart/src/main/jniLibs/$abi/"
+ (cd "$qtart/QuickJS-android" && ./gradlew :qtart:assembleRelease)
+ export TALER_LOCAL_AAR_DIR="$work_dir"
+ aar="$qtart/QuickJS-android/qtart/build/outputs/aar/qtart-release.aar"
+ TALER_LOCAL_QTART_VERSION="local-$(sha256sum "$aar" | cut -c1-16)"
+ export TALER_LOCAL_QTART_VERSION
+ cp "$aar" "$work_dir/qtart-$TALER_LOCAL_QTART_VERSION.aar"
+ cat > "$work_dir/qtart.gradle" <<'GRADLE'
+allprojects {
+ def localQtart = repositories.flatDir { dirs System.getenv('TALER_LOCAL_AAR_DIR') }
+ repositories.exclusiveContent {
+ forRepositories(localQtart)
+ filter { includeModule 'net.taler', 'qtart' }
+ }
+ configurations.configureEach {
+ resolutionStrategy.force("net.taler:qtart:" + System.getenv('TALER_LOCAL_QTART_VERSION'))
+ }
+}
+GRADLE
+ gradle_args+=(--init-script "$work_dir/qtart.gradle")
+ echo "wallet-core $WALLET_CORE_VERSION, qtart $qtart_rev, Android $(git -C "$android_checkout" rev-parse HEAD), ABI $abi"
+ sha256sum "$bundle"
+fi
+
# The release variant exercises R8 and has the nightly distribution's app ID.
-(cd "$android_checkout" && ./gradlew :wallet:assembleNightlyRelease)
+(cd "$android_checkout" && ./gradlew "${gradle_args[@]}" :wallet:assembleNightlyRelease)
unsigned_apk="$android_checkout/wallet/build/outputs/apk/nightly/release/wallet-nightly-release-unsigned.apk"
# Use a test-only key, independent of the nightly publishing credentials.
-signing_dir=$(mktemp -d)
-trap 'rm -rf "$signing_dir"' EXIT
+signing_dir=$work_dir
keytool -genkeypair -keystore "$signing_dir/test.keystore" -storepass android \
-keypass android -alias android-ui-test -keyalg RSA -keysize 2048 \
-validity 2 -dname "CN=Taler Android UI tests" -noprompt
@@ -41,4 +93,8 @@ keytool -genkeypair -keystore "$signing_dir/test.keystore" -storepass android \
"$build_tools/apksigner" sign --ks "$signing_dir/test.keystore" \
--ks-pass pass:android --key-pass pass:android --out "$output_apk" "$signing_dir/aligned.apk"
"$build_tools/apksigner" verify "$output_apk"
+if "$local_core"; then
+ unzip -p "$aar" "jni/$abi/libtalerwalletcore.so" > "$work_dir/expected.so"
+ unzip -p "$output_apk" "lib/$abi/libtalerwalletcore.so" | cmp "$work_dir/expected.so" -
+fi
sha256sum "$output_apk"