Am 08.07.2016 um 06:24 schrieb Meta:
I have two questions.
- Is it possible to build subpackages when
dub buildis invoked for the main package? It's a pain to first do
dub build :mysubpackageand then
It depends on the target type of the root package. For dynamic libraries
and executables, adding the sub package as a dependency (i.e.
dependency ":mysubpackage" version="*") will cause it to be built
together with it. For static libraries this is currently not possible.
However, there is also https://github.com/dlang/dub/issues/97, so that
building root packages with target type "none" would instead build all
sub packages once it is implemented.
- It seems that when dub detects that no dependencies need to be updated, it does not run the pre-build commands. I have some pre-build commands that generate data to be imported by the main package and thus must always be run for a build. Is there a way to specify this?
It should run the pre-build commands whenever the package itself needs
to be rebuilt (i.e. it should generally be independent of its
dependencies in that regard). If it doesn't, that would definitely be a bug.
If you need them to run for every build invocation, regardless of the
need to rebuild the package itself, using a pre-generate command instead
would work. However, pre-generate commands will not be re-run when a
generated project file (e.g. VisualD) gets built.
If there are any files on which the generated data depends, putting the
commands in a dummy sub package on which the main package depends, and
adding the folder that contains the data dependencies as a
stringImportPath, should also work, even though this is obviously just a