generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Justfile
64 lines (54 loc) · 1.82 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
64
set shell := ["bash", "-uc"]
# Setup local development environment
setup:
#!/bin/bash
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
fi
build: setup
cargo build --workspace
test: setup
cargo test --workspace
lint: setup
cargo clippy --workspace
cargo fmt
bind: setup
just bind-kotlin
# #234 temporarily commenting out swift because kotlin is the sole focus
# just bind-swift
bind-kotlin: setup
cargo build --release --package web5_uniffi
cargo run --package web5_uniffi \
--bin uniffi-bindgen \
generate --library target/release/libweb5_uniffi.dylib \
--language kotlin \
--out-dir target/bindgen-kotlin
cp target/release/libweb5_uniffi.dylib bound/kt/src/main/resources/natives
cp target/bindgen-kotlin/web5/sdk/rust/web5.kt bound/kt/src/main/kotlin/web5/sdk/rust
cd bound/kt && ./fix-load.sh
bind-swift: setup
cargo build --release --package web5_uniffi
cargo run --package web5_uniffi \
--bin uniffi-bindgen \
generate --library target/release/libweb5_uniffi.dylib \
--language swift \
--out-dir target/bindgen-swift
mkdir -p target/xcframework-staging
mv target/bindgen-swift/web5.swift bound/swift/Sources/UniFFI
mv target/bindgen-swift/web5FFI.modulemap target/xcframework-staging/module.modulemap
mv target/bindgen-swift/web5FFI.h target/xcframework-staging/
rm -rf bound/swift/libweb5-rs.xcframework
xcodebuild -create-xcframework \
-library target/release/libweb5_uniffi.dylib \
-headers target/xcframework-staging \
-output bound/swift/libweb5-rs.xcframework
test-bound: setup
just test-kotlin
just test-swift
test-kotlin: setup
cd bound/kt && mvn clean test
test-swift: setup
cd bound/swift && \
swift package clean && \
swift test