From 0e16dfd09b7a9e26021a26cb1f7ecb46c0ea6589 Mon Sep 17 00:00:00 2001 From: Leendert de Borst Date: Sat, 10 Jan 2026 16:01:24 +0100 Subject: [PATCH] Update build scripts (#1404) --- .github/actions/build-android-app/action.yml | 17 ++++++++++++++ core/build-and-distribute.sh | 1 - core/rust/build.sh | 24 +++++++++++--------- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/actions/build-android-app/action.yml b/.github/actions/build-android-app/action.yml index 35aeee291..0b3306639 100644 --- a/.github/actions/build-android-app/action.yml +++ b/.github/actions/build-android-app/action.yml @@ -67,6 +67,23 @@ runs: ls -lh "$JNILIBS_DIR/$abi/libaliasvault_core.so" | awk '{print " " $NF ": " $5}' done + # Verify Kotlin bindings (UniFFI-generated) + KOTLIN_BINDINGS_DIR="apps/mobile-app/android/app/src/main/java/net/aliasvault/app/rustcore/uniffi/aliasvault_core" + if [ ! -d "$KOTLIN_BINDINGS_DIR" ]; then + echo "❌ Missing Kotlin bindings directory: $KOTLIN_BINDINGS_DIR" + echo "Run: cd core/rust && ./build.sh --android" + exit 1 + fi + + if [ ! -f "$KOTLIN_BINDINGS_DIR/aliasvault_core.kt" ]; then + echo "❌ Missing Kotlin bindings file: $KOTLIN_BINDINGS_DIR/aliasvault_core.kt" + echo "Run: cd core/rust && ./build.sh --android" + exit 1 + fi + + echo "✅ Kotlin bindings verified:" + ls -lh "$KOTLIN_BINDINGS_DIR"/*.kt | awk '{print " " $NF ": " $5}' + - name: Install dependencies run: npm ci shell: bash diff --git a/core/build-and-distribute.sh b/core/build-and-distribute.sh index adb5a8509..9f1e5660f 100755 --- a/core/build-and-distribute.sh +++ b/core/build-and-distribute.sh @@ -34,7 +34,6 @@ if command -v rustc &> /dev/null; then echo "📦 Building rust core (Rust toolchain detected)..." ./build.sh --android ./build.sh --browser - ./build.sh --mobile # Do not build for iOS here as it will be built via Xcode build phases instead # Adding it here would make the GitHub Actions fail because of Linux runners else diff --git a/core/rust/build.sh b/core/rust/build.sh index 040aa7f20..f4231e9d0 100755 --- a/core/rust/build.sh +++ b/core/rust/build.sh @@ -79,11 +79,6 @@ while [[ $# -gt 0 ]]; do BUILD_ANDROID=true shift ;; - --mobile) - BUILD_IOS=true - BUILD_ANDROID=true - shift - ;; --all) BUILD_BROWSER=true BUILD_DOTNET=true @@ -112,8 +107,7 @@ while [[ $# -gt 0 ]]; do echo " --dotnet Build native library for .NET server-side use (macOS/Linux/Windows)" echo " --ios Build for iOS (device + simulator arm64) with Swift bindings" echo " --android Build for Android (arm64-v8a, armeabi-v7a, x86_64) with Kotlin bindings" - echo " --mobile Build for both iOS and Android" - echo " --all Build all targets" += echo " --all Build all targets" echo "" echo "Speed options:" echo " --fast, --dev Faster builds (for development)" @@ -141,7 +135,6 @@ if ! $BUILD_BROWSER && ! $BUILD_DOTNET && ! $BUILD_IOS && ! $BUILD_ANDROID; then echo " ./build.sh --dotnet # Build for .NET" echo " ./build.sh --ios # Build for iOS" echo " ./build.sh --android # Build for Android" - echo " ./build.sh --mobile # Build for iOS and Android" exit 0 fi @@ -667,11 +660,20 @@ distribute_android() { done # Copy Kotlin bindings to app source + # UniFFI generates bindings in uniffi/aliasvault_core/ directory structure local kotlin_dist="$SCRIPT_DIR/../../apps/mobile-app/android/app/src/main/java/net/aliasvault/app/rustcore" - if [ -d "$ANDROID_DIR/kotlin" ] && [ -n "$(ls -A "$ANDROID_DIR/kotlin" 2>/dev/null)" ]; then + if [ -d "$ANDROID_DIR/kotlin/uniffi" ]; then mkdir -p "$kotlin_dist" - cp "$ANDROID_DIR/kotlin"/*.kt "$kotlin_dist/" 2>/dev/null || true - echo -e " Copied Kotlin bindings to $kotlin_dist" + # Copy the entire uniffi directory to preserve package structure + cp -r "$ANDROID_DIR/kotlin/uniffi" "$kotlin_dist/" + echo -e " Copied Kotlin bindings to $kotlin_dist/uniffi/" + + # List what was copied + if [ -d "$kotlin_dist/uniffi/aliasvault_core" ]; then + ls -lh "$kotlin_dist/uniffi/aliasvault_core"/*.kt 2>/dev/null || true + fi + else + echo -e "${RED}Warning: Kotlin bindings not found at $ANDROID_DIR/kotlin/uniffi${NC}" fi echo -e "${GREEN}Distributed to: $ANDROID_APP_DIST${NC}"