Skip to content

Commit 4724040

Browse files
authored
Rollup merge of #95504 - jyn514:library-alias, r=Mark-Simulacrum
Add `x {check,build,doc} {compiler,library}` aliases. While working on #95503, I realized that it will interfere with existing command lines: Currently people run `x build library/std` expecting it to "add all library crates to the sysroot", but after that change, it will *only* build `libstd` and its dependencies (and add them to the sysroot), not libtest or libproc_macro. That will work for local testing in most cases, but could be confusing. Even if not, though, I think `x build library` is more clear about what actually happens than the current `x build library/std`. The intended end goal is something like: - For check/build/doc, we have library + compiler aliases, which correspond to basically "most possible" for that piece. This is the intended path of entry (rather than library/test or similar as today) for when you just want the thing to work -- for example, getting a compiler that is "crates.io-compatible" would be roughly `x.py build library`). #95504 - Specific crate invocations build up to that crate, which means that if you don't care about tests you probably want x.py build library/proc_macro or library/std for faster build times. #95503 Note that this is already implemented today for the `doc` command and seems to work pretty well in practice. I plan to change the dev-guide and various instructions in the README to `build library` once this is merged. `@rustbot` label +A-rustbuild
2 parents ce0473e + 9f38ce0 commit 4724040

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/bootstrap/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl Step for Std {
6464
const DEFAULT: bool = true;
6565

6666
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
67-
run.all_krates("test")
67+
run.all_krates("test").path("library")
6868
}
6969

7070
fn make_run(run: RunConfig<'_>) {
@@ -162,7 +162,7 @@ impl Step for Rustc {
162162
const DEFAULT: bool = true;
163163

164164
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
165-
run.all_krates("rustc-main")
165+
run.all_krates("rustc-main").path("compiler")
166166
}
167167

168168
fn make_run(run: RunConfig<'_>) {

src/bootstrap/compile.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl Step for Std {
4343
// When downloading stage1, the standard library has already been copied to the sysroot, so
4444
// there's no need to rebuild it.
4545
let download_rustc = run.builder.config.download_rustc;
46-
run.all_krates("test").default_condition(!download_rustc)
46+
run.all_krates("test").path("library").default_condition(!download_rustc)
4747
}
4848

4949
fn make_run(run: RunConfig<'_>) {
@@ -1047,7 +1047,7 @@ impl Step for Assemble {
10471047
const ONLY_HOSTS: bool = true;
10481048

10491049
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1050-
run.path("compiler/rustc")
1050+
run.path("compiler/rustc").path("compiler")
10511051
}
10521052

10531053
fn make_run(run: RunConfig<'_>) {

src/bootstrap/doc.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ impl Step for Std {
416416

417417
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
418418
let builder = run.builder;
419-
run.all_krates("test").default_condition(builder.config.docs)
419+
run.all_krates("test").path("library").default_condition(builder.config.docs)
420420
}
421421

422422
fn make_run(run: RunConfig<'_>) {
@@ -477,11 +477,14 @@ impl Step for Std {
477477
.iter()
478478
.map(components_simplified)
479479
.filter_map(|path| {
480-
if path.get(0) == Some(&"library") {
480+
if path.len() >= 2 && path.get(0) == Some(&"library") {
481+
// single crate
481482
Some(path[1].to_owned())
482483
} else if !path.is_empty() {
484+
// ??
483485
Some(path[0].to_owned())
484486
} else {
487+
// all library crates
485488
None
486489
}
487490
})

0 commit comments

Comments
 (0)