-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New default compilation profiles for web commands #199
Conversation
The workspace root always gives us what we need
Not needed anymore for profile detection
07753df
to
3e5fffe
Compare
This feature should be added to the user-facing documentation in #204, once that's worked on :) |
Hmm, on Windows, the Maybe we should install the CLI of it after all, then we don't need to install it in our CI |
The error on Windows is:
Maybe the version of MSVC installed is too old? We use the If you run Windows locally, are you able to compile it yourself? You may be able to cross-reference your MSVC version with the Windows runner. |
All the requirements listed by wasm-opt should be available. |
Wait a second, this isn't even the |
This reverts commit f079ea6.
In an attempt to fix wasm-opt build issues
I restored the previous |
Huh, it works now! I looked over the diff in 8ede832, and these 3 changes stood out to me:
Since it was a compilation error, I think some change made between the versions of |
Thanks for tracking down the cause! |
Could you pin [build-dependencies]
# We don't use `cc` directly, but our dependency `wasm-opt-sys` fails to compile on Windows when
# using a newer version. This can be removed when https://github.com/rust-lang/cc-rs/issues/1324 is
# fixed.
cc = "=1.2.2" |
Sure, done! |
Lol, now |
Yup, I opened BD103/cargo-sweep#13 for this! For now, I purged the entire CI cache so we wouldn't hit this error. |
Objective
Closes #197.
The
bevy build web
andbevy run web
commands currently use the same default profiles as thecargo
commands, so eitherdev
orrelease
if the--release
flag is provided.However, the demands of web apps can be vastly different than native apps when it comes to compilation.
For example, it's a lot more effective to optimize for low binary size on the web, because it significantly reduces the loading time of the app.
This causes two problems with the current implementation:
--profile={profile_name}
argument every time you executebevy run web
... which is both a hassle and easy to forget.Solution
The web commands now use the
web
orweb-release
profiles by default. This means we can provide better defaults, while still allowing the user to fully customize the configuration (by just defining these profiles themselves inCargo.toml
).It also means the user doesn't have to pass the
--profile
flag to the web commands, in most cases.Of course, by default there won't be any definitions for the
web
andweb-release
profiles and we don't want to edit the user'sCargo.toml
directly. So if we configured--profile=web
we would get an error.We circumvent this problem with
--config
flag overrides, which essentially allow you to add additional entries to theCargo.toml
.For example,
--config profile.web.inherits="dev"
allows us to add theweb
profile. It can be further customized with default settings in a similar way.I just set up very basic default configurations for the new profiles, optimizing them will be a task for a future PR.