expand wildcards in workspace member paths #392
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes a problem that comes up when referencing a dependency via git where the dependency is in a workspace, and the workspace manifest lists members using wildcards / file globs. An example is ndc-sdk-rs whose
Cargo.toml
defines a virtual workspace like this:When using crate2nix in IFD mode referencing dependencies in this workspace fails because
tools.nix
expects workspace members to be given as exact paths, without wildcards. You get an error of this form:This PR adds a function to produce a list of exact paths given a path that might contain wildcards, and a directory to search in. It modifies the logic that looks up crates in a workspace in a git dependency to use the new function.
I included a number of unit tests to try to verify the functionality of glob expansion. I think an integration test would be a good idea, but that requires a dependency that can be referenced via git. The best example I know of is ndc-sdk-rs which I mentioned above. It's non-trivial so I was hesitant to add the necessary build time to the test suite in crate2nix.