From b4e15ffb7b05c10ba6b419dac56f60daee66e981 Mon Sep 17 00:00:00 2001 From: Syrus Date: Wed, 24 Jun 2020 17:53:07 -0700 Subject: [PATCH] Fixed continously building build.rs --- Cargo.lock | 10 ++++++++++ Cargo.toml | 1 + build.rs | 8 ++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d534209c27c..5cc2961d206 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -160,6 +160,15 @@ dependencies = [ "serde", ] +[[package]] +name = "build-deps" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f14468960818ce4f3e3553c32d524446687884f8e7af5d3e252331d8a87e43" +dependencies = [ + "glob", +] + [[package]] name = "bumpalo" version = "3.4.0" @@ -2076,6 +2085,7 @@ dependencies = [ "anyhow", "atty", "blake3", + "build-deps", "bytesize", "cfg-if", "colored", diff --git a/Cargo.toml b/Cargo.toml index f01b0e011b1..a2c743e766c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,6 +56,7 @@ members = [ [build-dependencies] test-generator = { path = "tests/lib/test-generator" } +build-deps = "0.1.4" anyhow = "1.0" glob = "0.3" rustc_version = "0.2" diff --git a/build.rs b/build.rs index 46d9aec5305..36757215187 100644 --- a/build.rs +++ b/build.rs @@ -15,8 +15,12 @@ use test_generator::{ fn main() -> anyhow::Result<()> { println!("cargo:rerun-if-changed=tests/ignores.txt"); - println!("cargo:rerun-if-changed=tests/wasi-wast/wasi/unstable/*"); - println!("cargo:rerun-if-changed=tests/wasi-wast/wasi/snapshot1/*"); + // As rerun-if-changed doesn't support globs, we use another crate + // to check changes in directories. + build_deps::rerun_if_changed_paths("tests/wasi-wast/wasi/unstable/*") + .expect("Can't get directory"); + build_deps::rerun_if_changed_paths("tests/wasi-wast/wasi/snapshot1/*") + .expect("Can't get directory"); let out_dir = PathBuf::from( env::var_os("OUT_DIR").expect("The OUT_DIR environment variable must be set"),