|
| 1 | +# TIP: run the command `just -l` to get an overview |
| 2 | + |
| 3 | +# Build an example rust crate to Wasm and copy it into host assets. |
| 4 | +[group("examples")] |
| 5 | +[arg("example", pattern="^(simple|guest_wit_example)$")] |
1 | 6 | build-example example: |
2 | 7 | cargo build --release --target wasm32-wasip2 -p {{example}} |
3 | 8 | mkdir -p ./examples/host_example/assets/mods |
4 | 9 | cp ./target/wasm32-wasip2/release/{{example}}.wasm ./examples/host_example/assets/mods |
5 | 10 |
|
| 11 | +# Run the host example app. |
| 12 | +[group("examples")] |
6 | 13 | run-host-example: |
7 | 14 | cargo run -p host_example --features bevy/file_watcher |
8 | 15 |
|
9 | | -# Requires `poetry` to run |
| 16 | +# Run the host wit example app. |
| 17 | +[group("examples")] |
| 18 | +run-host-wit-example: |
| 19 | + cargo run -p host_example --features bevy/file_watcher |
| 20 | + |
| 21 | +# Build the Python example mod. |
| 22 | +[group("examples")] |
| 23 | +[working-directory("examples/python_example/src")] |
10 | 24 | build-example-python: |
11 | | - cd examples/python_example/src && poetry run componentize-py --wit-path ../wit/ --world example componentize app -o ../../host_example/assets/mods/python.wasm |
| 25 | + poetry run componentize-py --wit-path ../wit/ --world example componentize app -o ../../host_example/assets/mods/python.wasm |
12 | 26 |
|
13 | | -# Create the bindings for the python example |
| 27 | +# Generate Python bindings for example mod. |
| 28 | +[group("examples")] |
| 29 | +[working-directory("examples/python_example")] |
14 | 30 | example-bindings-python: |
15 | | - cd examples/python_example && rm -rf ./src/componentize_py_async_support && rm -rf ./src/wit_world && rm -rf ./src/componentize_py_runtime.pyi && rm -rf ./src/componentize_py_types.py && rm -rf ./src/poll_loop.py && poetry run componentize-py --wit-path wit/ --world example bindings src |
| 31 | + rm -rf ./src/componentize_py_async_support |
| 32 | + rm -rf ./src/wit_world |
| 33 | + rm -f ./src/componentize_py_runtime.pyi |
| 34 | + rm -f ./src/componentize_py_types.py |
| 35 | + rm -f ./src/poll_loop.py |
| 36 | + poetry run componentize-py --wit-path wit/ --world example bindings src |
16 | 37 |
|
| 38 | +# Build the Go example mod. |
| 39 | +[group("examples")] |
| 40 | +[working-directory("examples/go_example/src")] |
| 41 | +[env("GOARCH", "wasm")] |
| 42 | +[env("GOOS", "wasip1")] |
17 | 43 | build-example-go: |
18 | | - cd examples/go_example/src && GOARCH="wasm" GOOS="wasip1" go build -o core.wasm -buildmode=c-shared -ldflags=-checklinkname=0 && wasm-tools component embed -w example ../wit/ core.wasm -o core-with-wit.wasm && wasm-tools component new --adapt ../wasi_snapshot_preview1.reactor.wasm core-with-wit.wasm -o go.wasm |
| 44 | + go build -o core.wasm -buildmode=c-shared -ldflags=-checklinkname=0 |
| 45 | + wasm-tools component embed -w example ../wit/ core.wasm -o core-with-wit.wasm |
| 46 | + wasm-tools component new --adapt ../wasi_snapshot_preview1.reactor.wasm core-with-wit.wasm -o go.wasm |
19 | 47 |
|
| 48 | +# Generate Go bindings for example mod. |
| 49 | +[group("examples")] |
| 50 | +[working-directory("examples/go_example/src")] |
20 | 51 | example-bindings-go: |
21 | | - cd examples/go_example/src && wit-bindgen go -w example ../wit/ |
| 52 | + wit-bindgen go -w example ../wit/ |
22 | 53 |
|
23 | | -# For the fetching to take effect you must delete the deps folder manually |
| 54 | +# Fetch WIT dependencies for one example (deprecated, use cli instead). |
| 55 | +[group("examples")] |
24 | 56 | example-fetch-deps example: |
25 | 57 | cd examples/{{example}} && wkg wit fetch |
26 | 58 |
|
27 | | -build-host: |
28 | | - cargo build -p wasvy |
| 59 | +# Enable repository git hooks. |
| 60 | +[group("setup")] |
| 61 | +enable-git-hooks: |
| 62 | + git config core.hooksPath .githooks |
| 63 | + chmod +x .githooks/pre-push |
29 | 64 |
|
| 65 | +# Build the ECS WIT package. |
| 66 | +[group("chores")] |
30 | 67 | build-wasvy-ecs: |
31 | 68 | wkg wit build --wit-dir ./wit/ecs/ |
32 | 69 |
|
| 70 | +# Publish the ECS package to wa.dev. |
| 71 | +[group("chores")] |
33 | 72 | publish-wasvy-ecs file_path version: |
34 | 73 | wkg publish --package wasvy:ecs@{{version}} {{file_path}} --registry wa.dev |
| 74 | + |
| 75 | +# Replace the existing (1.92.0) rust toolchain version with a new one. |
| 76 | +[group("chores")] |
| 77 | +[arg("new", pattern="^\\d+\\.\\d+\\.\\d+$")] |
| 78 | +bump-toolchain new: |
| 79 | + rg -l 'rust' . | xargs sed -i "/rust/s/1.92.0/{{new}}/g" |
| 80 | + |
| 81 | +# Replace the existing (0.18.0) bevy version with a new one. |
| 82 | +[group("chores")] |
| 83 | +[arg("new", pattern="^\\d+\\.\\d+\\.\\d+$")] |
| 84 | +bump-bevy new: |
| 85 | + rg -l -g '!Cargo.lock' 'bevy' . | xargs sed -i "/bevy/s/0.18.0/{{new}}/g" |
| 86 | + cargo check |
| 87 | + |
| 88 | +# Replace the existing (0.0.8) wasvy version with a new one. |
| 89 | +[group("chores")] |
| 90 | +[arg("new", pattern="^\\d+\\.\\d+\\.\\d+$")] |
| 91 | +bump-version new: |
| 92 | + rg -l -g '!Cargo.lock' 'version' . | xargs sed -i "/version/s/0.0.8/{{new}}/g" |
| 93 | + cargo check |
| 94 | + |
| 95 | +# Publishes all crates |
| 96 | +[group("chores")] |
| 97 | +[confirm] |
| 98 | +publish: |
| 99 | + # CI |
| 100 | + cargo test |
| 101 | + cargo clippy -- -D warnings |
| 102 | + cargo fmt --all -- --check |
| 103 | + RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace --all-features --exclude guest_wit_example --exclude host_wit_example --exclude simple |
| 104 | + |
| 105 | + # Publish |
| 106 | + cargo publish -p wasvy_macros |
| 107 | + cargo publish -p wasvy |
0 commit comments