|
| 1 | +VERSION 0.7 |
| 2 | + |
| 3 | +#cspell: words fmtchk rustfmt toolsets wasi wasmtime Earthfile |
| 4 | + |
| 5 | +# Fork the repo `wasmtime` and extract only the `wasi-preview1-component-adapter` crate from it. |
| 6 | +fork-wasi-component-adapter: |
| 7 | + LOCALLY |
| 8 | + |
| 9 | + # The local directory to store `wasi/wit`. |
| 10 | + # This needs to include along with `wasi-preview1-component-adapter`. |
| 11 | + ARG wit_local_dir=crates/wasi |
| 12 | + # The local directory to place the extracted `wasi` crate. |
| 13 | + ARG wasi_local_dir=crates/wasi-component-adapter |
| 14 | + # The location after the `wasmtime` repo was cloned. |
| 15 | + ARG wasi_git_dir=wasmtime/crates/wasi-preview1-component-adapter |
| 16 | + |
| 17 | + # Remove the existing local one. Clone and extract it from the repo. |
| 18 | + RUN rm -rf $wasi_local_dir/ || true && \ |
| 19 | + rm -rf $wit_local_dir/ || true && \ |
| 20 | + git clone --depth 1 https://github.com/bytecodealliance/wasmtime.git && \ |
| 21 | + mv $wasi_git_dir $wasi_local_dir && \ |
| 22 | + mkdir $wit_local_dir && \ |
| 23 | + mv wasmtime/crates/wasi/wit $wit_local_dir/wit && \ |
| 24 | + rm -rf wasmtime/ |
| 25 | + |
| 26 | +# Set up our target toolchains, and copy our files. |
| 27 | +builder: |
| 28 | + FROM github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.3+rust-base |
| 29 | + |
| 30 | + DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.3+SETUP --toolchain=rust-toolchain.toml |
| 31 | + |
| 32 | + COPY --dir .cargo Cargo.* clippy.toml deny.toml rustfmt.toml crates . |
| 33 | + |
| 34 | +# Run quality checks. |
| 35 | +check: |
| 36 | + FROM +builder |
| 37 | + |
| 38 | + RUN cargo machete && \ |
| 39 | + # cargo +nightly fmtchk && \ |
| 40 | + cargo deny check |
| 41 | + |
| 42 | + # DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.3+CHECK |
| 43 | + |
| 44 | +build: |
| 45 | + FROM +builder |
| 46 | + |
| 47 | + RUN cargo build --release |
| 48 | + |
| 49 | + SAVE ARTIFACT target/wasm32-unknown-unknown/release/wasi_snapshot_preview1.wasm wasi-component-adapter.wasm |
0 commit comments