On Mon, 21 Oct 2013 08:55:53 +0200, Sönke Ludwig wrote:

Am 21.10.2013 06:20, schrieb Joseph Rushton Wakeling:

On Mon, 21 Oct 2013 04:08:02 GMT, Joseph Rushton Wakeling wrote:

Is there a recommended way to specify in package.json that a package should (or could) be treated as a "header library", where dependent code should just build stuff in via module imports, rather than via linking in a prebuilt library?

I noticed the "sourceLibrary" target option listed among the available target types, but when I try using it, issuing a "dub build" command results in "Error: Assertion failure"

I'll look into the assertion failure, it's probably a missing error
message along the lines of "The target type is 'sourceLibrary', which
has no target. Stopping build.", or did you invoke the "dub build " on a
dependent project?

Error message fixed by 1201e4c.

Selecting the wrong configuration for sub packages ("library") is fixed by 2b29072.

And finally, putting the root package as a dependency into the sub packages is fixed by 9700a53.

Everything should work now. However, I would recommend to put the test packages in their own part of the directory structure, for example:


(Single-file packages would help a lot to keep the number of files/folders down in the future)

The main reason is that those test modules will pollute the D package namespace if they are inside of the same folder as the library modules. It's also obvious from the directory structure where the tests are and how they can be built, without having to look at the package.json file.