Michael-F-Bryan / include_dir

The logical evolution of the include_str macro for embedding a directory tree into your binary.
https://michael-f-bryan.github.io/include_dir
MIT License
319 stars 36 forks source link

Changes in included files do not trigger a rebuild #77

Closed tobx closed 2 years ago

tobx commented 2 years ago

When using cargo build a change in an included file does not trigger a rebuild.

I am currently using this build script as a workaround:

// build.rs
fn main() {
    println!("cargo:rerun-if-changed=src/include");
}

Someone in the beginners channel of the official Rust Discord server wrote:

In theory a macro that includes data should cause rustc to emit metadata about which files it included which cargo would read, but I don't know if that actually works in practice, or if that crate hanldes that correctly

I thought I should mention this here.

Michael-F-Bryan commented 2 years ago

This is actually already implemented, but you need to explicitly opt-in using the nightly feature flag because it's not available on stable yet.

jlkiri commented 2 years ago

Weird, I've installed nightly toolchain but there is no rebuild with cargo +nightly build even though I change the files.