Hi everyone,
I've been learning D for a few months now and really liked it :) !
Currently I'm experimenting with client/server application
development using the ZeroMQ library D wrapper called "zmqd".
Although I could successfully build the basic hello_world
application with a custom written Makefile using dmd/rdmd, I've
tried to use the DUB package manager to achieve the same goal,
but I'm having some issues with it.
By following the DUB documentation at
http://code.dlang.org/package-format#build-options I created a
main dub project called "hello_world" (dub init hello_world) and
set up two sub-packages therein called "client" and "server" (dub
init client|server).
Then I configured the three dub.json files as follows:
hello_world/dub.json:
{
        "name": "hello_world",
        "description": "Hello World client/server application using ZMQ",
        "targetType": "none",
        "dependencies": {
                "hello_world:client": "*",
                "hello_world:server": "*"
        },
        "subPackages": [
                "./client/",
                "./server/"
     ]
}

hello_world/client/dub.json:
{
        "name": "client",
        "description": "Hello World client application using ZMQ",
         "targetType": "executable",
         "sourceFiles": ["source/hwclient.d"],
        "dependencies": {
                "zmqd": "~>1.0.0-alpha"
        }
}

hello_world/server/dub.json -> same as above with "server"
substituting "client"

With this setting, from within "hello_world" directory, I can
build client and server individually with:

$ dub build hello_world:client
$ dub build hello_world:server

but when I simply try:

$ dub build

to build the whole thing at once, I get an error saying:

Error executing command build:
Main package must have a binary target type, not none. Cannot
build.

But if I change the "targetType" to "executable" or "autodetect"
in hello_world/dub.json I get the error:

Configuration 'application' of package hello_world contains no
source files. Please add {"targetType": "none"} to it's package
description to avoid building it.
Error executing command build:
Main package must have a binary target type, not none. Cannot
build.

What shall I do to have all sub-packages automatically built when
I build the main package? Is there a way to specify a small bash
script to have custom commands executed when giving the "dub run"
command?

Sorry for the long post :( !

Reply via email to