dub
dub copied to clipboard
`dub.selections.json`: We should not store info about non-optional path/repository dependency
Currently, we store information about non-version dependencies in dub.selections.json.
I think we should not, unless it's to mention the dependency is selected (although I'm a bit fuzzy on the usefulness of such a case).
Instead, we should consider dub.{sdl,json} with a repo / path dependency to be an implicit dub.selections.json mention.
This would avoid the risk of inconsistency, and make pure path-based dependencies easier. It would probably also avoid a few minor issues we're seeing about download.
I had to work around this behavior in the past, e.g. in https://github.com/bosagora/agora/blob/v0.x.x/dub.selections.json
hm if we use the dub.selections.json file consistently as source for dependencies, shouldn't we put all of them in there? Especially having this would also allow optional path-based dependencies and makes it clearer why path dependencies are used or not used.
If we have some proper tool for working with dub.selections.json (e.g. dub select) we could use that as a way to interact with it for the user.
hm if we use the dub.selections.json file consistently as source for dependencies, shouldn't we put all of them in there?
But we don't. We load the recipe, and check that the selections are consistent with the recipe at best. If the user updates the path / repository dependency, the only sensible things we can do is error or silently update. The former is plain annoyingly pedantic while the second essentially means that the selections are essentially useless because they always get overridden.
Especially having this would also allow optional path-based dependencies and makes it clearer why path dependencies are used or not used.
That's why the issue mentions optional dependencies. Essentially I want to change a selection for an selected optional dependency from:
{
"some-path-dep": { "path": "copy/of/recipe", "default": true }
}
To:
{
"some-path-dep": { "default": true }
}
(On a phone so skipped the other fields)
If some-path-dep is a regular (non optional) dependency, the entry is just not present. Note that I'm not quite sure that's what default is used for (selecting optional dependencies) so think of the field name as "selected" if it helps.
If we have some proper tool for working with dub.selections.json (e.g.
dub select) we could use that as a way to interact with it for the user.
I don't see how that relates though? A selection cannot be worked with standalone, you always need the associated recipe.