fix: Don't emit --keep-going for custom build script commands
This commit is contained in:
parent
e32a0a6acc
commit
dd0ea024d4
@ -64,8 +64,10 @@ fn build_command(
|
||||
config: &CargoConfig,
|
||||
allowed_features: &FxHashSet<String>,
|
||||
manifest_path: &ManifestPath,
|
||||
toolchain: Option<&Version>,
|
||||
sysroot: Option<&Sysroot>,
|
||||
) -> io::Result<Command> {
|
||||
const RUST_1_75: Version = Version::new(1, 75, 0);
|
||||
let mut cmd = match config.run_build_script_command.as_deref() {
|
||||
Some([program, args @ ..]) => {
|
||||
let mut cmd = Command::new(program);
|
||||
@ -120,6 +122,10 @@ fn build_command(
|
||||
cmd.arg("-Zscript");
|
||||
}
|
||||
|
||||
if toolchain.map_or(false, |it| *it >= RUST_1_75) {
|
||||
cmd.arg("--keep-going");
|
||||
}
|
||||
|
||||
cmd
|
||||
}
|
||||
};
|
||||
@ -142,11 +148,9 @@ pub(crate) fn run_for_workspace(
|
||||
config: &CargoConfig,
|
||||
workspace: &CargoWorkspace,
|
||||
progress: &dyn Fn(String),
|
||||
toolchain: &Option<Version>,
|
||||
toolchain: Option<&Version>,
|
||||
sysroot: Option<&Sysroot>,
|
||||
) -> io::Result<WorkspaceBuildScripts> {
|
||||
const RUST_1_75: Version = Version::new(1, 75, 0);
|
||||
|
||||
let current_dir = match &config.invocation_location {
|
||||
InvocationLocation::Root(root) if config.run_build_script_command.is_some() => {
|
||||
root.as_path()
|
||||
@ -156,11 +160,13 @@ pub(crate) fn run_for_workspace(
|
||||
.as_ref();
|
||||
|
||||
let allowed_features = workspace.workspace_features();
|
||||
let mut cmd =
|
||||
Self::build_command(config, &allowed_features, workspace.manifest_path(), sysroot)?;
|
||||
if toolchain.as_ref().map_or(false, |it| *it >= RUST_1_75) {
|
||||
cmd.args(["--keep-going"]);
|
||||
}
|
||||
let cmd = Self::build_command(
|
||||
config,
|
||||
&allowed_features,
|
||||
workspace.manifest_path(),
|
||||
toolchain,
|
||||
sysroot,
|
||||
)?;
|
||||
Self::run_per_ws(cmd, workspace, current_dir, progress)
|
||||
}
|
||||
|
||||
@ -189,6 +195,7 @@ pub(crate) fn run_once(
|
||||
// This is not gonna be used anyways, so just construct a dummy here
|
||||
&ManifestPath::try_from(workspace_root.clone()).unwrap(),
|
||||
None,
|
||||
None,
|
||||
)?;
|
||||
// NB: Cargo.toml could have been modified between `cargo metadata` and
|
||||
// `cargo check`. We shouldn't assume that package ids we see here are
|
||||
|
@ -488,7 +488,7 @@ pub fn run_build_scripts(
|
||||
config,
|
||||
cargo,
|
||||
progress,
|
||||
&self.toolchain,
|
||||
self.toolchain.as_ref(),
|
||||
self.sysroot.as_ref().ok(),
|
||||
)
|
||||
.with_context(|| {
|
||||
|
Loading…
Reference in New Issue
Block a user