Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generalized OS/arch support to Justfile #278

Closed
wants to merge 9 commits into from
12 changes: 7 additions & 5 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ setup:
git submodule update --init --recursive
if [[ "$(cargo 2>&1)" == *"rustup could not choose a version of cargo to run"* ]]; then
rustup default 1.78.0
rustup target add aarch64-apple-darwin
rustup target add $(./scripts/get_target_arch.sh)
fi

build: setup
Expand All @@ -24,12 +24,13 @@ bind: setup
just bind-kotlin

bind-kotlin: setup
cargo build --release --package web5_uniffi --target aarch64-apple-darwin
cp target/aarch64-apple-darwin/release/libweb5_uniffi.dylib \
bound/kt/src/main/resources/libweb5_uniffi_aarch64_apple_darwin.dylib
TARGET_ARCH=$(./scripts/get_target_arch.sh)
cargo build --release --package web5_uniffi --target $TARGET_ARCH
cp target/$TARGET_ARCH/release/libweb5_uniffi.* \
bound/kt/src/main/resources/
cargo run --package web5_uniffi \
--bin uniffi-bindgen \
generate --library bound/kt/src/main/resources/libweb5_uniffi_aarch64_apple_darwin.dylib \
generate --library bound/kt/src/main/resources/libweb5_uniffi.* \
--language kotlin \
--out-dir target/bindgen-kotlin
cp target/bindgen-kotlin/web5/sdk/rust/web5.kt bound/kt/src/main/kotlin/web5/sdk/rust/UniFFI.kt
Expand All @@ -39,3 +40,4 @@ test-bound: setup

test-kotlin: setup
cd bound/kt && mvn clean test

File renamed without changes.
2 changes: 1 addition & 1 deletion bin/just
11 changes: 11 additions & 0 deletions scripts/get_target_arch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
case $(uname -sm) in
"Darwin arm64")
echo "aarch64-apple-darwin" ;;
"Darwin x86_64")
echo "x86_64-apple-darwin" ;;
"Linux aarch64")
echo "aarch64-unknown-linux-gnu" ;;
"Linux x86_64")
echo "x86_64-unknown-linux-gnu" ;;
esac
Loading