Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell Cargo to rebuild when a file included with the include_bytes macro is changed?

I am using the include_bytes! macro to compile a GLSL shader into a rust program. It seems that Cargo is unaware of this however: when I modify just the shader file and test it with cargo run the updated file is not compiled in. Manually touching the .rs file that includes the shader does work.

Do I need to add something to my Cargo.toml to explictly state this dependency?

Version info:

$ rustc --version && cargo --version
rustc 1.0.0-nightly (ecf8c64e1 2015-03-21) (built 2015-03-22)
cargo 0.0.1-pre-nightly (e689383 2015-03-16) (built 2015-03-16)
like image 805
Nicholas Bishop Avatar asked Mar 22 '15 23:03

Nicholas Bishop


2 Answers

This has been fixed in rustc: https://github.com/rust-lang/rust/pull/24423

like image 189
Nicholas Bishop Avatar answered Oct 03 '22 03:10

Nicholas Bishop


Cargo has no way currently to add a file to the list of 'watched' files for changes. It won't know about files included with include_bytes! because that would involve special-casing that macro specifically.

like image 32
Steve Klabnik Avatar answered Oct 03 '22 03:10

Steve Klabnik