1
Fork 0

Allow building and testing without rustup

This can be done by installing the nightly specified in
rust-toolchain.toml and then pointing the CARGO, RUSTC and RUSTDOC env
vars to the right executables.
This commit is contained in:
bjorn3 2023-02-13 10:11:45 +00:00
parent 22befab611
commit a2f720d9fe
9 changed files with 78 additions and 18 deletions

View file

@ -30,14 +30,19 @@ fn main() {
}
args.extend(passed_args);
// Ensure that the right toolchain is used
env::set_var("RUSTUP_TOOLCHAIN", env!("TOOLCHAIN_NAME"));
let rustdoc = if let Some(rustdoc) = option_env!("RUSTDOC") {
rustdoc
} else {
// Ensure that the right toolchain is used
env::set_var("RUSTUP_TOOLCHAIN", option_env!("TOOLCHAIN_NAME").expect("TOOLCHAIN_NAME"));
"rustdoc"
};
#[cfg(unix)]
panic!("Failed to spawn rustdoc: {}", Command::new("rustdoc").args(args).exec());
panic!("Failed to spawn rustdoc: {}", Command::new(rustdoc).args(args).exec());
#[cfg(not(unix))]
std::process::exit(
Command::new("rustdoc").args(args).spawn().unwrap().wait().unwrap().code().unwrap_or(1),
Command::new(rustdoc).args(args).spawn().unwrap().wait().unwrap().code().unwrap_or(1),
);
}