@@ -34,6 +34,10 @@ set -e # Exit immediately if a command exits with a non-zero status.
3434
3535echo " Starting Android build process..."
3636
37+ # Install gobley-uniffi-bindgen from fork with patched version
38+ echo " Installing gobley-uniffi-bindgen fork..."
39+ cargo install --git https://github.com/ovitrif/gobley.git --branch fix-v0.2.0 gobley-uniffi-bindgen --force
40+
3741# TODO: Remove this section when example/main.rs builds successfully
3842# Store example/main.rs content in memory and remove the file
3943if [ -f " example/main.rs" ]; then
126130TMP_DIR=$( mktemp -d)
127131
128132# Generate the bindings to temp directory first
129- cargo run --bin uniffi-bindgen generate \
130- --library " $LIBRARY_PATH " \
131- --language kotlin \
132- --config uniffi.toml \
133+ gobley-uniffi-bindgen --library " $LIBRARY_PATH " \
134+ --config uniffi-android.toml \
133135 --out-dir " $TMP_DIR "
134136
135- # Move the Kotlin file from the nested directory to the final location
136- echo " Moving Kotlin file to final location..."
137- find " $TMP_DIR " -name " bitkitcore.kt" -exec mv {} " $BASE_DIR /" \;
137+ # Move the Kotlin files from the nested directory to the final location
138+ echo " Moving Kotlin files to final location..."
139+ mv " $TMP_DIR " /main/kotlin/com/synonym/ bitkitcore/ * .kt " $BASE_DIR /"
138140
139141# Clean up temp directory and any remaining uniffi directories
140142echo " Cleaning up temporary files..."
141143rm -rf " $TMP_DIR "
142144rm -rf " $ANDROID_LIB_DIR /uniffi"
143145
144- # Verify the file was moved correctly
145- if [ ! -f " $BASE_DIR /bitkitcore.kt" ]; then
146+ # Verify the files were moved correctly
147+ if [ ! -f " $BASE_DIR /bitkitcore.android.kt " ] || [ ! -f " $BASE_DIR /bitkitcore.common. kt" ]; then
146148 echo " Error: Kotlin bindings were not moved correctly"
147149 echo " Contents of $BASE_DIR :"
148150 ls -la " $BASE_DIR "
149151 exit 1
150152fi
151153
154+ echo " Generated Kotlin bindings:"
155+ ls -la " $BASE_DIR "
156+
152157# Sync version
153158echo " Syncing version from Cargo.toml..."
154159CARGO_VERSION=$( grep ' ^version = ' Cargo.toml | sed ' s/version = "\(.*\)"/\1/' | head -1)
@@ -159,4 +164,4 @@ rm -f "$ANDROID_LIB_DIR/gradle.properties.bak"
159164echo " Testing android library publish to Maven Local..."
160165" $ANDROID_LIB_DIR " /gradlew --project-dir " $ANDROID_LIB_DIR " clean publishToMavenLocal
161166
162- echo " Android build process completed successfully!"
167+ echo " Android build process completed successfully!"
0 commit comments