www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dub sub-projects

reply Vladimirs Nordholm <v vladde.net> writes:
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 
code.

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"
Sep 20 2020
next sibling parent Vladimirs Nordholm <v vladde.net> writes:
On Sunday, 20 September 2020 at 18:24:31 UTC, Vladimirs Nordholm 
wrote:
 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.

 ...
The project I am referring to is my project scone (https://github.com/vladdeSV/scone), which is a wrapper for terminal input/output. I want to separate the input and output parts into own GitHub projects. The naming conventions for these projects would be - scone - scone-input - scone-output
Sep 20 2020
prev sibling next sibling parent reply rikki cattermole <rikki cattermole.co.nz> writes:
On 21/09/2020 6:24 AM, Vladimirs Nordholm wrote:
 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?
Yes but no. Normally all of these (what appear to be small but highly related code ) would go in the single repository which is when you would use subPackages. But since you insist on them being separate repositories, then they are just regular old dependencies.
Sep 20 2020
parent Vladimirs Nordholm <v vladde.net> writes:
On Sunday, 20 September 2020 at 18:55:39 UTC, rikki cattermole 
wrote:
 But since you insist on them being separate repositories, then 
 they are just regular old dependencies.
Ah, well it's not that I _insist_ on them being their own dependencies, it's just the only way I've encountered a setup like this.
Sep 20 2020
prev sibling parent reply =?UTF-8?B?0JLQuNGC0LDQu9C40Lkg0KTQsNC0?= =?UTF-8?B?0LXQtdCy?= writes:
On Sunday, 20 September 2020 at 18:24:31 UTC, Vladimirs Nordholm 
wrote:
 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.

 [...]
Check this: https://github.com/vitalfadeev/dub-subprojects may like it as an example.
Sep 21 2020
parent Vladimirs Nordholm <v vladde.net> writes:
On Monday, 21 September 2020 at 08:02:46 UTC, Виталий Фадеев 
wrote:
 On Sunday, 20 September 2020 at 18:24:31 UTC, Vladimirs 
 Nordholm wrote:
 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.

 [...]
Check this: https://github.com/vitalfadeev/dub-subprojects may like it as an example.
This looks like exactly the example project I need. Thank you!
Sep 21 2020