-
Notifications
You must be signed in to change notification settings - Fork 33
Add support for cargo's --config arg
#209
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
Conversation
DaAlbrecht
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm! Tested with config options as arguments or by passing a file.
If the comment about the cargo build options is resolved this can be merged IMO 😊
|
Perhaps a test case for |
DaAlbrecht
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Objective
Closes #201.
Allows users to quickly try out different configurations without modifying
Cargo.toml.For us, it's most useful for finding the best default config for the web profiles.
Solution
Add support for
--configargument forbevy buildandbevy run, analogue to thecargocounterpart.This essentially allows you to modify the
Cargo.tomlwithout editing the file, e.g.--config "profile.web.debug=false".We already exploit
cargo's--configarg to configure our default web compilation profiles.So we have to ensure that the user-provided args overwrite our default ones.
To do this, we change the default web profiles to be prepended to the user-provided
--configargs, instead of converting them to--configarguments directly.Since
--configis resolved left-to-right, the defaults will be overwritten by the user.Testing
Try for example:
Now instead of
you should get
Debug info removed and optimizations enabled!
(Of course this can be done easier via
bevy build --release web, but like this it's easier to benchmark different compilation profiles to choose the best default)