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

bootstrap: Describe build_steps modules #124242

Merged
merged 9 commits into from
Apr 28, 2024

Conversation

workingjubilee
Copy link
Member

One of my preferred ways to understand source code is to start with its API. This implies the code is documented reasonably accurately, even if it is a private API. The description of one of these modules had not been updated since 2015 and so was both terse and confusing, so I rewrote it. Then I noticed many others went unremarked, so I offered some remarks.

The description was most accurate when it was still called rustbuild,
and I presume indeed did mostly run in CI. It has become something more
so try to describe it better for current-day usage.
@rustbot
Copy link
Collaborator

rustbot commented Apr 21, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 21, 2024
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

<3

//!
//! These are build-and-run steps for `./x.py setup`, which allows quickly setting up the directory
//! for modifying, building, and running the compiler and library. The main convenience is to allow
//! not having to painstakingly set every single option in config.toml.
Copy link
Member

Choose a reason for hiding this comment

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

this is not actually the main convenience, profile = foo is enough for 99% of things. the reason this exists is:

  • it gives us a single command to put in documentation
  • it lets us suggest a build command based on the profile. x.py test ui makes sense if you're working on the compiler but not if you're working on the standard library. (note that this is so important because putting commands in the readme means people will just copy paste the first one without reading it, i've seen it happen so many times)
  • it reduces the number of commands to get a useful environment from ~6 to 1 (it creates .vscode, it runs rustup toolchain link, etc)
  • it makes profiles more discoverable; most people's instinct is to configure options one by one and that's a waste of their time.

Copy link
Member

Choose a reason for hiding this comment

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

oh, and originally one of the goals was to avoid the trap where someone runs x.py build before configuring a profile and now they have the LLVM submodule checked out indefinitely and their life is pain. for a while now LLVM is downloaded by default if you don't have a config.toml, though, so that doesn't really apply anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

it makes profiles more discoverable; most people's instinct is to configure options one by one and that's a waste of their time.

okay but isn't that just saying what I said with different words tho' <_<;

//!
//! This file implements the various regression test suites that we execute on
//! our CI.
//! `./x.py test` (aka [`Kind::Test`]) is currently allowed to reach build steps in other modules.
Copy link
Member

Choose a reason for hiding this comment

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

this is true of all Steps, not just test steps - i'm curious why you've singled it out here?

Copy link
Member

Choose a reason for hiding this comment

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

i wonder if it makes sense to link to src/bootstrap/README and/or https://rustc-dev-guide.rust-lang.org/building/bootstrapping/how-bootstrap-does-it.html in lib.rs and builder.rs respectively.

Copy link
Member Author

Choose a reason for hiding this comment

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

Because most of the things run when you execute ./x.py {command} are in fact in the given {command}.rs, so the fact that this one has an exception stood out to me:

Kind::Test => describe!(
crate::core::build_steps::toolstate::ToolStateCheck,
test::ExpandYamlAnchors,

src/bootstrap/src/core/build_steps/toolstate.rs Outdated Show resolved Hide resolved
@Mark-Simulacrum
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 27, 2024

📌 Commit f4e02a1 has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@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 Apr 27, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 27, 2024
…files-better, r=Mark-Simulacrum

bootstrap: Describe build_steps modules

One of my preferred ways to understand source code is to start with its API. This implies the code is documented reasonably accurately, even if it is a private API. The description of one of these modules had not been updated since 2015 and so was both terse and confusing, so I rewrote it. Then I noticed many others went unremarked, so I offered some remarks.
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 27, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#123942 (`x vendor`)
 - rust-lang#124165 (add test for incremental ICE: slice-pattern-const.rs rust-lang#83085)
 - rust-lang#124210 (Abort a process when FD ownership is violated)
 - rust-lang#124242 (bootstrap: Describe build_steps modules)
 - rust-lang#124406 (Remove unused `[patch]` for clippy_lints)
 - rust-lang#124429 (bootstrap: Document `struct Builder` and its fields)
 - rust-lang#124447 (Unconditionally call `really_init` on GNU/Linux)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#123248 (1.78 release notes)
 - rust-lang#123942 (`x vendor`)
 - rust-lang#124165 (add test for incremental ICE: slice-pattern-const.rs rust-lang#83085)
 - rust-lang#124242 (bootstrap: Describe build_steps modules)
 - rust-lang#124406 (Remove unused `[patch]` for clippy_lints)
 - rust-lang#124429 (bootstrap: Document `struct Builder` and its fields)
 - rust-lang#124447 (Unconditionally call `really_init` on GNU/Linux)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f17ce8b into rust-lang:master Apr 28, 2024
10 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 28, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 28, 2024
Rollup merge of rust-lang#124242 - workingjubilee:describe-bootstrap-files-better, r=Mark-Simulacrum

bootstrap: Describe build_steps modules

One of my preferred ways to understand source code is to start with its API. This implies the code is documented reasonably accurately, even if it is a private API. The description of one of these modules had not been updated since 2015 and so was both terse and confusing, so I rewrote it. Then I noticed many others went unremarked, so I offered some remarks.
@workingjubilee workingjubilee deleted the describe-bootstrap-files-better branch April 28, 2024 19:30
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. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants