Skip to content
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

Ensure ./x.py dist adheres to build.tools #87282

Merged
merged 9 commits into from
Aug 2, 2021

Conversation

pietroalbini
Copy link
Member

@pietroalbini pietroalbini commented Jul 19, 2021

According to config.toml.example, the way to produce dist artifacts for both the compiler and a subset of tools would be to enable the extended build and manually specify the list of tools to build:

[build]
extended = true
tools = ["cargo", "rustfmt"]

This works as expected for ./x.py build and ./x.py install, but not for ./x.py dist. Before this PR ./x.py dist simply ignored the contents of build.tools, building just rustc/rustdoc if build.extended = false and all of the tools otherwise. This PR does two things:

  • Changes ./x.py dist extended to only build the tools defined in build.tools, if build.tools is not empty. The rest of the extended step was refactored to simplify the code.
  • Changes how dist jobs for tools are gated: instead of assert!(builder.config.extended) to prevent tools from being built with build.extended = false, tools are simply built by default depending on build.extended and build.tools. This also enables to explicitly dist tools even with build.extended = false.

This PR is best reviewed commit-by-commit.

Fixes #86436

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 19, 2021
@paulmenzel
Copy link

Do you know if there was a regression?

According to issue #86436 (Unable to build 1.53.0 from official tarball due to miri) this also does not work anymore with install.

@pietroalbini
Copy link
Member Author

Hmm, this PR doesn't change ./x.py install, only ./x.py dist. From a quick glance at the source code ./x.py install should adhere to build.tools = ["..."], but I don't have much time to investigate that right now :(

@Mark-Simulacrum
Copy link
Member

Overall looks good -- I think the refactor I suggested could be nice, but is also fine to leave out from this PR. I think over the last few months I've started thinking about a new design for the default/should_run system anyway, which would likely address my suggestion in a slightly better way. So unless you're feeling particularly enthusiastic about the possible cleanup, let's leave it out for the time being.

I would like the first comment about tools = [] addressed though, that should be easy.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 23, 2021
@pietroalbini
Copy link
Member Author

Pushed the refactoring as well, so you can review it. I haven't tested it behaves correctly in all the cases, so let's wait until I do so before merging (reviewing is fine though).

@rust-log-analyzer

This comment has been minimized.

@pietroalbini pietroalbini added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 23, 2021
The default is then overridden by `should_run`.
@pietroalbini
Copy link
Member Author

Ok fixed a bug I found while testing, the PR should now work as expected. r? @Mark-Simulacrum


// Avoid running steps contained in --exclude
for pathset in &should_run.paths {
if desc.is_excluded(self, pathset) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm -- this is going to end up printing a bunch of times that things are / are not excluded, which seems a little annoying (i.e., when this is invoked multiple times). Maybe we should make it a ensure-style query that gets its result cached...

Seems OK for this PR though, that printing is noisy anyway.

@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 1, 2021

📌 Commit 69f712c has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 1, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 2, 2021
Rollup of 13 pull requests

Successful merges:

 - rust-lang#86183 (Change environment variable getters to error recoverably)
 - rust-lang#86439 (Remove `Ipv4Addr::is_ietf_protocol_assignment`)
 - rust-lang#86509 (Move `os_str_bytes` to `sys::unix`)
 - rust-lang#86593 (Partially stabilize `const_slice_first_last`)
 - rust-lang#86936 (Add documentation for `Ipv6MulticastScope`)
 - rust-lang#87282 (Ensure `./x.py dist` adheres to `build.tools`)
 - rust-lang#87468 (Update rustfmt)
 - rust-lang#87504 (Update mdbook.)
 - rust-lang#87608 (Remove unused field `Session.system_library_path`)
 - rust-lang#87629 (Consistent spelling of "adapter" in the standard library)
 - rust-lang#87633 (Update compiler_builtins to fix i128 shift/mul on thumbv6m)
 - rust-lang#87644 (Recommend `swap_remove` in `Vec::remove` docs)
 - rust-lang#87653 (mark a UB doctest as no_run)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 46f01ca into rust-lang:master Aug 2, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 2, 2021
@pietroalbini pietroalbini deleted the refactor-extended branch August 12, 2021 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to build 1.53.0 from official tarball due to miri
7 participants