Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subpackages don't work as described on the website #665

Closed
ghost opened this issue Sep 1, 2015 · 2 comments
Closed

Subpackages don't work as described on the website #665

ghost opened this issue Sep 1, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Sep 1, 2015

On the webpage of code.dlang.org is an example for a situation where a project shall simply boundle multiple subprojects. This example does not work. Dub refuses to build the parent project if the buildType is none and complains "Error executing command build: main package must have a binary target type, not none. Cannot build." The second approach has the same error. Changing the targetType of the parent to a binary type like executable fails as there are no source files in the parent directory.
Tested on Win7 64bit with dub version 0.9.22

@CounterPillow
Copy link

I've encountered this issue as well, and I think the cause for this is that there's a conflict in philosophy. Some people, such as me, are used to make files where the command make is usually synonymous with make all, so coming from that to the dub world, we try to replicate this behaviour so that dub build would, by default, build all sub-packages.

To achieve this, one logically makes the main package empty and adds all sub-packages as dependencies, however, the above mentioned failure occurs. Additionally, this isn't all that pretty since technically the sub-packages aren't really required dependencies of the main package. We just specify them as such because we want them to be built when using dub build.

In my use-case, I have a library which comes with a bunch of utilities. I now have moved the library into the main package, and all the utilities are sub-packages. This allows one to dub build, but unfortunately means all the sub-packages need to be built one-by-one. Having something like dub build --all or making dub build default to compiling all sub-packages would probably cover a lot of cases where somebody would want to use an empty main package.

@WebFreak001
Copy link
Member

error messages have been improved, the site content is a little better now.

buildType none now builds all dependencies, implemented in #1364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants