cross
cross copied to clipboard
introduce verbosity levels
this will make it so rustup doesn't show verbose unless -vv
or -v
and CROSS_DEBUG
is used.
It might also be worth linking this with #797, and adding the diagnostics using msg_info.note
or something similar. Something like:
diff --git a/src/docker/mod.rs b/src/docker/mod.rs
index cd80b20..6fc78c4 100644
--- a/src/docker/mod.rs
+++ b/src/docker/mod.rs
@@ -51,6 +51,10 @@ pub fn run(
1,
);
}
+ msg_info.note(format_args!(
+ "running {} subcommand in container.",
+ options.cargo_variant.to_str()
+ ))?;
if options.is_remote() {
remote::run(options, paths, args, msg_info).wrap_err("could not complete remote run")
} else {
diff --git a/src/docker/remote.rs b/src/docker/remote.rs
index 23215f6..ed620df 100644
--- a/src/docker/remote.rs
+++ b/src/docker/remote.rs
@@ -984,6 +984,7 @@ pub(crate) fn run(
};
let mount_prefix_path = mount_prefix.as_ref();
if let VolumeId::Discard = volume {
+ msg_info.note("copying rust toolchain to temporary data volume.")?;
copy_volume_container_xargo(engine, &container, dirs, mount_prefix_path, msg_info)
.wrap_err("when copying xargo")?;
copy_volume_container_cargo(engine, &container, dirs, mount_prefix_path, false, msg_info)
@@ -999,6 +1000,10 @@ pub(crate) fn run(
.wrap_err("when copying rust")?;
} else {
// need to copy over the target triple if it hasn't been previously copied
+ msg_info.note(format_args!(
+ "copying rust target toolchain \"{}\" to data volume if it was not previously copied.",
+ target.target()
+ ))?;
copy_volume_container_rust_triple(
engine,
&container,
@@ -1027,6 +1032,7 @@ pub(crate) fn run(
)
.wrap_err("when creating mount root")?;
}
+ msg_info.note("copying project and mounted volume files to data volume.")?;
copy_volume_container_project(
engine,
&container,
diff --git a/src/rustup.rs b/src/rustup.rs
index 2b47a4d..c11b7df 100644
--- a/src/rustup.rs
+++ b/src/rustup.rs
@@ -148,8 +148,11 @@ fn version(msg_info: &mut MessageInfo) -> Result<Version> {
}
pub fn install_toolchain(toolchain: &QualifiedToolchain, msg_info: &mut MessageInfo) -> Result<()> {
- let mut command = rustup_command(msg_info, false);
let toolchain = toolchain.to_string();
+ msg_info.note(format_args!(
+ "installing \"{toolchain}\" toolchain via rustup."
+ ))?;
+ let mut command = rustup_command(msg_info, false);
command.args(&["toolchain", "add", &toolchain, "--profile", "minimal"]);
if version(msg_info)? >= semver::Version::new(1, 25, 0) {
command.arg("--force-non-host");
@@ -166,6 +169,9 @@ pub fn install(
) -> Result<()> {
let target = target.triple();
let toolchain = toolchain.to_string();
+ msg_info.note(format_args!(
+ "adding \"{target}\" target for toolchain \"{toolchain}\" via rustup."
+ ))?;
rustup_command(msg_info, false)
.args(&["target", "add", target, "--toolchain", &toolchain])
.run(msg_info, false)
@@ -178,6 +184,9 @@ pub fn install_component(
msg_info: &mut MessageInfo,
) -> Result<()> {
let toolchain = toolchain.to_string();
+ msg_info.note(format_args!(
+ "installing \"{component}\" component for toolchain \"{toolchain}\" via rustup."
+ ))?;
rustup_command(msg_info, false)
.args(&["component", "add", component, "--toolchain", &toolchain])
.run(msg_info, false)
Removed some of my comments since the rationale for the PR was made clearer elsewhere: the goal is so every external call to a rustup
, cargo
, etc. command is only printed if the verbosity level is >= 2 (similar to cargo, which only displays rustc
commands only if -vv
or higher is provided).
Needs a changelog entry but other than that, lgtm
bors r=@Alexhuszagh