-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathjustfile
More file actions
99 lines (85 loc) · 3.22 KB
/
justfile
File metadata and controls
99 lines (85 loc) · 3.22 KB
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
96
97
98
99
# TIP: run the command `just -l` to get an overview
# Run an example host app
[group("examples")]
[arg("app", pattern="^(basic|components|custom_codec)$")]
run-example app:
cargo run -p {{app}}_example_app --features bevy/file_watcher
# Build an example guest rust mod to wasm and place it in the shared assets directory
[group("examples")]
[arg("mod", pattern="^(basic|components)$")]
build-example-rust mod:
cargo build --release --target wasm32-wasip2 -p {{mod}}_example_mod
mkdir -p ./examples/assets/mods
mv ./target/wasm32-wasip2/release/{{mod}}_example_mod.wasm ./examples/assets/mods/{{mod}}_example_mod.wasm
# Build the Python example mod.
[group("examples")]
[working-directory("examples/mods/python/src")]
build-example-python:
poetry run componentize-py --wit-path ../wit/ --world example componentize app -o ../../../assets/mods/python.wasm
# Generate bindings for the Python example mod.
[group("examples")]
[working-directory("examples/python_example")]
generate-bindings-python:
rm -rf ./src/componentize_py_async_support
rm -rf ./src/wit_world
rm -f ./src/componentize_py_runtime.pyi
rm -f ./src/componentize_py_types.py
rm -f ./src/poll_loop.py
poetry run componentize-py --wit-path wit/ --world example bindings src
# Build the Go example mod.
[group("examples")]
[working-directory("examples/mods/go/src")]
[env("GOARCH", "wasm")]
[env("GOOS", "wasip1")]
build-example-go:
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
# Generate bindings for the Go example mod.
[group("examples")]
[working-directory("examples/mods/go/src")]
generate-bindings-go:
wit-bindgen go -w example ../wit/
# Enable repository git hooks.
[group("setup")]
enable-git-hooks:
git config core.hooksPath .githooks
chmod +x .githooks/pre-push
# Build the ECS WIT package.
[group("chores")]
build-wasvy-ecs:
wkg wit build --wit-dir ./wit/
# Publish the ECS package to wa.dev.
[group("chores")]
publish-wasvy-ecs file_path version:
wkg publish --package wasvy:ecs@{{version}} {{file_path}} --registry wa.dev
# Replace the existing (1.92.0) rust toolchain version with a new one.
[group("chores")]
[arg("new", pattern="^\\d+\\.\\d+\\.\\d+$")]
bump-toolchain new:
rg -l 'rust' . | xargs sed -i "/rust/s/1.92.0/{{new}}/g"
# Replace the existing (0.18.0) bevy version with a new one.
[group("chores")]
[arg("new", pattern="^\\d+\\.\\d+\\.\\d+$")]
bump-bevy new:
rg -l -g '!Cargo.lock' 'bevy' . | xargs sed -i "/bevy/s/0.18.0/{{new}}/g"
cargo check
# Replace the existing (0.0.8) wasvy version with a new one.
[group("chores")]
[arg("new", pattern="^\\d+\\.\\d+\\.\\d+$")]
bump-version new:
rg -l -g '!Cargo.lock' 'version' . | xargs sed -i "/version/s/0.0.8/{{new}}/g"
cargo check
# Publishes all crates
[group("chores")]
[confirm]
publish:
# CI
cargo test --workspace --all-features
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo fmt --all -- --check
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace --all-features
# Publish
cargo publish -p wasvy_macros
sleep 5 # Give crate.io a few seconds to update
cargo publish -p wasvy