Skip to content

Commit

Permalink
Extract case statements to separate scripts and update Justfile to ca…
Browse files Browse the repository at this point in the history
…ll these scripts
  • Loading branch information
andresuribe87 committed Aug 7, 2024
1 parent 70734fe commit 3e5c926
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
22 changes: 2 additions & 20 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +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
case $(uname -sm) in
"Darwin arm64")
rustup target add aarch64-apple-darwin ;;
"Darwin x86_64")
rustup target add x86_64-apple-darwin ;;
"Linux aarch64")
rustup target add aarch64-unknown-linux-gnu ;;
"Linux x86_64")
rustup target add x86_64-unknown-linux-gnu ;;
esac
./scripts/setup_case.sh
fi

build: setup
Expand All @@ -33,16 +24,7 @@ bind: setup
just bind-kotlin

bind-kotlin: setup
case $(uname -sm) in
"Darwin arm64")
TARGET_ARCH="aarch64-apple-darwin" ;;
"Darwin x86_64")
TARGET_ARCH="x86_64-apple-darwin" ;;
"Linux aarch64")
TARGET_ARCH="aarch64-unknown-linux-gnu" ;;
"Linux x86_64")
TARGET_ARCH="x86_64-unknown-linux-gnu" ;;
esac
./scripts/bind_kotlin_case.sh
cargo build --release --package web5_uniffi --target $TARGET_ARCH
cp target/$TARGET_ARCH/release/libweb5_uniffi.* \
bound/kt/src/main/resources/
Expand Down
12 changes: 12 additions & 0 deletions scripts/bind_kotlin_case.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
case $(uname -sm) in
"Darwin arm64")
TARGET_ARCH="aarch64-apple-darwin" ;;
"Darwin x86_64")
TARGET_ARCH="x86_64-apple-darwin" ;;
"Linux aarch64")
TARGET_ARCH="aarch64-unknown-linux-gnu" ;;
"Linux x86_64")
TARGET_ARCH="x86_64-unknown-linux-gnu" ;;
esac
export TARGET_ARCH
11 changes: 11 additions & 0 deletions scripts/setup_case.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
case $(uname -sm) in
"Darwin arm64")
rustup target add aarch64-apple-darwin ;;
"Darwin x86_64")
rustup target add x86_64-apple-darwin ;;
"Linux aarch64")
rustup target add aarch64-unknown-linux-gnu ;;
"Linux x86_64")
rustup target add x86_64-unknown-linux-gnu ;;
esac

0 comments on commit 3e5c926

Please sign in to comment.