On Mon, 23 Jun 2014 11:45:20 GMT, Rafael Gaitan wrote:
Hi,
I recently started using dub, and I've reviewed some recent posts about using subpackages, but I didn't found a solution.
I've created a really simple project following the documentation for building multiple components, in fact I replicated the sample, but I'm getting always the same error:
Error executing command run: Main package must have a binary target type, not none. Cannot build.
I've tested with stable version and with master version of dub, same error on both.
What I'm trying to do is building a library in component1 and an executable in component2 using component1 as a dependency, and build everything from mylib directory.
Am I missing something or maybe I didn't understood how subpackages should work?
main dub.json:
{ "name": "mylib", "description": "A minimal D application.", "copyright": "Copyright © 2014, rgaitan", "authors": ["rgaitan"], "targetType": "none", "dependencies": { "mylib:component1": "*", "mylib:component2": "*" }, "subPackages": [ "./component1/", "./component2/" ] }
component1 dub.json:
{ "name": "component1", "description": "A minimal D application.", "copyright": "Copyright © 2014, rgaitan", "authors": ["rgaitan"], "targetType": "library", "dependencies": { } }
component2 dub.json:
{ "name": "component2", "description": "A minimal D application.", "copyright": "Copyright © 2014, rgaitan", "authors": ["rgaitan"], "targetType": "executable", "dependencies": { "mylib:component1": "*" } }
Thank you,
Rafa.
There is an enhancement request for supporting direct builds of this kind of package structure (#97), but until then, the explicit sub package needs to be specified like this:
dub build mylib:component2
or shorter (current beta version of DUB 0.9.22):
dub build :component2