Open pontifechs opened 8 years ago
Just ran into this bug.
Are build requirements just broken?
buildTypes
is ignored as well.
buildRequirements
are inherited from dependencies, but not the other way around. They have to be inherited in one direction because of the way D files get compiled, but they really are just meant to be for the package itself.
In this particular case, the dependency package simply has be be fixed like for any other issue in there.
For buildTypes
it doesn't really make sense to inherit in either direction - both would be ambiguous.
The problem is a project can require that there be no optimization flag but dub will blithely try to build it with optimization flags anyway, as long as it's in a dependency.
If these are supposed to be inherited, that is just plain not working. This is on dub master. I can't find any code that would do it either.
edit: Afaics, dub doesn't inherit the optimize
build option anyway. I'm not sure how it even ends up using it for the child's package build.
No optimization should probably be a BuildRequirement.noOptimization
, although it is debatable whether that should be inherited or not (depending on whether templated or inlinable code is affected or not). But it seems to me that it may be better to not inherit it and require the affected code to be isolated accordingly to avoid performance implications for dependent packages.
Afaics, dub doesn't inherit the optimize build option anyway. I'm not sure how it even ends up using it for the child's package build.
Optimize is not inherited, but the build type settings are applied uniformly to all packages in the dependency graph. The general rule is that only settings that potentially affect the ABI are inherited.
Ah, mea culpa! Figured it out, it was my error. buildRequirement
s are not inherited to subpackages. If I stick it in the subpackage, it correctly applies it to just that package's build.
Build requirements don't seem to be passed down when building dependencies.
For example, I have a dependency that generates some warnings when trying to build unittests. I put the following in my .sdl:
buildRequirements "allowWarnings"
I intentionally added a warning to my project, and it does respect it there, but the build still fails because the dependency outputs a warning.