www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - forwarding build type to dependencies with dub

reply Johannes Loher <johannesloher fg4f.de> writes:
Is it possible to forward the build type to the dependencies of a dub
project? For example, if I build my project with

dub build -b unittest

is it possible to make dub build the dependencies of my project also
with the unittest build type? Even better would be a way to specify for
which dependencies this should happen.

This would be useful for using dunit
(http://code.dlang.org/packages/dunit). When built with the unittest
build type, it replaces the default unittest handler to give nicer
output about which unittests failed and why etc. If I simply add dunit
as a dependency to my project and build my project as described above,
dunit is not built with the unittest build type and thus the unittest
handler is not replaced and I got the usual assertion error output for
failing unittests.

I tried removing the version(unittest) from the part of dunit, which
replaces the handler, but it always outputs some text, even if no
unittests are being run (if we don't compile with -unittest). Of course
I do not want this ouput when not testing and especially not in release
code...
Sep 07 2016
parent Sylvain Glaize <sglaize gmail.com> writes:
On Wednesday, 7 September 2016 at 16:46:18 UTC, Johannes Loher 
wrote:
 Is it possible to forward the build type to the dependencies of 
 a dub project? For example, if I build my project with
Hello, I have the exact same problem with this exact library, dunit. I was wondering why, running dunit own tests, I had the replacement test runner in place, but not when having it as a dependency to a separate application. After some tests, and being rather new to the D world, I understand that dunit as a library dependency will be linked (or compiled, if local) by dub without "-unittest", even if my application is compiled with --build=unittest (or by dub test). I changed dunit configuration to force it to compile in a unittest version, and then it works, but dub then yells at me that I should not do this, and that it would take care of these kind of flags... when it obsiously does not. So I have two questions: - how is dunit supposed to be linked to a dub described application? - why is the test runner in the shared this() compiled only in version(unittest)?
Mar 02 2017