diff options
| author | bors <bors@rust-lang.org> | 2017-07-25 16:13:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-07-25 16:13:16 +0000 |
| commit | c417ee9ae8c30ac307c58591da46cf62e91caac1 (patch) | |
| tree | 8de4b9605fb1ef3b5ddb0ff1ff8277b6981b7f3a /src/bootstrap | |
| parent | a643bdc681120446e3f5b787ae009bfa6b5f01b6 (diff) | |
| parent | 9010567dcc0aba772525841aee67c030ea3450c6 (diff) | |
| download | rust-c417ee9ae8c30ac307c58591da46cf62e91caac1.tar.gz rust-c417ee9ae8c30ac307c58591da46cf62e91caac1.zip | |
Auto merge of #43320 - alexcrichton:new-bootstrap, r=Mark-Simulacrum
Bump master to 1.21.0 This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/channel.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/check.rs | 68 | ||||
| -rw-r--r-- | src/bootstrap/compile.rs | 237 | ||||
| -rw-r--r-- | src/bootstrap/doc.rs | 11 | ||||
| -rw-r--r-- | src/bootstrap/tool.rs | 2 |
5 files changed, 170 insertions, 150 deletions
diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 1153acfa57d..beefaeab90b 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -23,7 +23,7 @@ use build_helper::output; use Build; // The version number -pub const CFG_RELEASE_NUM: &str = "1.20.0"; +pub const CFG_RELEASE_NUM: &str = "1.21.0"; // An optional number to put after the label, e.g. '.2' -> '-beta.2' // Be sure to make this starts with a dot to conform to semver pre-release diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 472bfafc20a..d2e181f94c6 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -25,15 +25,14 @@ use std::io::Read; use build_helper::{self, output}; -use {Build, Mode}; -use dist; -use util::{self, dylib_path, dylib_path_var}; - +use builder::{Kind, RunConfig, ShouldRun, Builder, Compiler, Step}; +use cache::{INTERNER, Interned}; use compile; +use dist; use native; -use builder::{Kind, RunConfig, ShouldRun, Builder, Compiler, Step}; use tool::{self, Tool}; -use cache::{INTERNER, Interned}; +use util::{self, dylib_path, dylib_path_var}; +use {Build, Mode}; const ADB_TEST_DIR: &str = "/data/tmp/work"; @@ -963,16 +962,31 @@ impl Step for Crate { builder.ensure(compile::Test { compiler, target }); builder.ensure(RemoteCopyLibs { compiler, target }); - let (name, path, features, root) = match mode { + + // If we're not doing a full bootstrap but we're testing a stage2 version of + // libstd, then what we're actually testing is the libstd produced in + // stage1. Reflect that here by updating the compiler that we're working + // with automatically. + let compiler = if build.force_use_stage1(compiler, target) { + builder.compiler(1, compiler.host) + } else { + compiler.clone() + }; + + let mut cargo = builder.cargo(compiler, mode, target, test_kind.subcommand()); + let (name, root) = match mode { Mode::Libstd => { - ("libstd", "src/libstd", build.std_features(), "std") + compile::std_cargo(build, &compiler, target, &mut cargo); + ("libstd", "std") } Mode::Libtest => { - ("libtest", "src/libtest", String::new(), "test") + compile::test_cargo(build, &compiler, target, &mut cargo); + ("libtest", "test") } Mode::Librustc => { builder.ensure(compile::Rustc { compiler, target }); - ("librustc", "src/rustc", build.rustc_features(), "rustc-main") + compile::rustc_cargo(build, &compiler, target, &mut cargo); + ("librustc", "rustc-main") } _ => panic!("can only test libraries"), }; @@ -983,25 +997,11 @@ impl Step for Crate { println!("{} {} stage{} ({} -> {})", test_kind, name, compiler.stage, &compiler.host, target); - // If we're not doing a full bootstrap but we're testing a stage2 version of - // libstd, then what we're actually testing is the libstd produced in - // stage1. Reflect that here by updating the compiler that we're working - // with automatically. - let compiler = if build.force_use_stage1(compiler, target) { - builder.compiler(1, compiler.host) - } else { - compiler.clone() - }; - // Build up the base `cargo test` command. // // Pass in some standard flags then iterate over the graph we've discovered // in `cargo metadata` with the maps above and figure out what `-p` // arguments need to get passed. - let mut cargo = builder.cargo(compiler, mode, target, test_kind.subcommand()); - cargo.arg("--manifest-path") - .arg(build.src.join(path).join("Cargo.toml")) - .arg("--features").arg(features); if test_kind.subcommand() == "test" && !build.fail_fast { cargo.arg("--no-fail-fast"); } @@ -1014,16 +1014,18 @@ impl Step for Crate { let mut visited = HashSet::new(); let mut next = vec![root]; while let Some(name) = next.pop() { - // Right now jemalloc is our only target-specific crate in the - // sense that it's not present on all platforms. Custom skip it - // here for now, but if we add more this probably wants to get - // more generalized. + // Right now jemalloc and the sanitizer crates are + // target-specific crate in the sense that it's not present + // on all platforms. Custom skip it here for now, but if we + // add more this probably wants to get more generalized. // - // Also skip `build_helper` as it's not compiled normally for - // target during the bootstrap and it's just meant to be a - // helper crate, not tested. If it leaks through then it ends up - // messing with various mtime calculations and such. - if !name.contains("jemalloc") && *name != *"build_helper" { + // Also skip `build_helper` as it's not compiled normally + // for target during the bootstrap and it's just meant to be + // a helper crate, not tested. If it leaks through then it + // ends up messing with various mtime calculations and such. + if !name.contains("jemalloc") && + *name != *"build_helper" && + !(name.starts_with("rustc_") && name.ends_with("san")) { cargo.arg("-p").arg(&format!("{}:0.0.0", name)); } for dep in build.crates[&name].deps.iter() { diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index cbe2be2d26a..2e808c65684 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -91,47 +91,7 @@ impl Step for Std { let out_dir = build.cargo_out(compiler, Mode::Libstd, target); build.clear_if_dirty(&out_dir, &builder.rustc(compiler)); let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build"); - let mut features = build.std_features(); - - if let Some(target) = env::var_os("MACOSX_STD_DEPLOYMENT_TARGET") { - cargo.env("MACOSX_DEPLOYMENT_TARGET", target); - } - - // When doing a local rebuild we tell cargo that we're stage1 rather than - // stage0. This works fine if the local rust and being-built rust have the - // same view of what the default allocator is, but fails otherwise. Since - // we don't have a way to express an allocator preference yet, work - // around the issue in the case of a local rebuild with jemalloc disabled. - if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc { - features.push_str(" force_alloc_system"); - } - - if compiler.stage != 0 && build.config.sanitizers { - // This variable is used by the sanitizer runtime crates, e.g. - // rustc_lsan, to build the sanitizer runtime from C code - // When this variable is missing, those crates won't compile the C code, - // so we don't set this variable during stage0 where llvm-config is - // missing - // We also only build the runtimes when --enable-sanitizers (or its - // config.toml equivalent) is used - cargo.env("LLVM_CONFIG", build.llvm_config(target)); - } - - cargo.arg("--features").arg(features) - .arg("--manifest-path") - .arg(build.src.join("src/libstd/Cargo.toml")); - - if let Some(target) = build.config.target_config.get(&target) { - if let Some(ref jemalloc) = target.jemalloc { - cargo.env("JEMALLOC_OVERRIDE", jemalloc); - } - } - if target.contains("musl") { - if let Some(p) = build.musl_root(target) { - cargo.env("MUSL_ROOT", p); - } - } - + std_cargo(build, &compiler, target, &mut cargo); run_cargo(build, &mut cargo, &libstd_stamp(build, compiler, target)); @@ -144,6 +104,53 @@ impl Step for Std { } } +/// Configure cargo to compile the standard library, adding appropriate env vars +/// and such. +pub fn std_cargo(build: &Build, + compiler: &Compiler, + target: Interned<String>, + cargo: &mut Command) { + let mut features = build.std_features(); + + if let Some(target) = env::var_os("MACOSX_STD_DEPLOYMENT_TARGET") { + cargo.env("MACOSX_DEPLOYMENT_TARGET", target); + } + + // When doing a local rebuild we tell cargo that we're stage1 rather than + // stage0. This works fine if the local rust and being-built rust have the + // same view of what the default allocator is, but fails otherwise. Since + // we don't have a way to express an allocator preference yet, work + // around the issue in the case of a local rebuild with jemalloc disabled. + if compiler.stage == 0 && build.local_rebuild && !build.config.use_jemalloc { + features.push_str(" force_alloc_system"); + } + + if compiler.stage != 0 && build.config.sanitizers { + // This variable is used by the sanitizer runtime crates, e.g. + // rustc_lsan, to build the sanitizer runtime from C code + // When this variable is missing, those crates won't compile the C code, + // so we don't set this variable during stage0 where llvm-config is + // missing + // We also only build the runtimes when --enable-sanitizers (or its + // config.toml equivalent) is used + cargo.env("LLVM_CONFIG", build.llvm_config(target)); + } + + cargo.arg("--features").arg(features) + .arg("--manifest-path") + .arg(build.src.join("src/libstd/Cargo.toml")); + + if let Some(target) = build.config.target_config.get(&target) { + if let Some(ref jemalloc) = target.jemalloc { + cargo.env("JEMALLOC_OVERRIDE", jemalloc); + } + } + if target.contains("musl") { + if let Some(p) = build.musl_root(target) { + cargo.env("MUSL_ROOT", p); + } + } +} #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] struct StdLink { @@ -329,11 +336,7 @@ impl Step for Test { let out_dir = build.cargo_out(compiler, Mode::Libtest, target); build.clear_if_dirty(&out_dir, &libstd_stamp(build, compiler, target)); let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "build"); - if let Some(target) = env::var_os("MACOSX_STD_DEPLOYMENT_TARGET") { - cargo.env("MACOSX_DEPLOYMENT_TARGET", target); - } - cargo.arg("--manifest-path") - .arg(build.src.join("src/libtest/Cargo.toml")); + test_cargo(build, &compiler, target, &mut cargo); run_cargo(build, &mut cargo, &libtest_stamp(build, compiler, target)); @@ -346,6 +349,18 @@ impl Step for Test { } } +/// Same as `std_cargo`, but for libtest +pub fn test_cargo(build: &Build, + _compiler: &Compiler, + _target: Interned<String>, + cargo: &mut Command) { + if let Some(target) = env::var_os("MACOSX_STD_DEPLOYMENT_TARGET") { + cargo.env("MACOSX_DEPLOYMENT_TARGET", target); + } + cargo.arg("--manifest-path") + .arg(build.src.join("src/libtest/Cargo.toml")); +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct TestLink { pub compiler: Compiler, @@ -443,67 +458,7 @@ impl Step for Rustc { build.clear_if_dirty(&out_dir, &libtest_stamp(build, compiler, target)); let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "build"); - cargo.arg("--features").arg(build.rustc_features()) - .arg("--manifest-path") - .arg(build.src.join("src/rustc/Cargo.toml")); - - // Set some configuration variables picked up by build scripts and - // the compiler alike - cargo.env("CFG_RELEASE", build.rust_release()) - .env("CFG_RELEASE_CHANNEL", &build.config.channel) - .env("CFG_VERSION", build.rust_version()) - .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default()); - - if compiler.stage == 0 { - cargo.env("CFG_LIBDIR_RELATIVE", "lib"); - } else { - let libdir_relative = - build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib")); - cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); - } - - // If we're not building a compiler with debugging information then remove - // these two env vars which would be set otherwise. - if build.config.rust_debuginfo_only_std { - cargo.env_remove("RUSTC_DEBUGINFO"); - cargo.env_remove("RUSTC_DEBUGINFO_LINES"); - } - - if let Some(ref ver_date) = build.rust_info.commit_date() { - cargo.env("CFG_VER_DATE", ver_date); - } - if let Some(ref ver_hash) = build.rust_info.sha() { - cargo.env("CFG_VER_HASH", ver_hash); - } - if !build.unstable_features() { - cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1"); - } - // Flag that rust llvm is in use - if build.is_rust_llvm(target) { - cargo.env("LLVM_RUSTLLVM", "1"); - } - cargo.env("LLVM_CONFIG", build.llvm_config(target)); - let target_config = build.config.target_config.get(&target); - if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) { - cargo.env("CFG_LLVM_ROOT", s); - } - // Building with a static libstdc++ is only supported on linux right now, - // not for MSVC or macOS - if build.config.llvm_static_stdcpp && - !target.contains("windows") && - !target.contains("apple") { - cargo.env("LLVM_STATIC_STDCPP", - compiler_file(build.cxx(target).unwrap(), "libstdc++.a")); - } - if build.config.llvm_link_shared { - cargo.env("LLVM_LINK_SHARED", "1"); - } - if let Some(ref s) = build.config.rustc_default_linker { - cargo.env("CFG_DEFAULT_LINKER", s); - } - if let Some(ref s) = build.config.rustc_default_ar { - cargo.env("CFG_DEFAULT_AR", s); - } + rustc_cargo(build, &compiler, target, &mut cargo); run_cargo(build, &mut cargo, &librustc_stamp(build, compiler, target)); @@ -516,6 +471,74 @@ impl Step for Rustc { } } +/// Same as `std_cargo`, but for libtest +pub fn rustc_cargo(build: &Build, + compiler: &Compiler, + target: Interned<String>, + cargo: &mut Command) { + cargo.arg("--features").arg(build.rustc_features()) + .arg("--manifest-path") + .arg(build.src.join("src/rustc/Cargo.toml")); + + // Set some configuration variables picked up by build scripts and + // the compiler alike + cargo.env("CFG_RELEASE", build.rust_release()) + .env("CFG_RELEASE_CHANNEL", &build.config.channel) + .env("CFG_VERSION", build.rust_version()) + .env("CFG_PREFIX", build.config.prefix.clone().unwrap_or_default()); + + if compiler.stage == 0 { + cargo.env("CFG_LIBDIR_RELATIVE", "lib"); + } else { + let libdir_relative = + build.config.libdir_relative.clone().unwrap_or(PathBuf::from("lib")); + cargo.env("CFG_LIBDIR_RELATIVE", libdir_relative); + } + + // If we're not building a compiler with debugging information then remove + // these two env vars which would be set otherwise. + if build.config.rust_debuginfo_only_std { + cargo.env_remove("RUSTC_DEBUGINFO"); + cargo.env_remove("RUSTC_DEBUGINFO_LINES"); + } + + if let Some(ref ver_date) = build.rust_info.commit_date() { + cargo.env("CFG_VER_DATE", ver_date); + } + if let Some(ref ver_hash) = build.rust_info.sha() { + cargo.env("CFG_VER_HASH", ver_hash); + } + if !build.unstable_features() { + cargo.env("CFG_DISABLE_UNSTABLE_FEATURES", "1"); + } + // Flag that rust llvm is in use + if build.is_rust_llvm(target) { + cargo.env("LLVM_RUSTLLVM", "1"); + } + cargo.env("LLVM_CONFIG", build.llvm_config(target)); + let target_config = build.config.target_config.get(&target); + if let Some(s) = target_config.and_then(|c| c.llvm_config.as_ref()) { + cargo.env("CFG_LLVM_ROOT", s); + } + // Building with a static libstdc++ is only supported on linux right now, + // not for MSVC or macOS + if build.config.llvm_static_stdcpp && + !target.contains("windows") && + !target.contains("apple") { + cargo.env("LLVM_STATIC_STDCPP", + compiler_file(build.cxx(target).unwrap(), "libstdc++.a")); + } + if build.config.llvm_link_shared { + cargo.env("LLVM_LINK_SHARED", "1"); + } + if let Some(ref s) = build.config.rustc_default_linker { + cargo.env("CFG_DEFAULT_LINKER", s); + } + if let Some(ref s) = build.config.rustc_default_ar { + cargo.env("CFG_DEFAULT_AR", s); + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] struct RustcLink { pub compiler: Compiler, diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 8834fa24d69..249ed2a2223 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -442,9 +442,7 @@ impl Step for Std { t!(symlink_dir_force(&my_out, &out_dir)); let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "doc"); - cargo.arg("--manifest-path") - .arg(build.src.join("src/libstd/Cargo.toml")) - .arg("--features").arg(build.std_features()); + compile::std_cargo(build, &compiler, target, &mut cargo); // We don't want to build docs for internal std dependencies unless // in compiler-docs mode. When not in that mode, we whitelist the crates @@ -520,8 +518,7 @@ impl Step for Test { t!(symlink_dir_force(&my_out, &out_dir)); let mut cargo = builder.cargo(compiler, Mode::Libtest, target, "doc"); - cargo.arg("--manifest-path") - .arg(build.src.join("src/libtest/Cargo.toml")); + compile::test_cargo(build, &compiler, target, &mut cargo); build.run(&mut cargo); cp_r(&my_out, &out); } @@ -582,9 +579,7 @@ impl Step for Rustc { t!(symlink_dir_force(&my_out, &out_dir)); let mut cargo = builder.cargo(compiler, Mode::Librustc, target, "doc"); - cargo.arg("--manifest-path") - .arg(build.src.join("src/rustc/Cargo.toml")) - .arg("--features").arg(build.rustc_features()); + compile::rustc_cargo(build, &compiler, target, &mut cargo); if build.config.compiler_docs { // src/rustc/Cargo.toml contains bin crates called rustc and rustdoc diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index b31d891051c..f32cddbafc3 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -263,7 +263,7 @@ impl Step for Cargo { stage: self.stage, target: self.target, tool: "cargo", - mode: Mode::Libstd, + mode: Mode::Librustc, }) } } |
