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

Automatically setup rustup in just recipes #136

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
set shell := ["bash", "-uc"]

build:
# Setup local development environment
setup:
#!/bin/bash
if [[ "$(cargo 2>&1)" == *"rustup could not choose a version of cargo to run"* ]]; then
rustup default stable
fi

build: setup
cargo build --release

test:
test: setup

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding setup for in these lines runs just setup first?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's right

we're using rustup which is an aggregation of many underlying rust dependencies, but it has to be setup (rustup default stable downloads and installs all the latest stable versions). by adding setup as a dependency, that step is automatically handled.

cc @nitro-neal same question

cargo test

lint:
lint: setup
cargo clippy --workspace
cargo fmt

bind:
bind: setup
just bind-ts
just bind-kotlin
just bind-swift

bind-ts:
bind-ts: setup
cargo build --release --package web5-wasm
if ! command -v wasm-pack &> /dev/null; then cargo install wasm-pack; fi
wasm-pack build --target nodejs --out-dir ../../binded/ts/pkg bindings/wasm
rm binded/LICENSE
rm binded/ts/pkg/.gitignore

bind-kotlin:
bind-kotlin: setup
cargo build --release --package web5-uniffi
cargo run --package web5-uniffi \
--bin uniffi-bindgen \
Expand All @@ -33,7 +40,7 @@ bind-kotlin:
cp target/bindgen-kotlin/web5/sdk/web5.kt binded/kt/src/main/kotlin/web5/sdk
cd binded/kt && ./fix-load.sh

bind-swift:
bind-swift: setup
cargo build --release --package web5-uniffi
cargo run --package web5-uniffi \
--bin uniffi-bindgen \
Expand All @@ -50,18 +57,18 @@ bind-swift:
-headers target/xcframework-staging \
-output binded/swift/libweb5-rs.xcframework

test-binded:
test-binded: setup
just test-ts
just test-kotlin
just test-swift

test-ts:
test-ts: setup
cd binded/ts && npm i && npm test

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

test-swift:
test-swift: setup
cd binded/swift && \
swift package clean && \
swift test
Loading