Skip to content

Commit

Permalink
use helper function in the rebuild logic of the rustc_*san crates
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed Feb 8, 2017
1 parent 775a936 commit 22097e6
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 60 deletions.
4 changes: 4 additions & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/librustc_asan/Cargo.toml
Expand Up @@ -9,6 +9,7 @@ name = "rustc_asan"
path = "lib.rs"

[build-dependencies]
build_helper = { path = "../build_helper" }
cmake = "0.1.18"

[dependencies]
Expand Down
19 changes: 4 additions & 15 deletions src/librustc_asan/build.rs
Expand Up @@ -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;
Expand All @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/librustc_lsan/Cargo.toml
Expand Up @@ -9,6 +9,7 @@ name = "rustc_lsan"
path = "lib.rs"

[build-dependencies]
build_helper = { path = "../build_helper" }
cmake = "0.1.18"

[dependencies]
Expand Down
19 changes: 4 additions & 15 deletions src/librustc_lsan/build.rs
Expand Up @@ -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;
Expand All @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/librustc_msan/Cargo.toml
Expand Up @@ -9,6 +9,7 @@ name = "rustc_msan"
path = "lib.rs"

[build-dependencies]
build_helper = { path = "../build_helper" }
cmake = "0.1.18"

[dependencies]
Expand Down
19 changes: 4 additions & 15 deletions src/librustc_msan/build.rs
Expand Up @@ -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;
Expand All @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/librustc_tsan/Cargo.toml
Expand Up @@ -9,6 +9,7 @@ name = "rustc_tsan"
path = "lib.rs"

[build-dependencies]
build_helper = { path = "../build_helper" }
cmake = "0.1.18"

[dependencies]
Expand Down
19 changes: 4 additions & 15 deletions src/librustc_tsan/build.rs
Expand Up @@ -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;
Expand All @@ -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");
Expand Down

0 comments on commit 22097e6

Please sign in to comment.