-
Notifications
You must be signed in to change notification settings - Fork 414
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
[RFC] Recursive Globs #1866
Comments
To implement this feature efficiently, it seems like we need to get the subpaths efficiently. To do that, we'll need to change @diml does that sound right to you? I feel that might have some negative performance implications as currently it's just a hash table look up. |
Actually, it seems like it will not be necessary after all. We'll just have to call Some test cases that we should cover are: depend on all .v files one level deep:
depend on all .v files recursively:
|
It all depends on the semantic you want. If not, then we can simply use the file tree to find out what sub-directories to descend into. If yes, then that's more complicated. Currently, the only generated directories are the dot-directories generated by dune, so it doesn't feel like the user wants to include these in general. At the same time, if we want to describe the behaviour of |
The behavior that is consistent with globs is to match generated files so I think that we should make it work the same. Although I definitely agree that we should not include dune's internal dirs in any of these globs. Really, I think users shouldn't even be allowed to write them as dependencies. It's just that we don't have workarounds for some of the use cases. |
@ejgallego could you weigh in on the desired behavior? I'd like to confirm if you need the recursive glob to capture targets. |
So far we don't need to capture targets in any of our cases, but I dunno, it could well be. In fact, our need for glob patterns is fairly limited, it only appears for lack of proper Dune support for But that latter case is interesting, it builds a But yeah we should really invariant in this case to whether globs include the target or not, but note indeed that if we do a setup where the generated |
Thinking about this more, I think it would be quite unintuitive for users if recursive globs don't include targets while normal globs do. So if it ends up being too painful to implement recursive globs which include targets, we should just make them error out if they include a target with a message like: "this feature isn't supported yet".
Indeed, but this problem isn't specific to globs and dune gives proper error messages when encountering dependency cycles (as it would in this case as well). |
@diml I've tried implementing this feature and just realized that
With recursive globs, the meaning should be closer to One option is to create a new syntax for recursive globs. However, I don't know how to introduce a new syntax without risking breaking of existing globs. Another option is to add a |
If we want to change the syntax of globs, it'll have to be in version 3 of the language. If we want the feature before, we should indeed add a
In any case, if we are about to introduce a new glob syntax we should look around to make sure we don't invent something that is very different from what other tools do. So we should look at the syntax of things such as gitignore or hgignore. |
Here's documentation regarding
Here's the documentation for the
So I believe both of these are consistent with how I'm choosing to interpret I think the correct way to go is to introduce |
Yeah, for now we have no choice but to introduce |
I ran into this issue today--I have a code generation pass with a lot of dependencies that make more sense as a recursive glob than an expanded list of globbed directories, and I had to spell them all out. |
This is partially addressed by #4176. Removing the 3.0 milestone. |
Will |
Yes, we should document it. #5012 |
@Alizter can you give us an update here? |
Seems to work fine, I have been doing things like:
since dune 3.0. |
This feature has been mentioned in passing a few other times in the bug tracker, so I'd like to create an official issue to track it.
Problem
The glob language is quite useful when describing file sets, but unfortunately it encourages a "flat" dependency structure in your project. Sometimes, a glob has to span directories recursively.
Solution
The solution is to add
**/
pattern. This pattern is interpreted as matching zero or more path components. So for example, we'd be able to depend on all coq files recursively using this pattern:Cc'ing @ejgallego as he is currently using find/bash to workaround the lack of this. I've found this to be useful in a few other situations as well.
The text was updated successfully, but these errors were encountered: