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

Allow to use cargo changes tracking to avoid excessive runs of build.rs #19

Closed
kilork opened this issue Oct 28, 2020 · 6 comments · Fixed by #29
Closed

Allow to use cargo changes tracking to avoid excessive runs of build.rs #19

kilork opened this issue Oct 28, 2020 · 6 comments · Fixed by #29
Labels
enhancement New feature or request

Comments

@kilork
Copy link
Owner

kilork commented Oct 28, 2020

Example from typical build.rs:

println!("cargo:rerun-if-changed=build.rs");

This allows to run build.rs only if build.rs changed. Similar we can add static files to list of changes. This needs to be tested for new files case also.

@kilork kilork added the enhancement New feature or request label Oct 28, 2020
@john01dav
Copy link

What's the current system to deal with this? It seems like I need to manually cargo clean at random intervals in order to avoid downright bizarre errors that ultimately seem to somehow be related to build.rs not running when it should. Ideally, in my project, it would just run every time that cargo run or cargo build is called.

@kilork
Copy link
Owner Author

kilork commented Nov 23, 2020

@john01dav I usually move resources to separate crate and use some feature flag to exclude it from regular build while I am working on something other.

Also of course you can just write those instructions by hand after resource generation.

@john01dav
Copy link

@john01dav I usually move resources to separate crate and use some feature flag to exclude it from regular build while I am working on something other.

Also of course you can just write those instructions by hand after resource generation.

I don't see how moving static file things to a separate crate fixes the issue where my underlying files change but build.rs does not rerun. In case it's relevant, since the files that actix-web-static-files packages are generated by npm, they are .gitignored, and this might interfere with the normal system.

@kilork
Copy link
Owner Author

kilork commented Nov 24, 2020

Sorry, probably I got your question wrong. Then probably you can add those instructions by hand.

More info you can find here: https://doc.rust-lang.org/cargo/reference/build-scripts.html#change-detection

I have feeling this feature works strange, need to experiment more with that before I can really give a good advice here.

@kilork
Copy link
Owner Author

kilork commented Dec 5, 2020

Created new crate to handle this: change-detection.

Need to think a little bit, how to integrate this with actix-web-static-files.

@kilork
Copy link
Owner Author

kilork commented Dec 12, 2020

Created one more crate to help: path-matchers

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

Successfully merging a pull request may close this issue.

2 participants