Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
bootstrap: make cmake executable configurable with config.toml #85728
bootstrap: make cmake executable configurable with config.toml #85728
Changes from all commits
680f4b6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Most of this logic probably belongs in config.rs, not here. We should always have build.config.cmake as the source of truth for the cmake path, and support setting it only via config.toml. (If it is set in the environment and not equal to the config.toml value, it should be a panic! at config parse time).
Here, we should just have the
if need_cmake { cmd_finder.must_have(&build.config.cmake); }
, with that defaulting to just "cmake" if nothing is set in the config.toml.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.
I have a couple of comments, let me start with minor ones (since major ones are going to take more time to write)
Last time, you wrote
bootstrap: make cmake executable configurable with config.toml #85728 (comment)
Warn or panic? Let me know of your decision.
Are you suggesting to set
CMAKE
env var unconditionally based on what's inconfig.toml
(or its default value defined inconfig.rs
>define_config!
)? Is that your opinion? You don't mind breaking a hypothetical existing build env which relies on a customCMAKE
env var (which is passed through tocmake
crate as of today)? Let's say someone hasCMAKE=mycmake
as of today, expecting it to be passed through tocmake
crate, and your suggestion is that they should setcmake = "mycmake"
instead, and if they don't, their build should fail with a panic saying sth like "cmake from config.toml wants to usecmake
but you have a contradictory env var CMAKE=mycmake`"?Caveat: from what I see,
cmake
crate accepts a very wide variety of env vars,https://docs.rs/cmake/0.1.48/src/cmake/lib.rs.html#857-861
like
CMAKE_x86_64-unknown-linux-gnu
, and I don't think it's realistic forbootstrap
to cover all of them.I'll find time to add more
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.
@Mark-Simulacrum
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.
I think panic! is probably best.
Looking into our use of cmake a little more, it looks like we only ever actually invoke it through the cmake crate, so if users are supplying configuration to us via env variables, the cmake crate would already be picking that up appropriately. In sanity checking, we do use "cmake" without doing the same env-variable lookup that the cmake crate does. (Target-specific cmake binaries do not feel particularly likely to be actually necessary, as it's really a host tool).
I'm not too worried about env-variables overriding bootstrap's configuration in the cmake crate - that seems unlikely to be an issue in practice, given how bootstrap itself isn't using cmake directly (except for sanity checks). Given that CMAKE isn't a "standard" env variable (or at least I've seen no evidence of that), I'm not really worried about supporting setting it as an alternative to editing config.toml, either.
So I think the value of config.cmake probably comes down to:
After we load that, we want to put it in our own environment (set_var("CMAKE")) so that the cmake crate picks it up, at least as things stand today. Just before doing that I think it makes sense to check that it's not set to a different value (mostly just as a sanity check, but it doesn't make sense for this to be in sanity.rs).
Pretty much all of that logic should go into config.rs.