mirror of
https://github.com/block/goose.git
synced 2026-07-09 16:09:22 +00:00
38 lines
1.5 KiB
Makefile
38 lines
1.5 KiB
Makefile
set shell := ["bash", "-cu"]
|
|
set working-directory := '../..'
|
|
|
|
lib_ext := if os() == "macos" { "dylib" } else if os() == "windows" { "dll" } else { "so" }
|
|
lib_dir := "./target/debug"
|
|
lib_path := lib_dir / "libgoose_sdk." + lib_ext
|
|
bindgen := "./target/debug/goose-uniffi-bindgen"
|
|
config := "./crates/goose-sdk/uniffi.toml"
|
|
gen_dir := "./crates/goose-sdk/generated"
|
|
examples_dir := "./crates/goose-sdk/examples/uniffi"
|
|
|
|
default:
|
|
@just --list --justfile {{justfile()}}
|
|
|
|
_build:
|
|
cargo build -p goose-sdk --features uniffi -q
|
|
|
|
_generate lang: _build
|
|
{{bindgen}} generate --library {{lib_path}} --config {{config}} --language {{lang}} --no-format --out-dir {{gen_dir}} 2>/dev/null
|
|
cp {{lib_path}} {{gen_dir}}/
|
|
touch {{gen_dir}}/__init__.py
|
|
|
|
python: (_generate "python")
|
|
DYLD_LIBRARY_PATH={{lib_dir}} LD_LIBRARY_PATH={{lib_dir}} \
|
|
uv run --script {{examples_dir}}/provider.py
|
|
|
|
kotlin: (_generate "kotlin")
|
|
@if [ ! -f {{examples_dir}}/jna.jar ]; then \
|
|
curl -sSL -o {{examples_dir}}/jna.jar \
|
|
https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar; \
|
|
fi
|
|
kotlinc -cp {{examples_dir}}/jna.jar -nowarn \
|
|
{{gen_dir}}/io/aaif/goose/goose.kt \
|
|
{{examples_dir}}/Provider.kt \
|
|
-include-runtime -d {{examples_dir}}/provider.jar 2>/dev/null
|
|
java -Djna.library.path={{lib_dir}} \
|
|
--enable-native-access=ALL-UNNAMED \
|
|
-cp {{examples_dir}}/provider.jar:{{examples_dir}}/jna.jar aaif.example.ProviderKt
|