Skip to content

Latest commit

 

History

History
70 lines (46 loc) · 2.16 KB

File metadata and controls

70 lines (46 loc) · 2.16 KB

Development Guide

This guide covers how to build and test the Flutter proto plugin.

Prerequisites

  • Rust: Ensure you have a recent version of Rust installed.
  • WASM Target: Install the wasm32-wasip1 target:
    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.

Building

Development Build

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-wasm

The artifact will be at target/wasm32-wasip1/release/flutter_tool.wasm.

Release Build

To create a production-ready, optimized, and stripped WASM binary, use the provided script:

bash build-wasm.sh flutter_tool

The output WASM file will be located in target/wasm32-wasip1/flutter_tool.wasm.

Testing

The project uses proto_pdk_test_utils for integration testing.

Running Tests

cargo test

Troubleshooting Tests

If 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-shim

If 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.

Release Process

  1. Update the version in Cargo.toml.
  2. Update CHANGELOG.md.
  3. Build the WASM binary.
  4. Commit and push changes.