about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2017-02-04 20:10:29 -0500
committerJorge Aparicio <japaricious@gmail.com>2017-02-08 18:51:43 -0500
commit22097e6827b726f517e94c31df0728b481f57245 (patch)
treea4ba3c5776813f2e961a04cb2ea67858829624bd
parent775a93646cb6db5affff24f2260fb60a7723deba (diff)
downloadrust-22097e6827b726f517e94c31df0728b481f57245.tar.gz
rust-22097e6827b726f517e94c31df0728b481f57245.zip
use helper function in the rebuild logic of the rustc_*san crates
-rw-r--r--src/Cargo.lock4
-rw-r--r--src/librustc_asan/Cargo.toml1
-rw-r--r--src/librustc_asan/build.rs19
-rw-r--r--src/librustc_lsan/Cargo.toml1
-rw-r--r--src/librustc_lsan/build.rs19
-rw-r--r--src/librustc_msan/Cargo.toml1
-rw-r--r--src/librustc_msan/build.rs19
-rw-r--r--src/librustc_tsan/Cargo.toml1
-rw-r--r--src/librustc_tsan/build.rs19
9 files changed, 24 insertions, 60 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 8e987ba3b7f..c1222dc444a 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -273,6 +273,7 @@ name = "rustc_asan"
 version = "0.0.0"
 dependencies = [
  "alloc_system 0.0.0",
+ "build_helper 0.1.0",
  "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
@@ -415,6 +416,7 @@ name = "rustc_lsan"
 version = "0.0.0"
 dependencies = [
  "alloc_system 0.0.0",
+ "build_helper 0.1.0",
  "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
@@ -458,6 +460,7 @@ name = "rustc_msan"
 version = "0.0.0"
 dependencies = [
  "alloc_system 0.0.0",
+ "build_helper 0.1.0",
  "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
@@ -548,6 +551,7 @@ name = "rustc_tsan"
 version = "0.0.0"
 dependencies = [
  "alloc_system 0.0.0",
+ "build_helper 0.1.0",
  "cmake 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
  "core 0.0.0",
 ]
diff --git a/src/librustc_asan/Cargo.toml b/src/librustc_asan/Cargo.toml
index abbd7cc0966..2d4872b1fc9 100644
--- a/src/librustc_asan/Cargo.toml
+++ b/src/librustc_asan/Cargo.toml
@@ -9,6 +9,7 @@ name = "rustc_asan"
 path = "lib.rs"
 
 [build-dependencies]
+build_helper = { path = "../build_helper" }
 cmake = "0.1.18"
 
 [dependencies]
diff --git a/src/librustc_asan/build.rs b/src/librustc_asan/build.rs
index 3e33efcadb8..015be14bd49 100644
--- a/src/librustc_asan/build.rs
+++ b/src/librustc_asan/build.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate build_helper;
 extern crate cmake;
 
 use std::path::PathBuf;
@@ -29,21 +30,9 @@ fn main() {
                  dst.join("build/lib/linux").display());
         println!("cargo:rustc-link-lib=static=clang_rt.asan-x86_64");
 
-        let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
-        let mut stack = src_dir.join("../compiler-rt")
-            .read_dir()
-            .unwrap()
-            .map(|e| e.unwrap())
-            .filter(|e| &*e.file_name() != ".git")
-            .collect::<Vec<_>>();
-        while let Some(entry) = stack.pop() {
-            let path = entry.path();
-            if entry.file_type().unwrap().is_dir() {
-                stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
-            } else {
-                println!("cargo:rerun-if-changed={}", path.display());
-            }
-        }
+        build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR")
+                .unwrap())
+            .join("../compiler-rt"));
     }
 
     println!("cargo:rerun-if-changed=build.rs");
diff --git a/src/librustc_lsan/Cargo.toml b/src/librustc_lsan/Cargo.toml
index ac53f3fe73a..bc1f2ead768 100644
--- a/src/librustc_lsan/Cargo.toml
+++ b/src/librustc_lsan/Cargo.toml
@@ -9,6 +9,7 @@ name = "rustc_lsan"
 path = "lib.rs"
 
 [build-dependencies]
+build_helper = { path = "../build_helper" }
 cmake = "0.1.18"
 
 [dependencies]
diff --git a/src/librustc_lsan/build.rs b/src/librustc_lsan/build.rs
index f13928d2bd4..5773777d1f8 100644
--- a/src/librustc_lsan/build.rs
+++ b/src/librustc_lsan/build.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate build_helper;
 extern crate cmake;
 
 use std::path::PathBuf;
@@ -29,21 +30,9 @@ fn main() {
                  dst.join("build/lib/linux").display());
         println!("cargo:rustc-link-lib=static=clang_rt.lsan-x86_64");
 
-        let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
-        let mut stack = src_dir.join("../compiler-rt")
-            .read_dir()
-            .unwrap()
-            .map(|e| e.unwrap())
-            .filter(|e| &*e.file_name() != ".git")
-            .collect::<Vec<_>>();
-        while let Some(entry) = stack.pop() {
-            let path = entry.path();
-            if entry.file_type().unwrap().is_dir() {
-                stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
-            } else {
-                println!("cargo:rerun-if-changed={}", path.display());
-            }
-        }
+        build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR")
+                .unwrap())
+            .join("../compiler-rt"));
     }
 
     println!("cargo:rerun-if-changed=build.rs");
diff --git a/src/librustc_msan/Cargo.toml b/src/librustc_msan/Cargo.toml
index 628746ac232..45cc6b9839f 100644
--- a/src/librustc_msan/Cargo.toml
+++ b/src/librustc_msan/Cargo.toml
@@ -9,6 +9,7 @@ name = "rustc_msan"
 path = "lib.rs"
 
 [build-dependencies]
+build_helper = { path = "../build_helper" }
 cmake = "0.1.18"
 
 [dependencies]
diff --git a/src/librustc_msan/build.rs b/src/librustc_msan/build.rs
index bf630c7844a..7a4c8f70739 100644
--- a/src/librustc_msan/build.rs
+++ b/src/librustc_msan/build.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate build_helper;
 extern crate cmake;
 
 use std::path::PathBuf;
@@ -29,21 +30,9 @@ fn main() {
                  dst.join("build/lib/linux").display());
         println!("cargo:rustc-link-lib=static=clang_rt.msan-x86_64");
 
-        let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
-        let mut stack = src_dir.join("../compiler-rt")
-            .read_dir()
-            .unwrap()
-            .map(|e| e.unwrap())
-            .filter(|e| &*e.file_name() != ".git")
-            .collect::<Vec<_>>();
-        while let Some(entry) = stack.pop() {
-            let path = entry.path();
-            if entry.file_type().unwrap().is_dir() {
-                stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
-            } else {
-                println!("cargo:rerun-if-changed={}", path.display());
-            }
-        }
+        build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR")
+                .unwrap())
+            .join("../compiler-rt"));
     }
 
     println!("cargo:rerun-if-changed=build.rs");
diff --git a/src/librustc_tsan/Cargo.toml b/src/librustc_tsan/Cargo.toml
index 2af0ae3f734..66d6236361e 100644
--- a/src/librustc_tsan/Cargo.toml
+++ b/src/librustc_tsan/Cargo.toml
@@ -9,6 +9,7 @@ name = "rustc_tsan"
 path = "lib.rs"
 
 [build-dependencies]
+build_helper = { path = "../build_helper" }
 cmake = "0.1.18"
 
 [dependencies]
diff --git a/src/librustc_tsan/build.rs b/src/librustc_tsan/build.rs
index 2ba5866ab9d..84326ae8a71 100644
--- a/src/librustc_tsan/build.rs
+++ b/src/librustc_tsan/build.rs
@@ -8,6 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+extern crate build_helper;
 extern crate cmake;
 
 use std::path::PathBuf;
@@ -29,21 +30,9 @@ fn main() {
                  dst.join("build/lib/linux").display());
         println!("cargo:rustc-link-lib=static=clang_rt.tsan-x86_64");
 
-        let src_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
-        let mut stack = src_dir.join("../compiler-rt")
-            .read_dir()
-            .unwrap()
-            .map(|e| e.unwrap())
-            .filter(|e| &*e.file_name() != ".git")
-            .collect::<Vec<_>>();
-        while let Some(entry) = stack.pop() {
-            let path = entry.path();
-            if entry.file_type().unwrap().is_dir() {
-                stack.extend(path.read_dir().unwrap().map(|e| e.unwrap()));
-            } else {
-                println!("cargo:rerun-if-changed={}", path.display());
-            }
-        }
+        build_helper::rerun_if_changed_anything_in_dir(&PathBuf::from(env::var("CARGO_MANIFEST_DIR")
+                .unwrap())
+            .join("../compiler-rt"));
     }
 
     println!("cargo:rerun-if-changed=build.rs");