mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
fix: Don't emit --keep-going for custom build script commands
This commit is contained in:
parent
465ebbc102
commit
eac2e512a1
2 changed files with 16 additions and 9 deletions
|
@ -64,8 +64,10 @@ impl WorkspaceBuildScripts {
|
||||||
config: &CargoConfig,
|
config: &CargoConfig,
|
||||||
allowed_features: &FxHashSet<String>,
|
allowed_features: &FxHashSet<String>,
|
||||||
manifest_path: &ManifestPath,
|
manifest_path: &ManifestPath,
|
||||||
|
toolchain: Option<&Version>,
|
||||||
sysroot: Option<&Sysroot>,
|
sysroot: Option<&Sysroot>,
|
||||||
) -> io::Result<Command> {
|
) -> io::Result<Command> {
|
||||||
|
const RUST_1_75: Version = Version::new(1, 75, 0);
|
||||||
let mut cmd = match config.run_build_script_command.as_deref() {
|
let mut cmd = match config.run_build_script_command.as_deref() {
|
||||||
Some([program, args @ ..]) => {
|
Some([program, args @ ..]) => {
|
||||||
let mut cmd = Command::new(program);
|
let mut cmd = Command::new(program);
|
||||||
|
@ -120,6 +122,10 @@ impl WorkspaceBuildScripts {
|
||||||
cmd.arg("-Zscript");
|
cmd.arg("-Zscript");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if toolchain.map_or(false, |it| *it >= RUST_1_75) {
|
||||||
|
cmd.arg("--keep-going");
|
||||||
|
}
|
||||||
|
|
||||||
cmd
|
cmd
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -142,11 +148,9 @@ impl WorkspaceBuildScripts {
|
||||||
config: &CargoConfig,
|
config: &CargoConfig,
|
||||||
workspace: &CargoWorkspace,
|
workspace: &CargoWorkspace,
|
||||||
progress: &dyn Fn(String),
|
progress: &dyn Fn(String),
|
||||||
toolchain: &Option<Version>,
|
toolchain: Option<&Version>,
|
||||||
sysroot: Option<&Sysroot>,
|
sysroot: Option<&Sysroot>,
|
||||||
) -> io::Result<WorkspaceBuildScripts> {
|
) -> io::Result<WorkspaceBuildScripts> {
|
||||||
const RUST_1_75: Version = Version::new(1, 75, 0);
|
|
||||||
|
|
||||||
let current_dir = match &config.invocation_location {
|
let current_dir = match &config.invocation_location {
|
||||||
InvocationLocation::Root(root) if config.run_build_script_command.is_some() => {
|
InvocationLocation::Root(root) if config.run_build_script_command.is_some() => {
|
||||||
root.as_path()
|
root.as_path()
|
||||||
|
@ -156,11 +160,13 @@ impl WorkspaceBuildScripts {
|
||||||
.as_ref();
|
.as_ref();
|
||||||
|
|
||||||
let allowed_features = workspace.workspace_features();
|
let allowed_features = workspace.workspace_features();
|
||||||
let mut cmd =
|
let cmd = Self::build_command(
|
||||||
Self::build_command(config, &allowed_features, workspace.manifest_path(), sysroot)?;
|
config,
|
||||||
if toolchain.as_ref().map_or(false, |it| *it >= RUST_1_75) {
|
&allowed_features,
|
||||||
cmd.args(["--keep-going"]);
|
workspace.manifest_path(),
|
||||||
}
|
toolchain,
|
||||||
|
sysroot,
|
||||||
|
)?;
|
||||||
Self::run_per_ws(cmd, workspace, current_dir, progress)
|
Self::run_per_ws(cmd, workspace, current_dir, progress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +195,7 @@ impl WorkspaceBuildScripts {
|
||||||
// This is not gonna be used anyways, so just construct a dummy here
|
// This is not gonna be used anyways, so just construct a dummy here
|
||||||
&ManifestPath::try_from(workspace_root.clone()).unwrap(),
|
&ManifestPath::try_from(workspace_root.clone()).unwrap(),
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
)?;
|
)?;
|
||||||
// NB: Cargo.toml could have been modified between `cargo metadata` and
|
// NB: Cargo.toml could have been modified between `cargo metadata` and
|
||||||
// `cargo check`. We shouldn't assume that package ids we see here are
|
// `cargo check`. We shouldn't assume that package ids we see here are
|
||||||
|
|
|
@ -488,7 +488,7 @@ impl ProjectWorkspace {
|
||||||
config,
|
config,
|
||||||
cargo,
|
cargo,
|
||||||
progress,
|
progress,
|
||||||
&self.toolchain,
|
self.toolchain.as_ref(),
|
||||||
self.sysroot.as_ref().ok(),
|
self.sysroot.as_ref().ok(),
|
||||||
)
|
)
|
||||||
.with_context(|| {
|
.with_context(|| {
|
||||||
|
|
Loading…
Reference in a new issue