dlang / dub

Package and build management system for D
MIT License
671 stars 230 forks source link

subConfiguration setting only works for subPackages #1188

Open arpie42 opened 7 years ago

arpie42 commented 7 years ago

It is not clear if this is by design or if it is a bug.

From delving into the dub source code, I am convinced that the only way to override a configuration of an arbitrary dependency is to use the --override-config flag on the command line.

However, the online documentation suggests that the subConfiguration[s] parameter of the dub.sdl/json file could be used to select a configuration of a dependency :

You can choose a specific configuration for certain dependencies by using the "subConfiguration" directive: dependency "somepackage" version=">=1.0.0" subConfiguration "somepackage" "glut-app"

In reality, the only dependencies affected by the subConfiguration[s] setting are direct subPackages. And I don't actually see any valid use for it outside of configuration{} blocks of the parent project.

Have I understood this correctly?

I cannot decide if it makes sense to be able to override configurations of dependencies in the dub.sdl file. It would seem to make sense if the package is an application but not if it is a library. Does anybody else have any thoughts on this?

In any case, can we please either introduce this functionality and/or improve the documentation to better explain how to select configurations of dependencies, and how the subConfiguration[s] setting is intended to be used.

If somebody more familiar with dub could confirm that I have understood this correctly, I would be happy to have a go at putting together a PR.

sasq64 commented 7 years ago

AFAICT subConfiguration does not even work inside a configuration clause, it is instead incorrectly always used, even if that configuration is not selected.

I think it's useful for propagating configurations to sub-packages? Since config is not saved when building sub packages...