Report which required build-time environment variable is not set

This commit is contained in:
Jake Goulding 2016-09-25 11:59:12 -04:00
parent 2d1d4d1994
commit cc8727e675
7 changed files with 19 additions and 19 deletions

View file

@ -55,10 +55,10 @@ fn main() {
} else {
("RUSTC_REAL", "RUSTC_LIBDIR")
};
let stage = env::var("RUSTC_STAGE").unwrap();
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
let rustc = env::var_os(rustc).unwrap();
let libdir = env::var_os(libdir).unwrap();
let rustc = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc));
let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir));
let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));
@ -71,7 +71,7 @@ fn main() {
if let Some(target) = target {
// The stage0 compiler has a special sysroot distinct from what we
// actually downloaded, so we just always pass the `--sysroot` option.
cmd.arg("--sysroot").arg(env::var_os("RUSTC_SYSROOT").unwrap());
cmd.arg("--sysroot").arg(env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"));
// When we build Rust dylibs they're all intended for intermediate
// usage, so make sure we pass the -Cprefer-dynamic flag instead of

View file

@ -20,15 +20,16 @@ use std::path::PathBuf;
fn main() {
let args = env::args_os().skip(1).collect::<Vec<_>>();
let rustdoc = env::var_os("RUSTDOC_REAL").unwrap();
let libdir = env::var_os("RUSTC_LIBDIR").unwrap();
let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set");
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));
let mut cmd = Command::new(rustdoc);
cmd.args(&args)
.arg("--cfg").arg(format!("stage{}", env::var("RUSTC_STAGE").unwrap()))
.arg("--cfg").arg(format!("stage{}", stage))
.arg("--cfg").arg("dox")
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());
@ -37,4 +38,3 @@ fn main() {
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
})
}

View file

@ -22,8 +22,8 @@ fn main() {
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs");
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let host = env::var("HOST").expect("HOST was not set");
let build_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let src_dir = env::current_dir().unwrap();
@ -140,7 +140,7 @@ fn main() {
.current_dir(&build_dir)
.arg("build_lib_static")
.arg("-j")
.arg(env::var("NUM_JOBS").unwrap()));
.arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));
if target.contains("windows") {
println!("cargo:rustc-link-lib=static=jemalloc");

View file

@ -72,7 +72,7 @@ impl Sources {
}
fn main() {
let target = env::var("TARGET").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let cfg = &mut gcc::Config::new();
if target.contains("msvc") {

View file

@ -20,7 +20,7 @@ use build_helper::output;
fn main() {
println!("cargo:rustc-cfg=cargobuild");
let target = env::var("TARGET").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let llvm_config = env::var_os("LLVM_CONFIG")
.map(PathBuf::from)
.unwrap_or_else(|| {
@ -62,8 +62,8 @@ fn main() {
// can't trust all the output of llvm-config becaues it might be targeted
// for the host rather than the target. As a result a bunch of blocks below
// are gated on `if !is_crossed`
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let host = env::var("HOST").expect("HOST was not set");
let is_crossed = target != host;
let optional_components = ["x86", "arm", "aarch64", "mips", "powerpc", "pnacl", "systemz"];

View file

@ -23,8 +23,8 @@ fn main() {
println!("cargo:rustc-cfg=cargobuild");
println!("cargo:rerun-if-changed=build.rs");
let target = env::var("TARGET").unwrap();
let host = env::var("HOST").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
let host = env::var("HOST").expect("HOST was not set");
if cfg!(feature = "backtrace") && !target.contains("apple") && !target.contains("msvc") &&
!target.contains("emscripten") {
build_libbacktrace(&host, &target);
@ -103,5 +103,5 @@ fn build_libbacktrace(host: &str, target: &str) {
run(Command::new("make")
.current_dir(&build_dir)
.arg(format!("INCDIR={}", src_dir.display()))
.arg("-j").arg(env::var("NUM_JOBS").unwrap()));
.arg("-j").arg(env::var("NUM_JOBS").expect("NUM_JOBS was not set")));
}

View file

@ -13,7 +13,7 @@ use std::env;
fn main() {
println!("cargo:rustc-cfg=cargobuild");
let target = env::var("TARGET").unwrap();
let target = env::var("TARGET").expect("TARGET was not set");
if target.contains("linux") {
if target.contains("musl") && !target.contains("mips") {