Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update Rust core build script to output all required Kotlin files (#1404)

Leendert de Borst88c56cb6bec8
diff --git a/apps/mobile-app/android/.gitignore b/apps/mobile-app/android/.gitignore
index f5701ea7c..7cfec0ef4 100644
--- a/apps/mobile-app/android/.gitignore
+++ b/apps/mobile-app/android/.gitignore
@@ -17,4 +17,5 @@ local.properties
# Android Kotlin bindings (built by: cd core/rust && ./build.sh --android)
app/src/main/java/net/aliasvault/app/rustcore/uniffi/
+app/src/main/java/uniffi
app/src/main/jniLibs/
\ No newline at end of file
diff --git a/core/rust/build.sh b/core/rust/build.sh
index f31d189d3..e277b3d65 100755
--- a/core/rust/build.sh
+++ b/core/rust/build.sh
@@ -599,10 +599,19 @@ build_android() {
fi
# Generate Kotlin bindings using UniFFI
- # Note: Use uniffi-cli feature here since we need the bindgen CLI tool
+ # Note: We need to build a native macOS library first because UniFFI bindgen
+ # cannot extract metadata from cross-compiled libraries
echo -e " Generating Kotlin bindings..."
- cargo run $cargo_flags --features uniffi-cli --bin uniffi-bindgen -- generate \
- --library "target/aarch64-linux-android/$cargo_profile/libaliasvault_core.so" \
+
+ # Build native library for bindgen (if not already built)
+ if [ ! -f "target/debug/libaliasvault_core.dylib" ]; then
+ echo -e " Building native library for bindgen..."
+ cargo build --features uniffi --lib
+ fi
+
+ # Generate bindings from native library
+ cargo run --features uniffi-cli --bin uniffi-bindgen -- generate \
+ --library "target/debug/libaliasvault_core.dylib" \
--language kotlin \
--out-dir "$ANDROID_DIR/kotlin"