about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/Cargo.toml7
-rw-r--r--src/bootstrap/dist.rs65
-rw-r--r--src/bootstrap/lib.rs1
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
-                &quote(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;