On Thu, 24 Oct 2013 08:24:46 +0200, Sönke Ludwig wrote:

Am 22.10.2013 16:16, schrieb Alexandr Druzninin:

I use preBuildCommands to run simple d program that using results of git commands generates gitinfo.d file with current git commit hash and datetime to include in binary. All works fine but only the second time. The first time preBuildCommands executes and gitinfo.d file is generated as expected and project compiles but linking fails - and only the first time. I suspect it's due to internal structure of dub, but don't know it yet. How can I solve this annoying issue?

The problem here is that the source file list has already been assembled
before the "generate" and "build" phases.It should be possible to work
around that by using the "sourceFiles" field (e.g. "sourceFiles": <br>["source/gitinfo.d"]).

And it's not possible right now, but I think it would be useful to shift
the collection of files to the "generate" phase, so that the
"preGenerateCommands" field could be used instead. I've created issue
for this.

I see. But I guess preGenerateCommands run only one time, not every building?