www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Dub pre-build hook

reply Chris Wright <dhasenan gmail.com> writes:
Is there a way to write a pre-build hook in Dub?

Specifically, I want to write unittests in a separate package to the rest 
of my source code. This requires a module that imports all my unittest 
modules. It's safer to automatically generate this than to rely on my 
memory.

My other alternative is to write a D script that assembles this file and 
then invokes dub, and always invoke dub via that script.
Jan 10
parent Chris Wright <dhasenan gmail.com> writes:
On Sun, 10 Jan 2016 16:34:51 +0000, Chris Wright wrote:

 Is there a way to write a pre-build hook in Dub?
 
 Specifically, I want to write unittests in a separate package to the
 rest of my source code. This requires a module that imports all my
 unittest modules. It's safer to automatically generate this than to rely
 on my memory.
 
 My other alternative is to write a D script that assembles this file and
 then invokes dub, and always invoke dub via that script.
I write this and immediately see preBuildCommands and preGenerateCommands. I'm not sure what the difference is, though. I think preBuildCommands is the way to go (and preGenerateCommands is maybe for generating project files). I'll give it a shot and see how it turns out.
Jan 10