On 2/24/23 2:01 PM, jmh530 wrote:
I'm looking at the dub package format [1] about optional dependencies
and it says:
"With this set to true, the dependency will only be used if explicitly
selected in dub.selections.json. If omitted, this attribute defaults to
false."
And it occurs to me that I don't know anything about how
dub.selections.json works.
Let's say you have dependency A, which has an *optional* dependency on B.
In your project, if you depend on A, but don't explicitly depend on B,
then A will be built without B as a dependency.
If you have a dependency on A *and* B, then B's optional dependency will
kick in, and participate in the selection of it's version.
So for instance, you could depend on B version 1 or higher, and the
optional dependency could be on v1.5 or higher, it will select the
highest version of 1.5
dub.selections.json only applies to the primary project. So the decision
on which versions of which dependencies to use is decided by the whole tree.
-Steve