Compression feature breaks incremental builds
djmarcin opened this issue ยท 10 comments
When using the compression feature, incremental builds where only the embedded files change do not trigger a rebuild. This is most obvious when using both compression and debug-embed.
I think this is because include_bytes!
has special logic in the compiler to add a dependency and trigger rebuilds when the file changes, but include_flate!
does not (and does not use include_bytes!
internally).
Do you think this can be fixed/added in the include_flate!
repo? As that would help any other projects using it. I'm guessing its not going that easy though.
There is an unstable feature that would allow it to track the file, but that would mean that using it would require nightly. rust-lang/rust#99515
There is another workaround which involves assigning include_bytes!
to an unused temporary but Iโm not sure if that defeats the point of the compression by including it in the binary again or if it gets optimized out.
I wanted to report it here in case it would be prudent to add a warning that compression should only be used with clean builds or something until this can be fixed.
Yeah maybe we can update the readme. Will do it thanks.
Done. thanks.
Hey, it looks like this issue was addressed within include_flate itself recently? SOF3/include-flate@4cf6b8e
Ahh nice. Will update include-flate to 0.2.0
and remove the note.
Seems like it breaks the tests,
Compiling rust-embed v6.8.0 (/Users/pyrossh/Code/rust-embed)
error: couldn't read /Users/pyrossh/Code/rust-embed//Users/pyrossh/Code/rust-embed/examples/public/images/doc.txt: No such file or directory (os error 2)
--> tests/lib.rs:4:10
|
4 | #[derive(RustEmbed)]
| ^^^^^^^^^
|
= note: this error originates in the macro `include_bytes` which comes from the expansion of the derive macro `RustEmbed` (in Nightly builds, run with -Z macro-backtrace for more info)
error: couldn't read /Users/pyrossh/Code/rust-embed//Users/pyrossh/Code/rust-embed/examples/public/images/flower.jpg: No such file or directory (os error 2)
--> tests/lib.rs:4:10
|
4 | #[derive(RustEmbed)]
| ^^^^^^^^^
|
= note: this error originates in the macro `include_bytes` which comes from the expansion of the derive macro `RustEmbed` (in Nightly builds, run with -Z macro-backtrace for more info)
error: couldn't read /Users/pyrossh/Code/rust-embed//Users/pyrossh/Code/rust-embed/examples/public/images/llama.png: No such file or directory (os error 2)
--> tests/lib.rs:4:10
|
4 | #[derive(RustEmbed)]
| ^^^^^^^^^
|
= note: this error originates in the macro `include_bytes` which comes from the expansion of the derive macro `RustEmbed` (in Nightly builds, run with -Z macro-backtrace for more info)
error: couldn't read /Users/pyrossh/Code/rust-embed//Users/pyrossh/Code/rust-embed/examples/public/index.html: No such file or directory (os error 2)
--> tests/lib.rs:4:10
|
4 | #[derive(RustEmbed)]
| ^^^^^^^^^
|
= note: this error originates in the macro `include_bytes` which comes from the expansion of the derive macro `RustEmbed` (in Nightly builds, run with -Z macro-backtrace for more info)
error: couldn't read /Users/pyrossh/Code/rust-embed//Users/pyrossh/Code/rust-embed/examples/public/main.css: No such file or directory (os error 2)
--> tests/lib.rs:4:10
|
4 | #[derive(RustEmbed)]
| ^^^^^^^^^
|
= note: this error originates in the macro `include_bytes` which comes from the expansion of the derive macro `RustEmbed` (in Nightly builds, run with -Z macro-backtrace for more info)
error: couldn't read /Users/pyrossh/Code/rust-embed//Users/pyrossh/Code/rust-embed/examples/public/main.js: No such file or directory (os error 2)
--> tests/lib.rs:4:10
|
4 | #[derive(RustEmbed)]
| ^^^^^^^^^
|
= note: this error originates in the macro `include_bytes` which comes from the expansion of the derive macro `RustEmbed` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `rust-embed` (test "lib") due to 6 previous errors
These paths look like a concatenation of absolute and relative path; I believe include-flate 0.2 explicitly dropped support for absolute paths, so perhaps they changed the API to accept only relative paths?
SOF3/include-flate@4d79700
Fixed again in v6.8.1. Thanks.