wash icon indicating copy to clipboard operation
wash copied to clipboard

[FEATURE] pass non wash args on to language toolchain

Open ricochet opened this issue 4 months ago • 1 comments

Following the steps for wash new and selecting the sample-wasi-http-rust template from the BA, I get a ~7mb .wasm after a wash build.

Other than modifying the config.json, I have no way to pass in --release.

cargo build --help
...
  -r, --release                 Build artifacts in release mode, with optimizations
      --profile <PROFILE-NAME>  Build artifacts with the specified profile
  -j, --jobs <N>                Number of parallel jobs, defaults to # of CPUs.
      --keep-going              Do not abort the build as soon as there is an error
      --target [<TRIPLE>]       Build for the target triple
      --target-dir <DIRECTORY>  Directory for all generated artifacts
      --artifact-dir <PATH>     Copy final artifacts to this directory (unstable)
      --build-plan              Output the build plan in JSON (unstable)
      --unit-graph              Output build graph in JSON (unstable)
      --timings[=<FMTS>]        Timing output formats (unstable) (comma separated): html, json

There will always be more build commands than we will align on in wash. We should make sure commands like build are a passthrough, extract the args we own, and then pass through the rest to the underlying toolchain.

Aside: why is a config file created in this case? I would think there should already be rust project defaults defined and otherwise these come from the rust toolchain and not wash.

 cat .wash/config.json
{
  "build": {
    "rust": {
      "target": "wasm32-wasip2",
      "cargo_flags": [],
      "release": false,
      "features": [],
      "no_default_features": false
    }
  },
  "templates": []
}

ricochet avatar Aug 29 '25 19:08 ricochet