diff options
| author | bors <bors@rust-lang.org> | 2016-12-16 07:26:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-12-16 07:26:41 +0000 |
| commit | d250169cb5a96481a3e7c8f9fe05de49f60e5ae5 (patch) | |
| tree | 59a8e128fbe416b32d364585b9d316878f2d4abd /src/bootstrap | |
| parent | c6d8ab09e39bacae2c008995bbb669442115517f (diff) | |
| parent | 96a5fc76dcce1bd6669a9e288721ee6aad521096 (diff) | |
Auto merge of #38359 - alexcrichton:sccache, r=brson
rustbuild: Add sccache support This commit adds support for sccache, a ccache-like compiler which works on MSVC and stores results into an S3 bucket. This also switches over all Travis and AppVeyor automation to using sccache to ensure a shared and unified cache over time which can be shared across builders. The support for sccache manifests as a new `--enable-sccache` option which instructs us to configure LLVM differently to use a 'sccache' binary instead of a 'ccache' binary. All docker images for Travis builds are updated to download Mozilla's tooltool builds of sccache onto various containers and systems. Additionally a new `rust-lang-ci-sccache` bucket is configured to hold all of our ccache goodies. --- Note that this does not currently change Windows [due to previously written up issues](https://github.com/rust-lang/rust/issues/38119#issuecomment-266631585). Despite that, however, I was curious to get timings for the builds on Travis to see what ranges we're working with. As a result, this is a WIP PR I'm using to gauge build times and such.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/config.rs | 33 | ||||
| -rw-r--r-- | src/bootstrap/config.toml.example | 2 | ||||
| -rw-r--r-- | src/bootstrap/native.rs | 6 | ||||
| -rw-r--r-- | src/bootstrap/sanity.rs | 4 |
4 files changed, 38 insertions, 7 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 60f65f62300..b8abcb28c4e 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -38,7 +38,7 @@ use util::push_exe_path; /// `src/bootstrap/config.toml.example`. #[derive(Default)] pub struct Config { - pub ccache: bool, + pub ccache: Option<String>, pub ninja: bool, pub verbose: bool, pub submodules: bool, @@ -138,7 +138,7 @@ struct Build { /// TOML representation of how the LLVM build is configured. #[derive(RustcDecodable, Default)] struct Llvm { - ccache: Option<bool>, + ccache: Option<StringOrBool>, ninja: Option<bool>, assertions: Option<bool>, optimize: Option<bool>, @@ -147,6 +147,18 @@ struct Llvm { static_libstdcpp: Option<bool>, } +#[derive(RustcDecodable)] +enum StringOrBool { + String(String), + Bool(bool), +} + +impl Default for StringOrBool { + fn default() -> StringOrBool { + StringOrBool::Bool(false) + } +} + /// TOML representation of how the Rust build is configured. #[derive(RustcDecodable, Default)] struct Rust { @@ -247,7 +259,15 @@ impl Config { set(&mut config.vendor, build.vendor); if let Some(ref llvm) = toml.llvm { - set(&mut config.ccache, llvm.ccache); + match llvm.ccache { + Some(StringOrBool::String(ref s)) => { + config.ccache = Some(s.to_string()) + } + Some(StringOrBool::Bool(true)) => { + config.ccache = Some("ccache".to_string()); + } + Some(StringOrBool::Bool(false)) | None => {} + } set(&mut config.ninja, llvm.ninja); set(&mut config.llvm_assertions, llvm.assertions); set(&mut config.llvm_optimize, llvm.optimize); @@ -338,7 +358,6 @@ impl Config { } check! { - ("CCACHE", self.ccache), ("MANAGE_SUBMODULES", self.submodules), ("COMPILER_DOCS", self.compiler_docs), ("DOCS", self.docs), @@ -475,6 +494,12 @@ impl Config { let path = parse_configure_path(value); self.python = Some(path); } + "CFG_ENABLE_CCACHE" if value == "1" => { + self.ccache = Some("ccache".to_string()); + } + "CFG_ENABLE_SCCACHE" if value == "1" => { + self.ccache = Some("sccache".to_string()); + } _ => {} } } diff --git a/src/bootstrap/config.toml.example b/src/bootstrap/config.toml.example index b6774b3af20..9e50e71bf7d 100644 --- a/src/bootstrap/config.toml.example +++ b/src/bootstrap/config.toml.example @@ -25,6 +25,8 @@ # Indicates whether ccache is used when building LLVM #ccache = false +# or alternatively ... +#ccache = "/path/to/ccache" # If an external LLVM root is specified, we automatically check the version by # default to make sure it's within the range that we're expecting, but setting diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index ffa3fe1cbf2..6ba6b8e6c86 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -109,10 +109,10 @@ pub fn llvm(build: &Build, target: &str) { // MSVC handles compiler business itself if !target.contains("msvc") { - if build.config.ccache { - cfg.define("CMAKE_C_COMPILER", "ccache") + if let Some(ref ccache) = build.config.ccache { + cfg.define("CMAKE_C_COMPILER", ccache) .define("CMAKE_C_COMPILER_ARG1", build.cc(target)) - .define("CMAKE_CXX_COMPILER", "ccache") + .define("CMAKE_CXX_COMPILER", ccache) .define("CMAKE_CXX_COMPILER_ARG1", build.cxx(target)); } else { cfg.define("CMAKE_C_COMPILER", build.cc(target)) diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index f3fe22698bb..2992099687d 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -223,4 +223,8 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake if build.lldb_version.is_some() { build.lldb_python_dir = run(Command::new("lldb").arg("-P")).ok(); } + + if let Some(ref s) = build.config.ccache { + need_cmd(s.as_ref()); + } } |
