Unify all groups in bootstrap to use Builder::msg
This commit is contained in:
parent
a279ba4349
commit
fbfcfa6bce
8 changed files with 206 additions and 239 deletions
|
|
@ -72,7 +72,6 @@ impl Step for Std {
|
|||
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let build_compiler = self.build_compiler;
|
||||
let stage = build_compiler.stage;
|
||||
let target = self.target;
|
||||
|
||||
let mut cargo = builder::Cargo::new(
|
||||
|
|
@ -94,10 +93,12 @@ impl Step for Std {
|
|||
cargo.arg("-p").arg(krate);
|
||||
}
|
||||
|
||||
let _guard = builder.msg_check(
|
||||
let _guard = builder.msg(
|
||||
Kind::Check,
|
||||
format_args!("library artifacts{}", crate_description(&self.crates)),
|
||||
Mode::Std,
|
||||
self.build_compiler,
|
||||
target,
|
||||
Some(stage),
|
||||
);
|
||||
|
||||
let stamp = build_stamp::libstd_stamp(builder, build_compiler, target).with_prefix("check");
|
||||
|
|
@ -136,7 +137,13 @@ impl Step for Std {
|
|||
|
||||
let stamp =
|
||||
build_stamp::libstd_stamp(builder, build_compiler, target).with_prefix("check-test");
|
||||
let _guard = builder.msg_check("library test/bench/example targets", target, Some(stage));
|
||||
let _guard = builder.msg(
|
||||
Kind::Check,
|
||||
"library test/bench/example targets",
|
||||
Mode::Std,
|
||||
self.build_compiler,
|
||||
target,
|
||||
);
|
||||
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
|
||||
}
|
||||
|
||||
|
|
@ -227,10 +234,12 @@ impl Step for Rustc {
|
|||
cargo.arg("-p").arg(krate);
|
||||
}
|
||||
|
||||
let _guard = builder.msg_check(
|
||||
let _guard = builder.msg(
|
||||
Kind::Check,
|
||||
format_args!("compiler artifacts{}", crate_description(&self.crates)),
|
||||
Mode::Rustc,
|
||||
self.build_compiler,
|
||||
target,
|
||||
None,
|
||||
);
|
||||
|
||||
let stamp =
|
||||
|
|
@ -357,7 +366,13 @@ impl Step for CodegenBackend {
|
|||
.arg(builder.src.join(format!("compiler/{}/Cargo.toml", backend.crate_name())));
|
||||
rustc_cargo_env(builder, &mut cargo, target);
|
||||
|
||||
let _guard = builder.msg_check(backend.crate_name(), target, None);
|
||||
let _guard = builder.msg(
|
||||
Kind::Check,
|
||||
backend.crate_name(),
|
||||
Mode::Codegen,
|
||||
self.build_compiler,
|
||||
target,
|
||||
);
|
||||
|
||||
let stamp = build_stamp::codegen_backend_stamp(builder, build_compiler, target, &backend)
|
||||
.with_prefix("check");
|
||||
|
|
@ -482,14 +497,7 @@ fn run_tool_check_step(
|
|||
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, mode, target))
|
||||
.with_prefix(&format!("{display_name}-check"));
|
||||
|
||||
let stage = match mode {
|
||||
// Mode::ToolRustc is included here because of how msg_sysroot_tool prints stages
|
||||
Mode::Std | Mode::ToolRustc => build_compiler.stage,
|
||||
_ => build_compiler.stage + 1,
|
||||
};
|
||||
|
||||
let _guard =
|
||||
builder.msg_tool(builder.kind, mode, display_name, stage, &build_compiler.host, &target);
|
||||
let _guard = builder.msg(builder.kind, display_name, mode, build_compiler, target);
|
||||
run_cargo(builder, cargo, builder.config.free_args.clone(), &stamp, vec![], true, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,11 +143,11 @@ impl Step for Std {
|
|||
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let target = self.target;
|
||||
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
|
||||
let build_compiler = builder.compiler(builder.top_stage, builder.config.host_target);
|
||||
|
||||
let mut cargo = builder::Cargo::new(
|
||||
builder,
|
||||
compiler,
|
||||
build_compiler,
|
||||
Mode::Std,
|
||||
SourceType::InTree,
|
||||
target,
|
||||
|
|
@ -160,14 +160,19 @@ impl Step for Std {
|
|||
cargo.arg("-p").arg(krate);
|
||||
}
|
||||
|
||||
let _guard =
|
||||
builder.msg_clippy(format_args!("library{}", crate_description(&self.crates)), target);
|
||||
let _guard = builder.msg(
|
||||
Kind::Clippy,
|
||||
format_args!("library{}", crate_description(&self.crates)),
|
||||
Mode::Std,
|
||||
build_compiler,
|
||||
target,
|
||||
);
|
||||
|
||||
run_cargo(
|
||||
builder,
|
||||
cargo,
|
||||
lint_args(builder, &self.config, IGNORED_RULES_FOR_STD_AND_RUSTC),
|
||||
&build_stamp::libstd_stamp(builder, compiler, target),
|
||||
&build_stamp::libstd_stamp(builder, build_compiler, target),
|
||||
vec![],
|
||||
true,
|
||||
false,
|
||||
|
|
@ -203,33 +208,33 @@ impl Step for Rustc {
|
|||
/// This will lint the compiler for a particular stage of the build using
|
||||
/// the `compiler` targeting the `target` architecture.
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
|
||||
let build_compiler = builder.compiler(builder.top_stage, builder.config.host_target);
|
||||
let target = self.target;
|
||||
|
||||
if !builder.download_rustc() {
|
||||
if compiler.stage != 0 {
|
||||
if build_compiler.stage != 0 {
|
||||
// If we're not in stage 0, then we won't have a std from the beta
|
||||
// compiler around. That means we need to make sure there's one in
|
||||
// the sysroot for the compiler to find. Otherwise, we're going to
|
||||
// fail when building crates that need to generate code (e.g., build
|
||||
// scripts and their dependencies).
|
||||
builder.std(compiler, compiler.host);
|
||||
builder.std(compiler, target);
|
||||
builder.std(build_compiler, build_compiler.host);
|
||||
builder.std(build_compiler, target);
|
||||
} else {
|
||||
builder.ensure(check::Std::new(compiler, target));
|
||||
builder.ensure(check::Std::new(build_compiler, target));
|
||||
}
|
||||
}
|
||||
|
||||
let mut cargo = builder::Cargo::new(
|
||||
builder,
|
||||
compiler,
|
||||
build_compiler,
|
||||
Mode::Rustc,
|
||||
SourceType::InTree,
|
||||
target,
|
||||
Kind::Clippy,
|
||||
);
|
||||
|
||||
rustc_cargo(builder, &mut cargo, target, &compiler, &self.crates);
|
||||
rustc_cargo(builder, &mut cargo, target, &build_compiler, &self.crates);
|
||||
|
||||
// Explicitly pass -p for all compiler crates -- this will force cargo
|
||||
// to also lint the tests/benches/examples for these crates, rather
|
||||
|
|
@ -238,14 +243,19 @@ impl Step for Rustc {
|
|||
cargo.arg("-p").arg(krate);
|
||||
}
|
||||
|
||||
let _guard =
|
||||
builder.msg_clippy(format_args!("compiler{}", crate_description(&self.crates)), target);
|
||||
let _guard = builder.msg(
|
||||
Kind::Clippy,
|
||||
format_args!("compiler{}", crate_description(&self.crates)),
|
||||
Mode::Rustc,
|
||||
build_compiler,
|
||||
target,
|
||||
);
|
||||
|
||||
run_cargo(
|
||||
builder,
|
||||
cargo,
|
||||
lint_args(builder, &self.config, IGNORED_RULES_FOR_STD_AND_RUSTC),
|
||||
&build_stamp::librustc_stamp(builder, compiler, target),
|
||||
&build_stamp::librustc_stamp(builder, build_compiler, target),
|
||||
vec![],
|
||||
true,
|
||||
false,
|
||||
|
|
@ -284,16 +294,16 @@ macro_rules! lint_any {
|
|||
}
|
||||
|
||||
fn run(self, builder: &Builder<'_>) -> Self::Output {
|
||||
let compiler = builder.compiler(builder.top_stage, builder.config.host_target);
|
||||
let build_compiler = builder.compiler(builder.top_stage, builder.config.host_target);
|
||||
let target = self.target;
|
||||
|
||||
if !builder.download_rustc() {
|
||||
builder.ensure(check::Rustc::new(builder, compiler, target));
|
||||
builder.ensure(check::Rustc::new(builder, build_compiler, target));
|
||||
};
|
||||
|
||||
let cargo = prepare_tool_cargo(
|
||||
builder,
|
||||
compiler,
|
||||
build_compiler,
|
||||
Mode::ToolRustc,
|
||||
target,
|
||||
Kind::Clippy,
|
||||
|
|
@ -302,17 +312,16 @@ macro_rules! lint_any {
|
|||
&[],
|
||||
);
|
||||
|
||||
let _guard = builder.msg_tool(
|
||||
let _guard = builder.msg(
|
||||
Kind::Clippy,
|
||||
Mode::ToolRustc,
|
||||
$readable_name,
|
||||
compiler.stage,
|
||||
&compiler.host,
|
||||
&target,
|
||||
Mode::ToolRustc,
|
||||
build_compiler,
|
||||
target,
|
||||
);
|
||||
|
||||
let stringified_name = stringify!($name).to_lowercase();
|
||||
let stamp = BuildStamp::new(&builder.cargo_out(compiler, Mode::ToolRustc, target))
|
||||
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, Mode::ToolRustc, target))
|
||||
.with_prefix(&format!("{}-check", stringified_name));
|
||||
|
||||
run_cargo(
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ impl Step for Std {
|
|||
return;
|
||||
}
|
||||
|
||||
let compiler = if builder.download_rustc() && self.force_recompile {
|
||||
let build_compiler = if builder.download_rustc() && self.force_recompile {
|
||||
// When there are changes in the library tree with CI-rustc, we want to build
|
||||
// the stageN library and that requires using stageN-1 compiler.
|
||||
builder.compiler(self.compiler.stage.saturating_sub(1), builder.config.host_target)
|
||||
|
|
@ -173,7 +173,8 @@ impl Step for Std {
|
|||
&& builder.config.is_host_target(target)
|
||||
&& !self.force_recompile
|
||||
{
|
||||
let sysroot = builder.ensure(Sysroot { compiler, force_recompile: false });
|
||||
let sysroot =
|
||||
builder.ensure(Sysroot { compiler: build_compiler, force_recompile: false });
|
||||
cp_rustc_component_to_ci_sysroot(
|
||||
builder,
|
||||
&sysroot,
|
||||
|
|
@ -182,53 +183,58 @@ impl Step for Std {
|
|||
return;
|
||||
}
|
||||
|
||||
if builder.config.keep_stage.contains(&compiler.stage)
|
||||
|| builder.config.keep_stage_std.contains(&compiler.stage)
|
||||
if builder.config.keep_stage.contains(&build_compiler.stage)
|
||||
|| builder.config.keep_stage_std.contains(&build_compiler.stage)
|
||||
{
|
||||
trace!(keep_stage = ?builder.config.keep_stage);
|
||||
trace!(keep_stage_std = ?builder.config.keep_stage_std);
|
||||
|
||||
builder.info("WARNING: Using a potentially old libstd. This may not behave well.");
|
||||
|
||||
builder.ensure(StartupObjects { compiler, target });
|
||||
builder.ensure(StartupObjects { compiler: build_compiler, target });
|
||||
|
||||
self.copy_extra_objects(builder, &compiler, target);
|
||||
self.copy_extra_objects(builder, &build_compiler, target);
|
||||
|
||||
builder.ensure(StdLink::from_std(self, compiler));
|
||||
builder.ensure(StdLink::from_std(self, build_compiler));
|
||||
return;
|
||||
}
|
||||
|
||||
let mut target_deps = builder.ensure(StartupObjects { compiler, target });
|
||||
let mut target_deps = builder.ensure(StartupObjects { compiler: build_compiler, target });
|
||||
|
||||
let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
|
||||
let compiler_to_use =
|
||||
builder.compiler_for(build_compiler.stage, build_compiler.host, target);
|
||||
trace!(?compiler_to_use);
|
||||
|
||||
if compiler_to_use != compiler
|
||||
if compiler_to_use != build_compiler
|
||||
// Never uplift std unless we have compiled stage 1; if stage 1 is compiled,
|
||||
// uplift it from there.
|
||||
//
|
||||
// FIXME: improve `fn compiler_for` to avoid adding stage condition here.
|
||||
&& compiler.stage > 1
|
||||
&& build_compiler.stage > 1
|
||||
{
|
||||
trace!(?compiler_to_use, ?compiler, "compiler != compiler_to_use, uplifting library");
|
||||
trace!(
|
||||
?compiler_to_use,
|
||||
?build_compiler,
|
||||
"compiler != compiler_to_use, uplifting library"
|
||||
);
|
||||
|
||||
builder.std(compiler_to_use, target);
|
||||
let msg = if compiler_to_use.host == target {
|
||||
format!(
|
||||
"Uplifting library (stage{} -> stage{})",
|
||||
compiler_to_use.stage, compiler.stage
|
||||
compiler_to_use.stage, build_compiler.stage
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"Uplifting library (stage{}:{} -> stage{}:{})",
|
||||
compiler_to_use.stage, compiler_to_use.host, compiler.stage, target
|
||||
compiler_to_use.stage, compiler_to_use.host, build_compiler.stage, target
|
||||
)
|
||||
};
|
||||
builder.info(&msg);
|
||||
|
||||
// Even if we're not building std this stage, the new sysroot must
|
||||
// still contain the third party objects needed by various targets.
|
||||
self.copy_extra_objects(builder, &compiler, target);
|
||||
self.copy_extra_objects(builder, &build_compiler, target);
|
||||
|
||||
builder.ensure(StdLink::from_std(self, compiler_to_use));
|
||||
return;
|
||||
|
|
@ -236,11 +242,11 @@ impl Step for Std {
|
|||
|
||||
trace!(
|
||||
?compiler_to_use,
|
||||
?compiler,
|
||||
?build_compiler,
|
||||
"compiler == compiler_to_use, handling not-cross-compile scenario"
|
||||
);
|
||||
|
||||
target_deps.extend(self.copy_extra_objects(builder, &compiler, target));
|
||||
target_deps.extend(self.copy_extra_objects(builder, &build_compiler, target));
|
||||
|
||||
// We build a sysroot for mir-opt tests using the same trick that Miri does: A check build
|
||||
// with -Zalways-encode-mir. This frees us from the need to have a target linker, and the
|
||||
|
|
@ -249,7 +255,7 @@ impl Step for Std {
|
|||
trace!("building special sysroot for mir-opt tests");
|
||||
let mut cargo = builder::Cargo::new_for_mir_opt_tests(
|
||||
builder,
|
||||
compiler,
|
||||
build_compiler,
|
||||
Mode::Std,
|
||||
SourceType::InTree,
|
||||
target,
|
||||
|
|
@ -262,7 +268,7 @@ impl Step for Std {
|
|||
trace!("building regular sysroot");
|
||||
let mut cargo = builder::Cargo::new(
|
||||
builder,
|
||||
compiler,
|
||||
build_compiler,
|
||||
Mode::Std,
|
||||
SourceType::InTree,
|
||||
target,
|
||||
|
|
@ -285,16 +291,16 @@ impl Step for Std {
|
|||
|
||||
let _guard = builder.msg(
|
||||
Kind::Build,
|
||||
compiler.stage,
|
||||
format_args!("library artifacts{}", crate_description(&self.crates)),
|
||||
compiler.host,
|
||||
Mode::Std,
|
||||
build_compiler,
|
||||
target,
|
||||
);
|
||||
run_cargo(
|
||||
builder,
|
||||
cargo,
|
||||
vec![],
|
||||
&build_stamp::libstd_stamp(builder, compiler, target),
|
||||
&build_stamp::libstd_stamp(builder, build_compiler, target),
|
||||
target_deps,
|
||||
self.is_for_mir_opt_tests, // is_check
|
||||
false,
|
||||
|
|
@ -302,7 +308,7 @@ impl Step for Std {
|
|||
|
||||
builder.ensure(StdLink::from_std(
|
||||
self,
|
||||
builder.compiler(compiler.stage, builder.config.host_target),
|
||||
builder.compiler(build_compiler.stage, builder.config.host_target),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -1126,11 +1132,11 @@ impl Step for Rustc {
|
|||
cargo.env("RUSTC_BOLT_LINK_FLAGS", "1");
|
||||
}
|
||||
|
||||
let _guard = builder.msg_rustc_tool(
|
||||
let _guard = builder.msg(
|
||||
Kind::Build,
|
||||
build_compiler.stage,
|
||||
format_args!("compiler artifacts{}", crate_description(&self.crates)),
|
||||
build_compiler.host,
|
||||
Mode::Rustc,
|
||||
build_compiler,
|
||||
target,
|
||||
);
|
||||
let stamp = build_stamp::librustc_stamp(builder, build_compiler, target);
|
||||
|
|
@ -1603,11 +1609,11 @@ impl Step for GccCodegenBackend {
|
|||
let gcc = builder.ensure(Gcc { target });
|
||||
add_cg_gcc_cargo_flags(&mut cargo, &gcc);
|
||||
|
||||
let _guard = builder.msg_rustc_tool(
|
||||
let _guard = builder.msg(
|
||||
Kind::Build,
|
||||
build_compiler.stage,
|
||||
"codegen backend gcc",
|
||||
build_compiler.host,
|
||||
format_args!("codegen backend gcc"),
|
||||
Mode::Codegen,
|
||||
build_compiler,
|
||||
target,
|
||||
);
|
||||
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], false, false);
|
||||
|
|
@ -1687,11 +1693,11 @@ impl Step for CraneliftCodegenBackend {
|
|||
.arg(builder.src.join("compiler/rustc_codegen_cranelift/Cargo.toml"));
|
||||
rustc_cargo_env(builder, &mut cargo, target);
|
||||
|
||||
let _guard = builder.msg_rustc_tool(
|
||||
let _guard = builder.msg(
|
||||
Kind::Build,
|
||||
build_compiler.stage,
|
||||
"codegen backend cranelift",
|
||||
build_compiler.host,
|
||||
format_args!("codegen backend cranelift"),
|
||||
Mode::Codegen,
|
||||
build_compiler,
|
||||
target,
|
||||
);
|
||||
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], false, false);
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ impl Step for TheBook {
|
|||
fn run(self, builder: &Builder<'_>) {
|
||||
builder.require_submodule("src/doc/book", None);
|
||||
|
||||
let compiler = self.build_compiler;
|
||||
let build_compiler = self.build_compiler;
|
||||
let target = self.target;
|
||||
|
||||
let absolute_path = builder.src.join("src/doc/book");
|
||||
|
|
@ -273,20 +273,20 @@ impl Step for TheBook {
|
|||
let shared_assets = builder.ensure(SharedAssets { target });
|
||||
|
||||
// build the redirect pages
|
||||
let _guard = builder.msg_doc(compiler, "book redirect pages", target);
|
||||
let _guard = builder.msg(Kind::Doc, "book redirect pages", None, build_compiler, target);
|
||||
for file in t!(fs::read_dir(redirect_path)) {
|
||||
let file = t!(file);
|
||||
let path = file.path();
|
||||
let path = path.to_str().unwrap();
|
||||
|
||||
invoke_rustdoc(builder, compiler, &shared_assets, target, path);
|
||||
invoke_rustdoc(builder, build_compiler, &shared_assets, target, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn invoke_rustdoc(
|
||||
builder: &Builder<'_>,
|
||||
compiler: Compiler,
|
||||
build_compiler: Compiler,
|
||||
shared_assets: &SharedAssetsPaths,
|
||||
target: TargetSelection,
|
||||
markdown: &str,
|
||||
|
|
@ -298,7 +298,7 @@ fn invoke_rustdoc(
|
|||
let header = builder.src.join("src/doc/redirect.inc");
|
||||
let footer = builder.src.join("src/doc/footer.inc");
|
||||
|
||||
let mut cmd = builder.rustdoc_cmd(compiler);
|
||||
let mut cmd = builder.rustdoc_cmd(build_compiler);
|
||||
|
||||
let out = out.join("book");
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ impl Step for Standalone {
|
|||
fn run(self, builder: &Builder<'_>) {
|
||||
let target = self.target;
|
||||
let build_compiler = self.build_compiler;
|
||||
let _guard = builder.msg_doc(build_compiler, "standalone", target);
|
||||
let _guard = builder.msg(Kind::Doc, "standalone", None, build_compiler, target);
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
|
||||
|
|
@ -469,7 +469,7 @@ impl Step for Releases {
|
|||
fn run(self, builder: &Builder<'_>) {
|
||||
let target = self.target;
|
||||
let build_compiler = self.build_compiler;
|
||||
let _guard = builder.msg_doc(build_compiler, "releases", target);
|
||||
let _guard = builder.msg(Kind::Doc, "releases", None, build_compiler, target);
|
||||
let out = builder.doc_out(target);
|
||||
t!(fs::create_dir_all(&out));
|
||||
|
||||
|
|
@ -784,7 +784,7 @@ fn doc_std(
|
|||
|
||||
let description =
|
||||
format!("library{} in {} format", crate_description(requested_crates), format.as_str());
|
||||
let _guard = builder.msg_doc(build_compiler, description, target);
|
||||
let _guard = builder.msg(Kind::Doc, description, None, build_compiler, target);
|
||||
|
||||
cargo.into_cmd().run(builder);
|
||||
builder.cp_link_r(&out_dir, out);
|
||||
|
|
@ -861,11 +861,11 @@ impl Step for Rustc {
|
|||
let build_compiler = self.build_compiler;
|
||||
builder.std(build_compiler, builder.config.host_target);
|
||||
|
||||
let _guard = builder.msg_rustc_tool(
|
||||
let _guard = builder.msg(
|
||||
Kind::Doc,
|
||||
build_compiler.stage,
|
||||
format!("compiler{}", crate_description(&self.crates)),
|
||||
build_compiler.host,
|
||||
Mode::Rustc,
|
||||
build_compiler,
|
||||
target,
|
||||
);
|
||||
|
||||
|
|
@ -1059,7 +1059,7 @@ macro_rules! tool_doc {
|
|||
let proc_macro_out_dir = builder.stage_out(build_compiler, mode).join("doc");
|
||||
symlink_dir_force(&builder.config, &out, &proc_macro_out_dir);
|
||||
|
||||
let _guard = builder.msg_doc(build_compiler, stringify!($tool).to_lowercase(), target);
|
||||
let _guard = builder.msg(Kind::Doc, stringify!($tool).to_lowercase(), None, build_compiler, target);
|
||||
cargo.into_cmd().run(builder);
|
||||
|
||||
if !builder.config.dry_run() {
|
||||
|
|
@ -1314,13 +1314,8 @@ impl Step for RustcBook {
|
|||
// bootstrap.toml), then this needs to explicitly update the dylib search
|
||||
// path.
|
||||
builder.add_rustc_lib_path(self.build_compiler, &mut cmd);
|
||||
let doc_generator_guard = builder.msg(
|
||||
Kind::Run,
|
||||
self.build_compiler.stage,
|
||||
"lint-docs",
|
||||
self.build_compiler.host,
|
||||
self.target,
|
||||
);
|
||||
let doc_generator_guard =
|
||||
builder.msg(Kind::Run, "lint-docs", None, self.build_compiler, self.target);
|
||||
cmd.run(builder);
|
||||
drop(doc_generator_guard);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,13 @@ fn install_sh(
|
|||
host: Option<TargetSelection>,
|
||||
tarball: &GeneratedTarball,
|
||||
) {
|
||||
let _guard = builder.msg(Kind::Install, stage, package, host, host);
|
||||
let _guard = builder.msg(
|
||||
Kind::Install,
|
||||
package,
|
||||
None,
|
||||
(host.unwrap_or(builder.host_target), stage),
|
||||
host,
|
||||
);
|
||||
|
||||
let prefix = default_path(&builder.config.prefix, "/usr/local");
|
||||
let sysconfdir = prefix.join(default_path(&builder.config.sysconfdir, "/etc"));
|
||||
|
|
|
|||
|
|
@ -161,8 +161,7 @@ You can skip linkcheck with --skip src/tools/linkchecker"
|
|||
let linkchecker = builder.tool_cmd(Tool::Linkchecker);
|
||||
|
||||
// Run the linkchecker.
|
||||
let _guard =
|
||||
builder.msg(Kind::Test, compiler.stage, "Linkcheck", bootstrap_host, bootstrap_host);
|
||||
let _guard = builder.msg(Kind::Test, "Linkcheck", None, compiler, bootstrap_host);
|
||||
let _time = helpers::timeit(builder);
|
||||
linkchecker.delay_failure().arg(builder.out.join(host).join("doc")).run(builder);
|
||||
}
|
||||
|
|
@ -541,8 +540,7 @@ impl Miri {
|
|||
cargo.env("MIRI_SYSROOT", &miri_sysroot);
|
||||
|
||||
let mut cargo = BootstrapCommand::from(cargo);
|
||||
let _guard =
|
||||
builder.msg(Kind::Build, compiler.stage, "miri sysroot", compiler.host, target);
|
||||
let _guard = builder.msg(Kind::Build, "miri sysroot", Mode::ToolRustc, compiler, target);
|
||||
cargo.run(builder);
|
||||
|
||||
// # Determine where Miri put its sysroot.
|
||||
|
|
@ -643,7 +641,8 @@ impl Step for Miri {
|
|||
cargo.env("MIRI_TEST_TARGET", target.rustc_target_arg());
|
||||
|
||||
{
|
||||
let _guard = builder.msg_rustc_tool(Kind::Test, stage, "miri", host, target);
|
||||
let _guard =
|
||||
builder.msg(Kind::Test, "miri", Mode::ToolRustc, miri.build_compiler, target);
|
||||
let _time = helpers::timeit(builder);
|
||||
cargo.run(builder);
|
||||
}
|
||||
|
|
@ -659,11 +658,11 @@ impl Step for Miri {
|
|||
cargo.args(["tests/pass", "tests/panic"]);
|
||||
|
||||
{
|
||||
let _guard = builder.msg_rustc_tool(
|
||||
let _guard = builder.msg(
|
||||
Kind::Test,
|
||||
stage,
|
||||
"miri (mir-opt-level 4)",
|
||||
host,
|
||||
Mode::ToolRustc,
|
||||
miri.build_compiler,
|
||||
target,
|
||||
);
|
||||
let _time = helpers::timeit(builder);
|
||||
|
|
@ -703,7 +702,7 @@ impl Step for CargoMiri {
|
|||
}
|
||||
|
||||
// This compiler runs on the host, we'll just use it for the target.
|
||||
let compiler = builder.compiler(stage, host);
|
||||
let build_compiler = builder.compiler(stage, host);
|
||||
|
||||
// Run `cargo miri test`.
|
||||
// This is just a smoke test (Miri's own CI invokes this in a bunch of different ways and ensures
|
||||
|
|
@ -711,7 +710,7 @@ impl Step for CargoMiri {
|
|||
// itself executes properly under Miri, and that all the logic in `cargo-miri` does not explode.
|
||||
let mut cargo = tool::prepare_tool_cargo(
|
||||
builder,
|
||||
compiler,
|
||||
build_compiler,
|
||||
Mode::ToolStd, // it's unclear what to use here, we're not building anything just doing a smoke test!
|
||||
target,
|
||||
Kind::MiriTest,
|
||||
|
|
@ -736,7 +735,8 @@ impl Step for CargoMiri {
|
|||
// Finally, run everything.
|
||||
let mut cargo = BootstrapCommand::from(cargo);
|
||||
{
|
||||
let _guard = builder.msg_rustc_tool(Kind::Test, stage, "cargo-miri", host, target);
|
||||
let _guard =
|
||||
builder.msg(Kind::Test, "cargo-miri", Mode::ToolRustc, (host, stage), target);
|
||||
let _time = helpers::timeit(builder);
|
||||
cargo.run(builder);
|
||||
}
|
||||
|
|
@ -830,7 +830,7 @@ impl Step for Clippy {
|
|||
|
||||
/// Runs `cargo test` for clippy.
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let host = self.compilers.target();
|
||||
let target = self.compilers.target();
|
||||
|
||||
// We need to carefully distinguish the compiler that builds clippy, and the compiler
|
||||
// that is linked into the clippy being tested. `target_compiler` is the latter,
|
||||
|
|
@ -844,7 +844,7 @@ impl Step for Clippy {
|
|||
builder,
|
||||
build_compiler,
|
||||
Mode::ToolRustc,
|
||||
host,
|
||||
target,
|
||||
Kind::Test,
|
||||
"src/tools/clippy",
|
||||
SourceType::InTree,
|
||||
|
|
@ -858,7 +858,7 @@ impl Step for Clippy {
|
|||
cargo.env("HOST_LIBS", host_libs);
|
||||
|
||||
// Build the standard library that the tests can use.
|
||||
builder.std(target_compiler, host);
|
||||
builder.std(target_compiler, target);
|
||||
cargo.env("TEST_SYSROOT", builder.sysroot(target_compiler));
|
||||
cargo.env("TEST_RUSTC", builder.rustc(target_compiler));
|
||||
cargo.env("TEST_RUSTC_LIB", builder.rustc_libdir(target_compiler));
|
||||
|
|
@ -881,9 +881,9 @@ impl Step for Clippy {
|
|||
}
|
||||
|
||||
cargo.add_rustc_lib_path(builder);
|
||||
let cargo = prepare_cargo_test(cargo, &[], &[], host, builder);
|
||||
let cargo = prepare_cargo_test(cargo, &[], &[], target, builder);
|
||||
|
||||
let _guard = builder.msg_rustc_tool(Kind::Test, build_compiler.stage, "clippy", host, host);
|
||||
let _guard = builder.msg(Kind::Test, "clippy", Mode::ToolRustc, build_compiler, target);
|
||||
|
||||
// Clippy reports errors if it blessed the outputs
|
||||
if cargo.allow_failure().run(builder) {
|
||||
|
|
@ -990,9 +990,9 @@ impl Step for RustdocJSStd {
|
|||
));
|
||||
let _guard = builder.msg(
|
||||
Kind::Test,
|
||||
builder.top_stage,
|
||||
"rustdoc-js-std",
|
||||
builder.config.host_target,
|
||||
None,
|
||||
(builder.config.host_target, builder.top_stage),
|
||||
self.target,
|
||||
);
|
||||
command.run(builder);
|
||||
|
|
@ -1141,13 +1141,7 @@ impl Step for RustdocGUI {
|
|||
}
|
||||
|
||||
let _time = helpers::timeit(builder);
|
||||
let _guard = builder.msg_rustc_tool(
|
||||
Kind::Test,
|
||||
self.compiler.stage,
|
||||
"rustdoc-gui",
|
||||
self.compiler.host,
|
||||
self.target,
|
||||
);
|
||||
let _guard = builder.msg(Kind::Test, "rustdoc-gui", None, self.compiler, self.target);
|
||||
try_run_tests(builder, &mut cmd, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -2237,9 +2231,9 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
|
|||
|
||||
let _group = builder.msg(
|
||||
Kind::Test,
|
||||
compiler.stage,
|
||||
format!("compiletest suite={suite} mode={mode}"),
|
||||
compiler.host,
|
||||
Mode::ToolBootstrap,
|
||||
compiler,
|
||||
target,
|
||||
);
|
||||
try_run_tests(builder, &mut cmd, false);
|
||||
|
|
@ -2381,9 +2375,9 @@ impl BookTest {
|
|||
builder.add_rust_test_threads(&mut rustbook_cmd);
|
||||
let _guard = builder.msg(
|
||||
Kind::Test,
|
||||
compiler.stage,
|
||||
format_args!("mdbook {}", self.path.display()),
|
||||
compiler.host,
|
||||
None,
|
||||
compiler,
|
||||
compiler.host,
|
||||
);
|
||||
let _time = helpers::timeit(builder);
|
||||
|
|
@ -2402,8 +2396,7 @@ impl BookTest {
|
|||
|
||||
builder.std(compiler, host);
|
||||
|
||||
let _guard =
|
||||
builder.msg(Kind::Test, compiler.stage, format!("book {}", self.name), host, host);
|
||||
let _guard = builder.msg(Kind::Test, format!("book {}", self.name), None, compiler, host);
|
||||
|
||||
// Do a breadth-first traversal of the `src/doc` directory and just run
|
||||
// tests for all files that end in `*.md`
|
||||
|
|
@ -2547,9 +2540,9 @@ impl Step for ErrorIndex {
|
|||
|
||||
let guard = builder.msg(
|
||||
Kind::Test,
|
||||
target_compiler.stage,
|
||||
"error-index",
|
||||
target_compiler.host,
|
||||
None,
|
||||
self.compilers.build_compiler(),
|
||||
target_compiler.host,
|
||||
);
|
||||
let _time = helpers::timeit(builder);
|
||||
|
|
@ -2650,9 +2643,8 @@ fn run_cargo_test<'a>(
|
|||
let compiler = cargo.compiler();
|
||||
let mut cargo = prepare_cargo_test(cargo, libtest_args, crates, target, builder);
|
||||
let _time = helpers::timeit(builder);
|
||||
let _group = description.into().and_then(|what| {
|
||||
builder.msg_rustc_tool(Kind::Test, compiler.stage, what, compiler.host, target)
|
||||
});
|
||||
let _group =
|
||||
description.into().and_then(|what| builder.msg(Kind::Test, what, None, compiler, target));
|
||||
|
||||
#[cfg(feature = "build-metrics")]
|
||||
builder.metrics.begin_test_suite(
|
||||
|
|
@ -3176,8 +3168,9 @@ impl Step for Bootstrap {
|
|||
/// Tests the build system itself.
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let host = builder.config.host_target;
|
||||
let compiler = builder.compiler(0, host);
|
||||
let _guard = builder.msg(Kind::Test, 0, "bootstrap", host, host);
|
||||
let build_compiler = builder.compiler(0, host);
|
||||
let _guard =
|
||||
builder.msg(Kind::Test, "bootstrap", Mode::ToolBootstrap, build_compiler, host);
|
||||
|
||||
// Some tests require cargo submodule to be present.
|
||||
builder.build.require_submodule("src/tools/cargo", None);
|
||||
|
|
@ -3196,7 +3189,7 @@ impl Step for Bootstrap {
|
|||
|
||||
let mut cargo = tool::prepare_tool_cargo(
|
||||
builder,
|
||||
compiler,
|
||||
build_compiler,
|
||||
Mode::ToolBootstrap,
|
||||
host,
|
||||
Kind::Test,
|
||||
|
|
@ -3276,9 +3269,9 @@ impl Step for TierCheck {
|
|||
|
||||
let _guard = builder.msg(
|
||||
Kind::Test,
|
||||
self.compiler.stage,
|
||||
"platform support check",
|
||||
self.compiler.host,
|
||||
None,
|
||||
self.compiler,
|
||||
self.compiler.host,
|
||||
);
|
||||
BootstrapCommand::from(cargo).delay_failure().run(builder);
|
||||
|
|
@ -3326,10 +3319,10 @@ impl Step for RustInstaller {
|
|||
/// Ensure the version placeholder replacement tool builds
|
||||
fn run(self, builder: &Builder<'_>) {
|
||||
let bootstrap_host = builder.config.host_target;
|
||||
let compiler = builder.compiler(0, bootstrap_host);
|
||||
let build_compiler = builder.compiler(0, bootstrap_host);
|
||||
let cargo = tool::prepare_tool_cargo(
|
||||
builder,
|
||||
compiler,
|
||||
build_compiler,
|
||||
Mode::ToolBootstrap,
|
||||
bootstrap_host,
|
||||
Kind::Test,
|
||||
|
|
@ -3338,13 +3331,8 @@ impl Step for RustInstaller {
|
|||
&[],
|
||||
);
|
||||
|
||||
let _guard = builder.msg(
|
||||
Kind::Test,
|
||||
compiler.stage,
|
||||
"rust-installer",
|
||||
bootstrap_host,
|
||||
bootstrap_host,
|
||||
);
|
||||
let _guard =
|
||||
builder.msg(Kind::Test, "rust-installer", None, build_compiler, bootstrap_host);
|
||||
run_cargo_test(cargo, &[], &[], None, bootstrap_host, builder);
|
||||
|
||||
// We currently don't support running the test.sh script outside linux(?) environments.
|
||||
|
|
@ -3355,7 +3343,7 @@ impl Step for RustInstaller {
|
|||
}
|
||||
|
||||
let mut cmd = command(builder.src.join("src/tools/rust-installer/test.sh"));
|
||||
let tmpdir = testdir(builder, compiler.host).join("rust-installer");
|
||||
let tmpdir = testdir(builder, build_compiler.host).join("rust-installer");
|
||||
let _ = std::fs::remove_dir_all(&tmpdir);
|
||||
let _ = std::fs::create_dir_all(&tmpdir);
|
||||
cmd.current_dir(&tmpdir);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use crate::core::builder::{
|
|||
use crate::core::config::{DebuginfoLevel, RustcLto, TargetSelection};
|
||||
use crate::utils::exec::{BootstrapCommand, command};
|
||||
use crate::utils::helpers::{add_dylib_path, exe, t};
|
||||
use crate::{Compiler, FileType, Kind, Mode, gha};
|
||||
use crate::{Compiler, FileType, Kind, Mode};
|
||||
|
||||
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
|
||||
pub enum SourceType {
|
||||
|
|
@ -58,28 +58,6 @@ struct ToolBuild {
|
|||
artifact_kind: ToolArtifactKind,
|
||||
}
|
||||
|
||||
impl Builder<'_> {
|
||||
#[track_caller]
|
||||
pub(crate) fn msg_tool(
|
||||
&self,
|
||||
kind: Kind,
|
||||
mode: Mode,
|
||||
tool: &str,
|
||||
build_stage: u32,
|
||||
host: &TargetSelection,
|
||||
target: &TargetSelection,
|
||||
) -> Option<gha::Group> {
|
||||
match mode {
|
||||
// depends on compiler stage, different to host compiler
|
||||
Mode::ToolRustc => {
|
||||
self.msg_rustc_tool(kind, build_stage, format_args!("tool {tool}"), *host, *target)
|
||||
}
|
||||
// doesn't depend on compiler, same as host compiler
|
||||
_ => self.msg(kind, build_stage, format_args!("tool {tool}"), *host, *target),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Result of the tool build process. Each `Step` in this module is responsible
|
||||
/// for using this type as `type Output = ToolBuildResult;`
|
||||
#[derive(Clone)]
|
||||
|
|
@ -166,14 +144,8 @@ impl Step for ToolBuild {
|
|||
|
||||
cargo.args(self.cargo_args);
|
||||
|
||||
let _guard = builder.msg_tool(
|
||||
Kind::Build,
|
||||
self.mode,
|
||||
self.tool,
|
||||
self.build_compiler.stage,
|
||||
&self.build_compiler.host,
|
||||
&self.target,
|
||||
);
|
||||
let _guard =
|
||||
builder.msg(Kind::Build, self.tool, self.mode, self.build_compiler, self.target);
|
||||
|
||||
// we check this below
|
||||
let build_success = compile::stream_cargo(builder, cargo, vec![], &mut |_| {});
|
||||
|
|
|
|||
|
|
@ -410,6 +410,25 @@ forward! {
|
|||
download_rustc() -> bool,
|
||||
}
|
||||
|
||||
/// A mostly temporary helper struct before we can migrate everything in bootstrap to use
|
||||
/// the concept of a build compiler.
|
||||
struct HostAndStage {
|
||||
host: TargetSelection,
|
||||
stage: u32,
|
||||
}
|
||||
|
||||
impl From<(TargetSelection, u32)> for HostAndStage {
|
||||
fn from((host, stage): (TargetSelection, u32)) -> Self {
|
||||
Self { host, stage }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Compiler> for HostAndStage {
|
||||
fn from(compiler: Compiler) -> Self {
|
||||
Self { host: compiler.host, stage: compiler.stage }
|
||||
}
|
||||
}
|
||||
|
||||
impl Build {
|
||||
/// Creates a new set of build configuration from the `flags` on the command
|
||||
/// line and the filesystem `config`.
|
||||
|
|
@ -1072,45 +1091,14 @@ impl Build {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "Groups should not be dropped until the Step finishes running"]
|
||||
#[track_caller]
|
||||
fn msg_clippy(
|
||||
&self,
|
||||
what: impl Display,
|
||||
target: impl Into<Option<TargetSelection>>,
|
||||
) -> Option<gha::Group> {
|
||||
self.msg(Kind::Clippy, self.config.stage, what, self.config.host_target, target)
|
||||
}
|
||||
|
||||
#[must_use = "Groups should not be dropped until the Step finishes running"]
|
||||
#[track_caller]
|
||||
fn msg_check(
|
||||
&self,
|
||||
what: impl Display,
|
||||
target: impl Into<Option<TargetSelection>>,
|
||||
custom_stage: Option<u32>,
|
||||
) -> Option<gha::Group> {
|
||||
self.msg(
|
||||
Kind::Check,
|
||||
custom_stage.unwrap_or(self.config.stage),
|
||||
what,
|
||||
self.config.host_target,
|
||||
target,
|
||||
)
|
||||
}
|
||||
|
||||
#[must_use = "Groups should not be dropped until the Step finishes running"]
|
||||
#[track_caller]
|
||||
fn msg_doc(
|
||||
&self,
|
||||
compiler: Compiler,
|
||||
what: impl Display,
|
||||
target: impl Into<Option<TargetSelection>> + Copy,
|
||||
) -> Option<gha::Group> {
|
||||
self.msg(Kind::Doc, compiler.stage, what, compiler.host, target.into())
|
||||
}
|
||||
|
||||
/// Return a `Group` guard for a [`Step`] that is built for each `--stage`.
|
||||
/// Return a `Group` guard for a [`Step`] that:
|
||||
/// - Performs `action`
|
||||
/// - On `what`
|
||||
/// - Where `what` possibly corresponds to a `mode`
|
||||
/// - `action` is performed using the given build compiler (`host_and_stage`).
|
||||
/// - Since some steps do not use the concept of a build compiler yet, it is also possible
|
||||
/// to pass the host and stage explicitly.
|
||||
/// - With a given `target`.
|
||||
///
|
||||
/// [`Step`]: crate::core::builder::Step
|
||||
#[must_use = "Groups should not be dropped until the Step finishes running"]
|
||||
|
|
@ -1118,15 +1106,31 @@ impl Build {
|
|||
fn msg(
|
||||
&self,
|
||||
action: impl Into<Kind>,
|
||||
stage: u32,
|
||||
what: impl Display,
|
||||
host: impl Into<Option<TargetSelection>>,
|
||||
mode: impl Into<Option<Mode>>,
|
||||
host_and_stage: impl Into<HostAndStage>,
|
||||
target: impl Into<Option<TargetSelection>>,
|
||||
) -> Option<gha::Group> {
|
||||
let host_and_stage = host_and_stage.into();
|
||||
let actual_stage = match mode.into() {
|
||||
// Std has the same stage as the compiler that builds it
|
||||
Some(Mode::Std) => host_and_stage.stage,
|
||||
// Other things have stage corresponding to their build compiler + 1
|
||||
Some(
|
||||
Mode::Rustc
|
||||
| Mode::Codegen
|
||||
| Mode::ToolBootstrap
|
||||
| Mode::ToolTarget
|
||||
| Mode::ToolStd
|
||||
| Mode::ToolRustc,
|
||||
)
|
||||
| None => host_and_stage.stage + 1,
|
||||
};
|
||||
|
||||
let action = action.into().description();
|
||||
let msg = |fmt| format!("{action} stage{stage} {what}{fmt}");
|
||||
let msg = |fmt| format!("{action} stage{actual_stage} {what}{fmt}");
|
||||
let msg = if let Some(target) = target.into() {
|
||||
let host = host.into().unwrap();
|
||||
let host = host_and_stage.host;
|
||||
if host == target {
|
||||
msg(format_args!(" ({target})"))
|
||||
} else {
|
||||
|
|
@ -1154,27 +1158,6 @@ impl Build {
|
|||
self.group(&msg)
|
||||
}
|
||||
|
||||
#[must_use = "Groups should not be dropped until the Step finishes running"]
|
||||
#[track_caller]
|
||||
fn msg_rustc_tool(
|
||||
&self,
|
||||
action: impl Into<Kind>,
|
||||
build_stage: u32,
|
||||
what: impl Display,
|
||||
host: TargetSelection,
|
||||
target: TargetSelection,
|
||||
) -> Option<gha::Group> {
|
||||
let action = action.into().description();
|
||||
let msg = |fmt| format!("{action} {what} {fmt}");
|
||||
|
||||
let msg = if host == target {
|
||||
msg(format_args!("(stage{build_stage} -> stage{}, {target})", build_stage + 1))
|
||||
} else {
|
||||
msg(format_args!("(stage{build_stage}:{host} -> stage{}:{target})", build_stage + 1))
|
||||
};
|
||||
self.group(&msg)
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
fn group(&self, msg: &str) -> Option<gha::Group> {
|
||||
match self.config.get_dry_run() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue