You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Objective
Closes#442.
For further optimization, the user might want to get full control over
the flags that are passed to `wasm-opt`.
At the same time, users also need an easy way to enable or disable
`wasm-opt`, e.g. disabling it even in release mode or enabling it in dev
mode.
# Solution
I changed the ArgBuilder to deal with OsString instead of String, since
that's what we need to pass to the Command anyway.
This simplified this change, sorry for the noise in the diff.
- The `--wasm-opt` CLI flag now also accepts multiple string values.
These are passed as args to `wasm-opt`. Alternatively, you can still use
`true` to enable the default flags or `false` to disable `wasm-opt`
entirely.
- The `wasm-opt` config option now also accepts an array of args:
```toml
[package.metadata.bevy_cli.web.release]
wasm-opt = ["-Oz", "--enable-bulk-memory"]
```
# Testing
In <https://github.com/TimJentzsch/bevy_complex_repo>, the `workspace`
folder now contains a `wasm_opt` package where the new options are used
in the `Cargo.toml`.
- You can now customize the flags passed to `wasm-opt` in both CLI and `Cargo.toml`. Simply pass a list of flags you want to use, e.g. `--wasm-opt=-Oz --wasm-opt=--enable-bulk-memory` in the CLI or `wasm-opt = ["-Oz", "--enable-bulk-memory"]` in the config.
-`bevy new`: create new projects from a template using `cargo-generate` ([#2](https://github.com/TheBevyFlock/bevy_cli/pull/2))
21
-
-[`bevy_new_minimal`](https://github.com/TheBevyFlock/bevy_new_minimal) is the default template if none is specified ([#80](https://github.com/TheBevyFlock/bevy_cli/pull/80))
22
-
- There are shortcuts for templates from [TheBevyFlock](https://github.com/TheBevyFlock). For example, `-t 2d` uses [`bevy_new_2d`](https://github.com/TheBevyFlock/bevy_new_2d) ([#82](https://github.com/TheBevyFlock/bevy_cli/pull/82))
25
+
-[`bevy_new_minimal`](https://github.com/TheBevyFlock/bevy_new_minimal) is the default template if none is specified ([#80](https://github.com/TheBevyFlock/bevy_cli/pull/80))
26
+
- There are shortcuts for templates from [TheBevyFlock](https://github.com/TheBevyFlock). For example, `-t 2d` uses [`bevy_new_2d`](https://github.com/TheBevyFlock/bevy_new_2d) ([#82](https://github.com/TheBevyFlock/bevy_cli/pull/82))
23
27
-`bevy lint`: invoke the linter if `bevy_lint` is installed ([#4](https://github.com/TheBevyFlock/bevy_cli/pull/4))
24
28
-`bevy build` and `bevy run`: build and run your program with Bevy-specific configuration ([#76](https://github.com/TheBevyFlock/bevy_cli/pull/76), [#103](https://github.com/TheBevyFlock/bevy_cli/pull/103), [#102](https://github.com/TheBevyFlock/bevy_cli/pull/102), [#120](https://github.com/TheBevyFlock/bevy_cli/pull/120))
25
-
- You can use `bevy build web` and `bevy run web` to build and run your program for the web using Wasm.
26
-
- Web binaries can be optimized with `wasm-opt` ([#206](https://github.com/TheBevyFlock/bevy_cli/pull/206), [#430](https://github.com/TheBevyFlock/bevy_cli/pull/430))
27
-
- You can pass `--bundle` to pack all files needed for the web into a single folder ([#195](https://github.com/TheBevyFlock/bevy_cli/pull/195))
29
+
- You can use `bevy build web` and `bevy run web` to build and run your program for the web using Wasm.
30
+
- Web binaries can be optimized with `wasm-opt` ([#206](https://github.com/TheBevyFlock/bevy_cli/pull/206), [#430](https://github.com/TheBevyFlock/bevy_cli/pull/430))
31
+
- You can pass `--bundle` to pack all files needed for the web into a single folder ([#195](https://github.com/TheBevyFlock/bevy_cli/pull/195))
28
32
-`bevy completions`: generate terminal auto-complete scripts for a variety of shells ([#265](https://github.com/TheBevyFlock/bevy_cli/pull/265))
29
33
- The CLI can be configured with `[package.metadata.bevy_cli]` ([#331](https://github.com/TheBevyFlock/bevy_cli/pull/331), [#355](https://github.com/TheBevyFlock/bevy_cli/pull/355), [#351](https://github.com/TheBevyFlock/bevy_cli/pull/351))
@@ -27,6 +28,6 @@ The following fields exist and can be configured:
27
28
28
29
## `wasm-opt`
29
30
30
-
- Type: boolean
31
-
- Default: true for release web builds
32
-
- Note: Whether or not to use [`wasm-opt`](https://github.com/WebAssembly/binaryen?tab=readme-ov-file#wasm-opt) to optimize the web binary.
31
+
- Type: boolean or array of strings
32
+
- Default: true for web release builds, false for web dev builds and native builds
33
+
- Note: Whether or not to use [`wasm-opt`](https://github.com/WebAssembly/binaryen?tab=readme-ov-file#wasm-opt) to optimize the web binary. The specific flags to be used can be passed as array of strings or `true` can be passed to use default options (`--strip-debug` and `-Os`).
0 commit comments