mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Re-try build script building with --keep-going
This commit is contained in:
parent
950de7c3c3
commit
25d4fbe9da
1 changed files with 24 additions and 11 deletions
|
@ -39,7 +39,7 @@ pub(crate) struct BuildScriptOutput {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WorkspaceBuildScripts {
|
impl WorkspaceBuildScripts {
|
||||||
fn build_command(config: &CargoConfig, toolchain: &Option<Version>) -> Command {
|
fn build_command(config: &CargoConfig) -> Command {
|
||||||
if let Some([program, args @ ..]) = config.run_build_script_command.as_deref() {
|
if let Some([program, args @ ..]) = config.run_build_script_command.as_deref() {
|
||||||
let mut cmd = Command::new(program);
|
let mut cmd = Command::new(program);
|
||||||
cmd.args(args);
|
cmd.args(args);
|
||||||
|
@ -71,15 +71,6 @@ impl WorkspaceBuildScripts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const RUST_1_62: Version = Version::new(1, 62, 0);
|
|
||||||
|
|
||||||
match toolchain {
|
|
||||||
Some(v) if v >= &RUST_1_62 => {
|
|
||||||
cmd.args(&["-Z", "unstable-options", "--keep-going"]).env("RUSTC_BOOTSTRAP", "1");
|
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd
|
cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +80,30 @@ impl WorkspaceBuildScripts {
|
||||||
progress: &dyn Fn(String),
|
progress: &dyn Fn(String),
|
||||||
toolchain: &Option<Version>,
|
toolchain: &Option<Version>,
|
||||||
) -> io::Result<WorkspaceBuildScripts> {
|
) -> io::Result<WorkspaceBuildScripts> {
|
||||||
let mut cmd = Self::build_command(config, toolchain);
|
const RUST_1_62: Version = Version::new(1, 62, 0);
|
||||||
|
|
||||||
|
match Self::run_(Self::build_command(config), config, workspace, progress) {
|
||||||
|
Ok(WorkspaceBuildScripts { error: Some(error), .. })
|
||||||
|
if toolchain.as_ref().map_or(false, |it| *it >= RUST_1_62) =>
|
||||||
|
{
|
||||||
|
// building build scripts failed, attempt to build with --keep-going so
|
||||||
|
// that we potentially get more build data
|
||||||
|
let mut cmd = Self::build_command(config);
|
||||||
|
cmd.args(&["-Z", "unstable-options", "--keep-going"]).env("RUSTC_BOOTSTRAP", "1");
|
||||||
|
let mut res = Self::run_(cmd, config, workspace, progress)?;
|
||||||
|
res.error = Some(error);
|
||||||
|
Ok(res)
|
||||||
|
}
|
||||||
|
res => res,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn run_(
|
||||||
|
mut cmd: Command,
|
||||||
|
config: &CargoConfig,
|
||||||
|
workspace: &CargoWorkspace,
|
||||||
|
progress: &dyn Fn(String),
|
||||||
|
) -> io::Result<WorkspaceBuildScripts> {
|
||||||
if config.wrap_rustc_in_build_scripts {
|
if config.wrap_rustc_in_build_scripts {
|
||||||
// Setup RUSTC_WRAPPER to point to `rust-analyzer` binary itself. We use
|
// Setup RUSTC_WRAPPER to point to `rust-analyzer` binary itself. We use
|
||||||
// that to compile only proc macros and build scripts during the initial
|
// that to compile only proc macros and build scripts during the initial
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue