use helper function in the rebuild logic of the rustc_*san crates

This commit is contained in:
Jorge Aparicio 2017-02-04 20:10:29 -05:00
parent 775a93646c
commit 22097e6827
9 changed files with 24 additions and 60 deletions

4
src/Cargo.lock generated
View File

@ -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",
]

View File

@ -9,6 +9,7 @@ name = "rustc_asan"
path = "lib.rs"
[build-dependencies]
build_helper = { path = "../build_helper" }
cmake = "0.1.18"
[dependencies]

View File

@ -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");

View File

@ -9,6 +9,7 @@ name = "rustc_lsan"
path = "lib.rs"
[build-dependencies]
build_helper = { path = "../build_helper" }
cmake = "0.1.18"
[dependencies]

View File

@ -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");

View File

@ -9,6 +9,7 @@ name = "rustc_msan"
path = "lib.rs"
[build-dependencies]
build_helper = { path = "../build_helper" }
cmake = "0.1.18"
[dependencies]

View File

@ -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");

View File

@ -9,6 +9,7 @@ name = "rustc_tsan"
path = "lib.rs"
[build-dependencies]
build_helper = { path = "../build_helper" }
cmake = "0.1.18"
[dependencies]

View File

@ -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");