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

New #[files] feature does not recompile on file change #220

Open
GeeWee opened this issue Oct 2, 2023 · 6 comments
Open

New #[files] feature does not recompile on file change #220

GeeWee opened this issue Oct 2, 2023 · 6 comments

Comments

@GeeWee
Copy link

GeeWee commented Oct 2, 2023

I have a large project with many files that I read as integration tests.

I saw the new #[files] feature and love it.

However, I would expect it to automatically pick up when I add new files to a directory that matches the glob pattern. This does currently seem to happen. If I add a file and run the (already compiled) crate, I do not get the new test case. However if I go in and force the crate to recompile by changing some arbitrary line of code, then the new test case seems to run.

I should probably mention here that my test files are outside the src directory, in a separate tests directory. I'm unsure if cargo picks up on the changed files automatically if they are all inside src

My current workaround is just to call touch src/lib.rs before running the tests, as that seems to force cargo to recompile.

@la10736
Copy link
Owner

la10736 commented Oct 2, 2023

Sorry, isn't possible to handle this without introducing a build.rs script 😢
In this script we should define the folder that we want to handle and add a variable that should reflect the last state like an hash (but may there is already something about that in some crates).

That's really sad....

@GeeWee
Copy link
Author

GeeWee commented Oct 2, 2023

Yes I also couldn't quite figure it out how to do it in a sensible way without a build.rs script either :(
Might be worth documenting this though, as it took me a little while to figure out the behaviour.

@GeeWee
Copy link
Author

GeeWee commented Oct 2, 2023

It does look like something nightly-only exists which might be stabilized at some point, not sure if we can do much except wait for that.

@la10736
Copy link
Owner

la10736 commented Oct 2, 2023

Yes... but maybe is not enough because you can track files but not folder.

@GeeWee
Copy link
Author

GeeWee commented Oct 2, 2023

Seems like it does allow for folder tracking, but it might not support globbing, which is unfortunate.

@la10736
Copy link
Owner

la10736 commented Jun 2, 2024

In #256 I wrote some notes about how to handle this in the most of the cases. Intended, with the use of build.rs script.

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

2 participants