diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-12-20 11:53:56 -0500 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-12-20 15:32:12 -0500 |
commit | ec76fbccb83605f22bcffead829b28627eb95745 (patch) | |
tree | 95ab38533702736f7afe046d67b26ad79332c1cf | |
parent | 79db3cede2740e3179efae0c01c56588f9b3292c (diff) |
cargo build: skip setup.py if possible
-rw-r--r-- | build.rs | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -20,9 +20,9 @@ fn main() { env::var("PROFILE").unwrap() }; - let gn_out_dir = env::current_dir().unwrap(); - let gn_out_dir = gn_out_dir.join(format!("target/{}", gn_mode)); - let gn_out_dir = normalize_path(gn_out_dir); + let cwd = env::current_dir().unwrap(); + let gn_out_path = cwd.join(format!("target/{}", gn_mode)); + let gn_out_dir = normalize_path(&gn_out_path); // Tell Cargo when to re-run this file. We do this first, so these directives // can take effect even if something goes wrong later in the build process. @@ -76,13 +76,15 @@ fn main() { } } - let status = Command::new("python") - .env("DENO_BUILD_PATH", &gn_out_dir) - .env("DENO_BUILD_MODE", &gn_mode) - .arg("./tools/setup.py") - .status() - .expect("setup.py failed"); - assert!(status.success()); + if !gn_out_path.join("build.ninja").exists() { + let status = Command::new("python") + .env("DENO_BUILD_PATH", &gn_out_dir) + .env("DENO_BUILD_MODE", &gn_mode) + .arg("./tools/setup.py") + .status() + .expect("setup.py failed"); + assert!(status.success()); + } let status = Command::new("python") .env("DENO_BUILD_PATH", &gn_out_dir) |