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

Luis luis.panadero at gmail.com
Fri May 1 23:10:06 UTC 2020


On Friday, 1 May 2020 at 17:32:31 UTC, Steven Schveighoffer wrote:
> 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

Umm.... It's like what I did on Pegged to subpackage some 
examples. In particular, the grammar composition example have a 
dependency to the main package (Pegged) and to two other examples 
:


   "dependencies": {
     "pegged": {
       "version": "*",
       "path": "../.."
     },
     "pegged:strings": {
       "version": "*",
       "path": "../.."
     },
     "pegged:numbers": {
       "version": "*",
       "path": "../.."
     }
   }



More information about the Digitalmars-d mailing list