dub sub-projects

Vladimirs Nordholm v at vladde.net
Sun Sep 20 18:24:31 UTC 2020

Hello. I wonder what the best-practice is for dub projects with 
sub-projects. Excuse me if the terminology is wrong. Let me 
explain my situation.

I have a library which I want to split up into multiple projects. 
The main project will be a "wrapper" with some additional code. 
The sub-projects will be their own GitHub project, and the main 
project will have the sub-projects in its dependencies list 
(although I am unsure if this is the correct approach with dub).

The way I imagine it all is that the main project uses code from 
the sub-projects and connects them together (hence the reason why 
I want a main project). The sub-projects will be completely 
separated to (hopefully) enforce non-spaghetti code. They would 
also be able to be developed independently from the rest of the 

I am unsure what the dub file would look like. I read that there 
is something called "subPackages", but in my mind I see them as 
dependencies. Is "subPackages" the right approach here?

My last wondering is what the module name would be for the 
sub-packages would be. I want the project naming convention to be:
- project
- project-foo
- project-bar

But if I were to go with "dependencies" route, the correct (I 
believe) module name would be
- "project-foo.xxx"
- "project-bar.xxx"

, while I would want it to be
- "project.foo.xxx"
- "project.bar.xxx"

More information about the Digitalmars-d-learn mailing list