Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compression feature breaks incremental builds #182

Closed
djmarcin opened this issue Aug 16, 2022 · 10 comments
Closed

Compression feature breaks incremental builds #182

djmarcin opened this issue Aug 16, 2022 · 10 comments

Comments

@djmarcin
Copy link
Contributor

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).

@pyrossh
Copy link
Owner

pyrossh commented Aug 16, 2022

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.

@djmarcin
Copy link
Contributor Author

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.

@pyrossh
Copy link
Owner

pyrossh commented Aug 18, 2022

Yeah maybe we can update the readme. Will do it thanks.

@pyrossh
Copy link
Owner

pyrossh commented Aug 20, 2022

Done. thanks.

@pyrossh pyrossh closed this as completed Aug 20, 2022
@osiewicz
Copy link
Contributor

Hey, it looks like this issue was addressed within include_flate itself recently? SOF3/include-flate@4cf6b8e

@pyrossh
Copy link
Owner

pyrossh commented Jun 29, 2023

Ahh nice. Will update include-flate to 0.2.0 and remove the note.

@pyrossh
Copy link
Owner

pyrossh commented Jun 30, 2023

Release v6.8.0 with the changes thanks @djmarcin @osiewicz.

@pyrossh
Copy link
Owner

pyrossh commented Jun 30, 2023

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

@osiewicz
Copy link
Contributor

osiewicz commented Jun 30, 2023

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

@pyrossh
Copy link
Owner

pyrossh commented Jun 30, 2023

Fixed again in v6.8.1. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants