Skip to content

Commit

Permalink
Install required toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
ascjones committed Aug 12, 2022
1 parent f4752f0 commit 2edc843
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,34 @@ fn build_and_zip_dylint_driver(
out_dir: PathBuf,
dylint_driver_dst_file: PathBuf,
) -> Result<()> {
const NIGHTLY_TOOLCHAIN: &str = "nightly-2022-06-30";

let mut install_toolchain = Command::new("rustup");
install_toolchain
.args(vec![
"toolchain",
"install",
NIGHTLY_TOOLCHAIN,
"--component",
"llvm-tools-preview",
"rustc-dev",
]);

let child = install_toolchain
// Capture the stdout to return from this function as bytes
.stdout(std::process::Stdio::piped())
.spawn()?;

let output = child.wait_with_output()?;

if !output.status.success() {
anyhow::bail!(
"`{:?}` failed with exit code: {:?}",
install_toolchain,
output.status.code()
);
}

let mut cmd = Command::new("rustup");

let manifest_arg = format!(
Expand All @@ -174,7 +202,7 @@ fn build_and_zip_dylint_driver(
let target_dir = format!("--target-dir={}", out_dir.display());
cmd.args(vec![
"run",
"nightly-2022-06-30",
NIGHTLY_TOOLCHAIN,
"cargo",
"build",
"--release",
Expand Down

0 comments on commit 2edc843

Please sign in to comment.