How to make dub recursively build subPackages?

Steven Schveighoffer schveiguy at gmail.com
Wed Feb 2 19:03:35 UTC 2022


On 2/2/22 1:42 PM, Vijay Nayar wrote:

> 
> I made this change and it did indeed work correctly, thank you for that! 
> Truthfully, it was not entirely clear to me how dub was deciding where 
> to go to build. I had assumed that this was being done via the 
> `subPackage` lines.

Like many things in dub, there are multiple ways to do things. I've done 
some of the other things in some projects, and I found this works the 
best for intra-repository dependencies.

If you are depending on a subproject from outside the repository, then I 
think you have to use the version of the parent repository as a 
specified version, since the whole repo is tagged the same.

> 
> The examples given in the offical documentation were also using 
> versions, and I was following that: 
> https://dub.pm/package-format-sdl.html#sub-packages
> 
> 

Yeah, that example shows a repository which exists purely to combine 
multiple subprojects into one repo (note the targetType of none). Also 
note the `version="*"`, which is basically "I don't care, whatever is 
there". I think you could also do a path as well, but I think even if 
you use the `*` version, you might have dub trying to fetch the 
dependency from the internet. I'm more comfortable with the `path` 
directive, since I know it can't possibly think that it has to go 
elsewhere to resolve that dependency.

Dub is kind of a hot mess in terms of the dependency resolution and ways 
to specify projects. I would love to see it cleaned up/reimplemented.

-Steve


More information about the Digitalmars-d-learn mailing list