|
1 | 1 | //! Implementation of compiling the compiler and standard library, in "check"-based modes.
|
2 | 2 |
|
3 |
| -use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step}; |
4 | 3 | use crate::compile::{add_to_sysroot, run_cargo, rustc_cargo, std_cargo};
|
5 | 4 | use crate::config::TargetSelection;
|
6 | 5 | use crate::tool::{prepare_tool_cargo, SourceType};
|
| 6 | +use crate::{ |
| 7 | + builder::{Builder, Kind, RunConfig, ShouldRun, Step}, |
| 8 | + Subcommand, |
| 9 | +}; |
7 | 10 | use crate::{Compiler, Mode};
|
8 | 11 | use std::path::PathBuf;
|
9 | 12 |
|
@@ -74,35 +77,37 @@ impl Step for Std {
|
74 | 77 | //
|
75 | 78 | // Currently only the "libtest" tree of crates does this.
|
76 | 79 |
|
77 |
| - let mut cargo = builder.cargo( |
78 |
| - compiler, |
79 |
| - Mode::Std, |
80 |
| - SourceType::InTree, |
81 |
| - target, |
82 |
| - cargo_subcommand(builder.kind), |
83 |
| - ); |
84 |
| - std_cargo(builder, target, compiler.stage, &mut cargo); |
85 |
| - cargo.arg("--all-targets"); |
| 80 | + if let Subcommand::Check { all_targets: true, .. } = builder.config.cmd { |
| 81 | + let mut cargo = builder.cargo( |
| 82 | + compiler, |
| 83 | + Mode::Std, |
| 84 | + SourceType::InTree, |
| 85 | + target, |
| 86 | + cargo_subcommand(builder.kind), |
| 87 | + ); |
| 88 | + std_cargo(builder, target, compiler.stage, &mut cargo); |
| 89 | + cargo.arg("--all-targets"); |
| 90 | + |
| 91 | + // Explicitly pass -p for all dependencies krates -- this will force cargo |
| 92 | + // to also check the tests/benches/examples for these crates, rather |
| 93 | + // than just the leaf crate. |
| 94 | + for krate in builder.in_tree_crates("test") { |
| 95 | + cargo.arg("-p").arg(krate.name); |
| 96 | + } |
86 | 97 |
|
87 |
| - // Explicitly pass -p for all dependencies krates -- this will force cargo |
88 |
| - // to also check the tests/benches/examples for these crates, rather |
89 |
| - // than just the leaf crate. |
90 |
| - for krate in builder.in_tree_crates("test") { |
91 |
| - cargo.arg("-p").arg(krate.name); |
| 98 | + builder.info(&format!( |
| 99 | + "Checking std test/bench/example targets ({} -> {})", |
| 100 | + &compiler.host, target |
| 101 | + )); |
| 102 | + run_cargo( |
| 103 | + builder, |
| 104 | + cargo, |
| 105 | + args(builder.kind), |
| 106 | + &libstd_test_stamp(builder, compiler, target), |
| 107 | + vec![], |
| 108 | + true, |
| 109 | + ); |
92 | 110 | }
|
93 |
| - |
94 |
| - builder.info(&format!( |
95 |
| - "Checking std test/bench/example targets ({} -> {})", |
96 |
| - &compiler.host, target |
97 |
| - )); |
98 |
| - run_cargo( |
99 |
| - builder, |
100 |
| - cargo, |
101 |
| - args(builder.kind), |
102 |
| - &libstd_test_stamp(builder, compiler, target), |
103 |
| - vec![], |
104 |
| - true, |
105 |
| - ); |
106 | 111 | }
|
107 | 112 | }
|
108 | 113 |
|
@@ -143,7 +148,9 @@ impl Step for Rustc {
|
143 | 148 | cargo_subcommand(builder.kind),
|
144 | 149 | );
|
145 | 150 | rustc_cargo(builder, &mut cargo, target);
|
146 |
| - cargo.arg("--all-targets"); |
| 151 | + if let Subcommand::Check { all_targets: true, .. } = builder.config.cmd { |
| 152 | + cargo.arg("--all-targets"); |
| 153 | + } |
147 | 154 |
|
148 | 155 | // Explicitly pass -p for all compiler krates -- this will force cargo
|
149 | 156 | // to also check the tests/benches/examples for these crates, rather
|
@@ -205,7 +212,9 @@ macro_rules! tool_check_step {
|
205 | 212 | &[],
|
206 | 213 | );
|
207 | 214 |
|
208 |
| - cargo.arg("--all-targets"); |
| 215 | + if let Subcommand::Check { all_targets: true, .. } = builder.config.cmd { |
| 216 | + cargo.arg("--all-targets"); |
| 217 | + } |
209 | 218 |
|
210 | 219 | builder.info(&format!(
|
211 | 220 | "Checking {} artifacts ({} -> {})",
|
|
0 commit comments