Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ pub fn ensure_version_or_cargo_install(
// use --force to ensure that if the required version is bumped, we update it.
// use --target-dir to ensure we have a build cache so repeated invocations aren't slow.
// modify PATH so that cargo doesn't print a warning telling the user to modify the path.
let cargo_exit_code = Command::new(cargo)
.args(["install", "--locked", "--force", "--quiet"])
let mut cmd = Command::new(cargo);
cmd.args(["install", "--locked", "--force", "--quiet"])
.arg("--root")
.arg(&tool_root_dir)
.arg("--target-dir")
Expand All @@ -208,10 +208,16 @@ pub fn ensure_version_or_cargo_install(
.chain(std::iter::once(tool_bin_dir.clone())),
)
.expect("build dir contains invalid char"),
)
.env("RUSTFLAGS", "-Copt-level=0")
.spawn()?
.wait()?;
);

// On CI, we set opt-level flag for quicker installation.
// Since lower opt-level decreases the tool's performance,
// we don't set this option on local.
if CiEnv::is_ci() {
cmd.env("RUSTFLAGS", "-Copt-level=0");
}

let cargo_exit_code = cmd.spawn()?.wait()?;
if !cargo_exit_code.success() {
return Err(io::Error::other("cargo install failed"));
}
Expand Down
Loading