I just want a dub subpackage to refer to the parent package

Steven Schveighoffer schveiguy at gmail.com
Fri May 1 17:32:31 UTC 2020


On 5/1/20 1:00 PM, Pillager86 wrote:
> I did add-local on the main package yet the subpackage can't find the 
> import paths even though it compiled before. Why is this so difficult? 
> It has to be structured like this. If you have a game engine, the 
> logical thing to do is make a subpackage that implements the main 
> function that tests it. Dub needs help.

I went through something similar to this recently. I used vibe.d's dub 
recipes as a guide.

What you want to do is this in your main package file:

"subPackages" : [
         "package1",
         "package2",
         ...
     ]


Then in e.g. package1 recipe file:
"dependencies" : {
"mainPackage" : {
     "path" : ".."
},
"mainPackage:package2" : {
     "path" : ".."
}
}

That second one is what really threw me for a loop. You use the path to 
the main package, but then name the subpackage you are depending on.

-Steve


More information about the Digitalmars-d mailing list