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

Rules cannot have optional file dependencies #298

Closed
timbertson opened this issue Oct 26, 2017 · 4 comments
Closed

Rules cannot have optional file dependencies #298

timbertson opened this issue Oct 26, 2017 · 4 comments

Comments

@timbertson
Copy link
Contributor

jbuilder doesn't appear to have a way to specify "depend on this file, if it exists" - all dependencies are treated as mandatory, and the build will fail if a dependency cannot be built. That makes sense in most cases, but it can be useful to have an optional variant which allows the file to be missing (in which case it would be considered "changed" if it later gets created).

I discussed a use case for this in #255, essentially I want a rule (for version.ml) to depend on .git/HEAD, but I also want the rule to be buildable when there is no .git directory (e.g. when building from a plain tarball).

@rgrinberg
Copy link
Member

@diml do optional dependencies make sense for dune? Does jenga support such dependencies?

@ghost
Copy link

ghost commented Jul 7, 2018

Dune already supports optional dependencies. If you use (glob_files x) in a rule, it will only depend on x if x exists or is buildable. However, this doesn't help for the use case in this PR because directories starting with . are completely ignored by dune. #880 should solve this common use case.

@rgrinberg
Copy link
Member

So now it is possible to depend on .git/HEAD since the dirs stanza was introduced. However, this isn't really a good solution as we don't want to be scanning all of .git just for a single file.

@ghost
Copy link

ghost commented May 27, 2019

I'm expecting that #1930 will cover all the cases where one wants to depend on .git/HEAD, so we can close this PR

@ghost ghost closed this as completed May 27, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants