August 30
I have a project where the source is mixed library, mixed application, and I'd like to separate the two. The code is fairly decoupled as is, but the files are all next to each other in the same namespace.

I moved out the library parts and made a new dub package, and it alone compiles fine. Ideally I'd like to separate it further into subpackages in a tree-like structure where some depend on others (but not the other way around).

> /dub.sdl
---
name "lu"
targetType "none"
dependency "lu:base" version="*"
dependency "lu:utils" version="*"
subPackage {
    name "base"
    targetType "library"
    sourcePaths "base"
}
subPackage {
    name "utils"
    targetType "library"
    sourcePaths "utils"
}
---

> /base/dub.sdl
---
name "base"
targetType "library"
sourcePaths "source"
---

> /utils/dub.sdl
---
name "utils"
targetType "library"
sourcePaths "source"
dependency "lu:base" version="*"
---

$ dub build
Performing "debug" build using /usr/bin/dmd for x86_64.
lu:base ~master: building configuration "library"...
lu:utils ~master: building configuration "library"...
utils/source/config.d(35,12): Error: module `common` is in file 'lu/base/common.d' which cannot be read
import path[0] = /usr/include/dlang/dmd
/usr/bin/dmd failed with exit code 1.

The offending line is naturally `import lu.base.common;`.

Is what I'm trying to do not possible? I thought lu:utils would just use the generated liblu_base.a. Am I not understanding it right? I tried adding importPaths "." to the subPackages section in /dub.sdl in hope it would see it but it did nothing. importPaths "base" does nothing either.

Do I need to add the source paths for "upstream" subpackages after all? Is that kind of downward dependency tree not possible?