www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - build a subpackage in dub?

reply cy <dlang verge.info.tm> writes:
Say I have a package called "main" and a sub-package in a 
"complicatedexample" directory, and my dub.json in "main" looks 
sort of like:

"subPackages": [
   "./complicatedexample/"
],

Let's say I do *not* have ":complicatedexample" in my 
dependencies for "main", but "complicatedexample" itself imports 
from /other/ sub-packages in main, like I dunno, "support" 
"coolstuff" "thingies" or whatever.

I can't chdir to complicatedexample and dub -v build, because it 
says "Unknown dependency: complicatedexample:support" since it 
can't know that it's in a subpackage. But I also can't build 
":complicatedexample" from in the main directory, because "dub 
build -v :complicatedexample" gives me "Failed to find a package 
named main:complicatedexample".

I swear I figured out how to do this before, but I honestly 
cannot remember. The example imports a huge C library and 
compiles stubs and does all sorts of stupid stuff that the rest 
of the program doesn't have anything to do with at all, just to 
demonstrate the algorithm. But I don't know how to isolate it. 
Any ideas?

Just... create a totally separate package, and remember to copy 
and paste all the other sub-packages to it, and add all the other 
subpackages to every dub.json manually?
Jul 16 2016
parent drug <drug2004 bk.ru> writes:
16.07.2016 20:26, cy пишет:
 Say I have a package called "main" and a sub-package in a
 "complicatedexample" directory, and my dub.json in "main" looks sort of
 like:

 "subPackages": [
   "./complicatedexample/"
 ],

 Let's say I do *not* have ":complicatedexample" in my dependencies for
 "main", but "complicatedexample" itself imports from /other/
 sub-packages in main, like I dunno, "support" "coolstuff" "thingies" or
 whatever.

 I can't chdir to complicatedexample and dub -v build, because it says
 "Unknown dependency: complicatedexample:support" since it can't know
 that it's in a subpackage. But I also can't build ":complicatedexample"
 from in the main directory, because "dub build -v :complicatedexample"
 gives me "Failed to find a package named main:complicatedexample".

 I swear I figured out how to do this before, but I honestly cannot
 remember. The example imports a huge C library and compiles stubs and
 does all sorts of stupid stuff that the rest of the program doesn't have
 anything to do with at all, just to demonstrate the algorithm. But I
 don't know how to isolate it. Any ideas?

 Just... create a totally separate package, and remember to copy and
 paste all the other sub-packages to it, and add all the other
 subpackages to every dub.json manually?
If you could list example of your package dub.json it would be better. I use subpackages intensively, subpackages depends on other subpackages and it works, but I'm not sure I understand your case.
Jul 18 2016