This guide covers how to build and test the Flutter proto plugin.
- Rust: Ensure you have a recent version of Rust installed.
- WASM Target: Install the
wasm32-wasip1target:rustup target add wasm32-wasip1
- Binaryen: Required for
wasm-opt. Download from Binaryen releases. - WABT: Required for
wasm-strip. Download from WABT releases.
Important Note on Paths: The build-wasm.sh script relies on wasm-opt and wasm-strip being available at hardcoded paths:
~/Dev/web-assembly-binaryen/bin/wasm-opt~/Dev/web-assembly-wabt/bin/wasm-strip
If your tools are installed elsewhere (or in your system PATH), you must edit build-wasm.sh to match your environment before running it.
For local development and testing, you can use moon to build the WASM binary without optimizations. This does not require Binaryen or WABT.
moon run :build-wasmThe artifact will be at target/wasm32-wasip1/release/flutter_tool.wasm.
To create a production-ready, optimized, and stripped WASM binary, use the provided script:
bash build-wasm.sh flutter_toolThe output WASM file will be located in target/wasm32-wasip1/flutter_tool.wasm.
The project uses proto_pdk_test_utils for integration testing.
cargo testIf you encounter failures in tests like installs_tool, it might be due to a missing mock shim. The test harness often expects ~/.proto/bin/proto-shim to exist. You can create a dummy file to satisfy this requirement:
mkdir -p ~/.proto/bin
touch ~/.proto/bin/proto-shim
chmod +x ~/.proto/bin/proto-shimIf you encounter test timeouts (e.g., in download_test.rs or other network-dependent tests), be aware that these are known to occur in restricted CI/development environments without internet access.
- Update the version in
Cargo.toml. - Update
CHANGELOG.md. - Build the WASM binary.
- Commit and push changes.