On Fri, 29 Nov 2013 23:28:23 GMT, Arjan wrote:

By searching and browsing the newgroups I found some info on how to setup the config:
package.json

{
    "name": "tool",
    "description": "a set of tools",
    ...
    ...
    "dependencies":
    {
        "liba": { "version": "~master", "path": "/usr/local/src/liba" }, 
        "libb": { "version": "~master", "path": "/usr/local/src/libb" }, 
        "libc": { "version": "~master", "path": "/usr/local/src/libc" }, 
        "ddbc": { "version": "~master", "path": "/usr/local/src/ddbc" }, 
    },
    ...
    "subPackages":
    [
        {
            "name": "toola",
            "targetType": "executable",
            "excludeSourceFiles": [ "source/toolb.d", "source/toolc.d" ],
        },
        {
            "name": "toolb",
            "targetType": "executable",
            "excludeSourceFiles": [ "source/toola.d", "source/toolc.d" ],
        },
        {
            "name": "toolc",
            "targetType": "executable",
            "excludeSourceFiles": [ "source/toola.d", "source/toolb.d" ],
        }
    ]
} 

Is this the correct way to setup the package.json? Because it does not seem to work.
The dependencies are not propagated to the subPackages.

Sub packages in general are handled completely independently of each other and of the root package, so dependencies need to be duplicated for each sub package.

The second issue is with

    "dependencies":
    {
        "liba": { "version": "~master", "path": "/usr/local/src/liba" }, 

Should the "path" also added to 'dub' by 'dub add-path' or 'dub add-local'?
And how do I force the use of a local path for a dependency which is also in the dub repo?
For example ddbc is forked by me and I want dub to use my local-clone of the forked ddbc for ALL ddbc dependencies?

Yes, "add-path" seems to be the way to go here. "path" usually should only ever be used with relative paths, where the relative path is known to be fixed (e.g. this vibe.d example). If there are a bunch of packages found in /usr/local/src, just drop all the "path" declarations and run "dub add-path /usr/local/src". This always has precedence over packages fetched from the registry.

I'd also usually recommend to put the three tools into separate packages (like the vibe.d examples). I know it's tempting to use a single directory tree for all of them, but it's not really a clean solution considering how D looks up import modules (it will pollute the module name space so that other libraries may conflict with the modules toola/toolb/toolc when they are used in conjuction with the "tool" library). However, tool doesn't actually seem to be a library, but rather just a collection of single file tools, so this may not be an issue in this particular case.

BTW, there will also be single file package support at some point, which may be perfect here. Single file projects will have the package description embedded in the source file in some kind of special comment.