forked from TBD54566975/tbdex-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
63 lines (52 loc) · 1.77 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
60
61
62
63
set shell := ["bash", "-uc"]
default: setup
# Setup local development environment
setup:
#!/bin/bash
if [ ! -d ".git/modules/tbdex" ]; then
git submodule update --init
fi
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
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
# Build a release variant
build: setup
cargo build --release
# Run all tests
test: setup
cargo test --workspace
# Run linting, look for warnings and/or diffs in the output to correct
lint: setup
cargo clippy --workspace
cargo fmt
bind: setup
just bind-kotlin
bind-kotlin: setup
cargo build --release --package tbdex_uniffi --target aarch64-apple-darwin
mkdir -p bound/kt/src/main/resources
cp target/aarch64-apple-darwin/release/libtbdex_uniffi.dylib \
bound/kt/src/main/resources/libtbdex_uniffi_aarch64_apple_darwin.dylib
cargo run --release --package tbdex_uniffi \
--bin uniffi-bindgen \
generate --library bound/kt/src/main/resources/libtbdex_uniffi_aarch64_apple_darwin.dylib \
--language kotlin \
--out-dir target/bindgen-kotlin
sed -i '' 's/findLibraryName(componentName)/detectSystemTarget()/' target/bindgen-kotlin/tbdex/sdk/rust/tbdex.kt
cp target/bindgen-kotlin/tbdex/sdk/rust/tbdex.kt bound/kt/src/main/kotlin/tbdex/sdk/rust/UniFFI.kt
test-bound: setup
just test-kotlin
test-kotlin: setup
cd bound/kt && mvn clean verify
wasm: setup
(cd bindings/tbdex_wasm; wasm-pack build --target nodejs --out-dir ../../bound/typescript/pkg)
test-typescript: setup
#!/bin/bash
cd bound/typescript
npm install
npm run clean
npm run build
npm run test