diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-10-07 12:26:45 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-10-08 11:11:00 -0700 |
| commit | d17f0b0dd79bbf0cdee8f4b80f91ab53ec5e4328 (patch) | |
| tree | 2bf8c3f99b61f5bbd3085b20d8bf8ac046aa9a0b /src/bootstrap | |
| parent | 4344f147aad2ae8ea9c955642f42c812173feb14 (diff) | |
| download | rust-d17f0b0dd79bbf0cdee8f4b80f91ab53ec5e4328.tar.gz rust-d17f0b0dd79bbf0cdee8f4b80f91ab53ec5e4328.zip | |
rustbuild: Optimize build times slightly
As the entry point for building the Rust compiler, a good user experience hinges on this compiling quickly to get to the meat of the problem. To that end use `#[cfg]`-specific dependencies to avoid building Windows crates on Unix and drop the `regex` crate for now which was easily replacable with some string searching.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/Cargo.toml | 7 | ||||
| -rw-r--r-- | src/bootstrap/dist.rs | 65 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 1 |
3 files changed, 27 insertions, 46 deletions
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index b19545590b9..c9669075438 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -27,9 +27,10 @@ num_cpus = "0.2" toml = "0.1" getopts = "0.2" rustc-serialize = "0.3" -winapi = "0.2" -kernel32-sys = "0.2" gcc = { git = "https://github.com/alexcrichton/gcc-rs" } libc = "0.2" md5 = "0.1" -regex = "0.1.73" + +[target.'cfg(windows)'.dependencies] +winapi = "0.2" +kernel32-sys = "0.2" diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 465abf15750..8676f5cc4a1 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -25,7 +25,6 @@ use std::process::Command; use {Build, Compiler}; use util::{cp_r, libdir, is_dylib, cp_filtered, copy}; -use regex::{RegexSet, quote}; pub fn package_vers(build: &Build) -> &str { match &build.config.channel[..] { @@ -315,49 +314,31 @@ pub fn rust_src(build: &Build) { "mk" ]; - // Exclude paths matching these wildcard expressions - let excludes = [ - // exclude-vcs - "CVS", "RCS", "SCCS", ".git", ".gitignore", ".gitmodules", ".gitattributes", ".cvsignore", - ".svn", ".arch-ids", "{arch}", "=RELEASE-ID", "=meta-update", "=update", ".bzr", - ".bzrignore", ".bzrtags", ".hg", ".hgignore", ".hgrags", "_darcs", - // extensions - "*~", "*.pyc", - // misc - "llvm/test/*/*.ll", - "llvm/test/*/*.td", - "llvm/test/*/*.s", - "llvm/test/*/*/*.ll", - "llvm/test/*/*/*.td", - "llvm/test/*/*/*.s" - ]; - - // Construct a set of regexes for efficiently testing whether paths match one of the above - // expressions. - let regex_set = t!(RegexSet::new( - // This converts a wildcard expression to a regex - excludes.iter().map(|&s| { - // Prefix ensures that matching starts on a path separator boundary - r"^(.*[\\/])?".to_owned() + ( - // Escape the expression to produce a regex matching exactly that string - "e(s) - // Replace slashes with a pattern matching either forward or backslash - .replace(r"/", r"[\\/]") - // Replace wildcards with a pattern matching a single path segment, ie. containing - // no slashes. - .replace(r"\*", r"[^\\/]*") - // Suffix anchors to the end of the path - ) + "$" - }) - )); - - // Create a filter which skips files which match the regex set or contain invalid unicode let filter_fn = move |path: &Path| { - if let Some(path) = path.to_str() { - !regex_set.is_match(path) - } else { - false + let spath = match path.to_str() { + Some(path) => path, + None => return false, + }; + if spath.ends_with("~") || spath.ends_with(".pyc") { + return false } + if spath.contains("llvm/test") || spath.contains("llvm\\test") { + if spath.ends_with(".ll") || + spath.ends_with(".td") || + spath.ends_with(".s") { + return false + } + } + + let excludes = [ + "CVS", "RCS", "SCCS", ".git", ".gitignore", ".gitmodules", + ".gitattributes", ".cvsignore", ".svn", ".arch-ids", "{arch}", + "=RELEASE-ID", "=meta-update", "=update", ".bzr", ".bzrignore", + ".bzrtags", ".hg", ".hgignore", ".hgrags", "_darcs", + ]; + !path.iter() + .map(|s| s.to_str().unwrap()) + .any(|s| excludes.contains(&s)) }; // Copy the directories using our filter diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 9ffc433cd78..12938b8326e 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -26,7 +26,6 @@ extern crate md5; extern crate num_cpus; extern crate rustc_serialize; extern crate toml; -extern crate regex; use std::collections::HashMap; use std::env; |
