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: Allow building individual crates #95503

Merged
merged 3 commits into from
Jul 6, 2022

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Mar 30, 2022

This aims to be as unintrusive as possible, but did still require adding a new tail_args field to all Rustc and Std steps.

New library and compiler crates are added to the sysroot as they are built, since it's useful to have e.g. just alloc and not std.

Fixes #44293.

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 30, 2022
@jyn514
Copy link
Member Author

jyn514 commented Mar 30, 2022

@rustbot label -S-waiting-on-review +S-block

@jyn514
Copy link
Member Author

jyn514 commented Mar 30, 2022

@rustbot label: -S-waiting-on-review +S-blocked

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 30, 2022
src/bootstrap/compile.rs Outdated Show resolved Hide resolved
@jyn514 jyn514 marked this pull request as draft March 30, 2022 22:43
jyn514 added a commit to jyn514/rust that referenced this pull request Mar 30, 2022
While working on rust-lang#95503,
I realized that this will interfere with existing command lines:
Currently people run `x build library/std` expecting it to be added to the sysroot,
but after that change, it will *only* build `libstd` without making it available
for the toolchain.

It's debatable whether that's a breaking change that will be accepted; if so, this PR is absolutely
necessary to make sure there's a command for "build the standard library and add it to the sysroot".
Even if not, though, I think `x build library` is more clear about what actually happens than the
current `x build library/std`.

For consistency, also add support for `compiler` and all other command variants.  Note that `doc
compiler` was already supported, so in a sense this is just fixing an existing inconsistency.

I plan to change the dev-guide and various instructions in the README to `build library` once this is merged.
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Apr 10, 2022

☔ The latest upstream changes (presumably #95502) made this pull request unmergeable. Please resolve the merge conflicts.

@jyn514
Copy link
Member Author

jyn514 commented Apr 10, 2022

@rustbot label -S-blocked +S-waiting-on-author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Apr 10, 2022
@jyn514 jyn514 force-pushed the build-single-crate branch from ad422a4 to 6160535 Compare April 11, 2022 00:06
@jyn514 jyn514 changed the title [blocked] Allow building individual crates bootstrap: Allow building individual crates Apr 11, 2022
@jyn514 jyn514 force-pushed the build-single-crate branch from 6160535 to fa5eea9 Compare April 11, 2022 00:07
@jyn514 jyn514 marked this pull request as ready for review April 11, 2022 00:07
@jyn514
Copy link
Member Author

jyn514 commented Apr 11, 2022

@rustbot ready

@rustbot rustbot 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 Apr 11, 2022
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jyn514 jyn514 force-pushed the build-single-crate branch from b9c80d1 to 46bb494 Compare April 14, 2022 15:15
@rust-log-analyzer

This comment has been minimized.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 26, 2022
…lacrum

Respect --color when building rustbuild itself

Separated out from rust-lang#95503.
@jyn514 jyn514 force-pushed the build-single-crate branch from 45bfe46 to e4c236f Compare June 26, 2022 20:09
@jyn514
Copy link
Member Author

jyn514 commented Jun 26, 2022

Got tired of copy-pasting impls and switched the cache to using generics. I know you've mentioned in the past we should emphasize readability over being concise, but I think the new code is honestly easier to read than trying to see the differences between the old impls.

@jyn514
Copy link
Member Author

jyn514 commented Jun 27, 2022

Got tired of copy-pasting impls and switched the cache to using generics.

I'll split this into a separate commit to make it easier to review, I didn't realize how big the diff was.

@jyn514 jyn514 force-pushed the build-single-crate branch from e4c236f to d50583e Compare June 27, 2022 02:09
@jyn514 jyn514 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 1, 2022
src/bootstrap/cache.rs Outdated Show resolved Hide resolved
@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 2, 2022
jyn514 added 2 commits July 2, 2022 19:29
This makes it much simpler to add new interned types, rather than having
to add 4+ impl blocks for each type.
- Add `Interned<Vec<String>>` and use it for tail args
- Refactor `cache.rs` not to need a separate impl for each internable type
@jyn514 jyn514 force-pushed the build-single-crate branch from d50583e to d0011b0 Compare July 3, 2022 00:29
@jyn514 jyn514 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 3, 2022
@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 3, 2022

📌 Commit d0011b0 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 Jul 3, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 5, 2022
…laumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#95503 (bootstrap: Allow building individual crates)
 - rust-lang#96814 (Fix repr(align) enum handling)
 - rust-lang#98256 (Fix whitespace handling after where clause)
 - rust-lang#98880 (Proper macOS libLLVM symlink when cross compiling)
 - rust-lang#98944 (Edit `rustc_mir_dataflow::framework::lattice::FlatSet` docs)
 - rust-lang#98951 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0a7f2c3 into rust-lang:master Jul 6, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 6, 2022
krasimirgg added a commit to krasimirgg/rust that referenced this pull request Jul 7, 2022
…r=Mark-Simulacrum"

This reverts commit 0a7f2c3, reversing
changes made to 41ad4d9.
jyn514 added a commit to jyn514/rustc-dev-guide that referenced this pull request Jul 11, 2022
Since rust-lang/rust#95503, `library/std` means
"build just std and its dependencies"; to get the old behavior that built
`proc_macro` and `test`, you need `x build library`.

- Update `library/std` to `library`
- Remove the `-i` suggestions; `incremental = true` is already the default for most profiles, in
  which case `-i` does nothing. If you don't have incremental enabled, I still think suggesting `-i`
  is bad idea, because it's easy to forget once, at which point you'll end up rebuilding the whole
  compiler / standard library.
- Remove a few repetitive sections and don't discuss incremental in such detail
  Incremental works well enough that it should "just work" for most people;
  I don't think it needs multiple paragraphs of explanation so early in the guide.
- Clarify that `test library/std` *only* tests libstd in a few places
tshepang pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jul 11, 2022
Since rust-lang/rust#95503, `library/std` means
"build just std and its dependencies"; to get the old behavior that built
`proc_macro` and `test`, you need `x build library`.

- Update `library/std` to `library`
- Remove the `-i` suggestions; `incremental = true` is already the default for most profiles, in
  which case `-i` does nothing. If you don't have incremental enabled, I still think suggesting `-i`
  is bad idea, because it's easy to forget once, at which point you'll end up rebuilding the whole
  compiler / standard library.
- Remove a few repetitive sections and don't discuss incremental in such detail
  Incremental works well enough that it should "just work" for most people;
  I don't think it needs multiple paragraphs of explanation so early in the guide.
- Clarify that `test library/std` *only* tests libstd in a few places
@jyn514 jyn514 deleted the build-single-crate branch February 25, 2023 18:32
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) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x.py can't build individual crates
7 participants