forked from TBD54566975/web5-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
59 lines (48 loc) · 1.73 KB
/
Justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
set shell := ["bash", "-uc"]
# Setup local development environment
setup:
#!/bin/bash
source bin/activate-hermit
if [ ! -d ".git/modules/web5-spec" ]; then
git submodule update --init --recursive
fi
if [[ "$(cargo --version)" != "cargo 1.76.0"* ]]; then
rustup install 1.76.0
rustup default 1.76.0
rustup target add aarch64-apple-darwin
fi
if ! command -v wasm-pack >/dev/null || [[ "$(wasm-pack --version)" != "wasm-pack 0.13.0" ]]; then
cargo install wasm-pack --version 0.13.0
fi
docs: setup
cargo doc --open --no-deps
build: setup
cargo build --workspace
test: setup
cargo test --workspace
lint: setup
cargo clippy --workspace --exclude web5_c
cargo clippy --package web5_c -- -A clippy::not_unsafe_ptr_arg_deref
cargo fmt
bind: setup
just bind-kotlin
bindc: setup
cargo build --release --package web5_c
bind-kotlin: setup
mkdir -p bound/kt/src/main/resources
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
cargo run --package web5_uniffi \
--bin uniffi-bindgen \
generate --library bound/kt/src/main/resources/libweb5_uniffi_aarch64_apple_darwin.dylib \
--language kotlin \
--out-dir target/bindgen-kotlin
sed -i '' 's/findLibraryName(componentName)/detectSystemTarget()/' target/bindgen-kotlin/web5/sdk/rust/web5.kt
cp target/bindgen-kotlin/web5/sdk/rust/web5.kt bound/kt/src/main/kotlin/web5/sdk/rust/UniFFI.kt
test-bound: setup
just test-kotlin
test-kotlin: setup
cd bound/kt && mvn clean test
wasm: setup
(cd bindings/web5_wasm; wasm-pack build --target nodejs --out-dir ../../bound/typescript/pkg)