-
Notifications
You must be signed in to change notification settings - Fork 24
/
justfile
96 lines (75 loc) · 4.42 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# list available recipes
default:
just --list
# build the bindings lib: liblwk.so (as specified in lwk_bindings/Cargo.toml)
build-bindings-lib:
# a debug build would be fine if used only to generate interfaces files but some jobs use it to package it, thus release is necessary.
cargo build --release -p lwk_bindings
# build the python interface "lwk.py"
python-build-bindings: build-bindings-lib
# note production wheels are built with maturin, but this can be useful during development
# we use release to generate interfaces only because build-bindings-lib is done in release, so we find intermediate packages
cargo run --release --features bindings -- generate --library target/release/liblwk.so --language python --out-dir target/release/bindings
cp target/release/liblwk.so target/release/bindings
# smoke test the python bindings
python-test-bindings: python-build-bindings
PYTHONPATH=target/release/bindings/ python3 -c 'import lwk'
# build the python bindings and start a python env with them
python-env-bindings: python-build-bindings
PYTHONPATH=target/release/bindings/ python3
# build the docker "xenoky/lwk-builder" used in the CI
docker-build:
cd context && docker build . -t xenoky/lwk-builder && cd -
# push the docker "xenoky/lwk-builder" on docker hub
docker-push: docker-build
docker push xenoky/lwk-builder # require credentials
# Build the kotlin interface `lwk.kt`
kotlin: build-bindings-lib
cargo run --release --features bindings -- generate --library target/release/liblwk.so --language kotlin --out-dir target/release/kotlin
cp -a target/release/kotlin/lwk lwk_bindings/android_bindings/lib/src/main/kotlin
# Cross build the lib for aarch64-linux-android
aarch64-linux-android:
cargo ndk -t aarch64-linux-android -o target/release/kotlin/jniLibs build -p lwk_bindings
# Cross build the lib for armv7-linux-androideabi
armv7-linux-androideabi:
cargo ndk -t armv7-linux-androideabi -o target/release/kotlin/jniLibs build -p lwk_bindings
# Cross build the lib for i686-linux-android
i686-linux-android:
cargo ndk -t i686-linux-android -o target/release/kotlin/jniLibs build -p lwk_bindings
# Cross build the lib for x86_64-linux-android
x86_64-linux-android:
cargo ndk -t x86_64-linux-android -o target/release/kotlin/jniLibs build -p lwk_bindings
# After cross building all the lib for android put them in final dir
android: aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
cp -a target/release/kotlin/jniLibs lwk_bindings/android_bindings/lib/src/main
# Build the kotlin interface and android libs
kotlin-android: kotlin android
# Build ios (works only on mac)
ios: aarch64-apple-ios
# Build ios simulator libs x86/arm and merge them (works only on mac)
ios-sim: x86_64-apple-ios aarch64-apple-ios-sim
mkdir -p target/lipo-ios-sim/release
lipo target/aarch64-apple-ios-sim/release/liblwk.a target/x86_64-apple-ios/release/liblwk.a -create -output target/lipo-ios-sim/release/liblwk.a
# Build x86_64-apple-ios
x86_64-apple-ios:
cargo build --release --target x86_64-apple-ios -p lwk_bindings
# Build aarch64-apple-ios
aarch64-apple-ios:
cargo build --release --target aarch64-apple-ios -p lwk_bindings
# Build aarch64-apple-ios-sim
aarch64-apple-ios-sim:
cargo build --release --target aarch64-apple-ios-sim -p lwk_bindings
# Build the swift framework (works only on mac)
swift: ios ios-sim
# we are not using build-bindings-lib because we need the mac targets anyway
cargo run --features bindings -- generate --library ./target/aarch64-apple-ios/release/liblwk.a --language swift --out-dir ./target/swift
mkdir -p ./target/swift/include
mv target/swift/lwkFFI.h target/swift/include
mv target/swift/lwkFFI.modulemap target/swift/include/module.modulemap
xcodebuild -create-xcframework -library target/lipo-ios-sim/release/liblwk.a -headers target/swift/include -library target/aarch64-apple-ios/release/liblwk.a -headers target/swift/include -output target/lwkFFI.xcframework
csharp-windows: build-bindings-lib
cargo install uniffi-bindgen-cs --git https://github.com/RCasatta/uniffi-bindgen-cs --rev fa87c381f88c8cacd26cf3e91e5c63af60162c3f
uniffi-bindgen-cs --library target/release/lwk.dll --out-dir target/release/csharp
cp target/release/lwk.dll target/release/csharp
cp lwk_bindings/tests/test_data/test-dotnet.csproj target/release/csharp
cp lwk_bindings/tests/bindings/list_transactions.cs target/release/csharp