RejectedSoftware Forums

Sign up

Difference between preGenerate- and preBuildCommands

Dear all,

I really enjoy working with dub. In the last weeks I played around with
preGenerate- and preBuildCommands. It seems, that preBuildCommands are
not always executed (e.g. if you build a dependency that is pulled from
the dub repository), whereas preGenerateCommands are run more often.
Could somebody describe whats going on there?

Christian Köstlin

Re: Difference between preGenerate- and preBuildCommands

Am 17.02.2018 um 10:37 schrieb Christian Köstlin:

Dear all,

I really enjoy working with dub. In the last weeks I played around with
preGenerate- and preBuildCommands. It seems, that preBuildCommands are
not always executed (e.g. if you build a dependency that is pulled from
the dub repository), whereas preGenerateCommands are run more often.
Could somebody describe whats going on there?

Christian Köstlin

preBuildCommands are supposed to get executed right before a certain
package is actually built, so they get skipped when there is already a
cached build result. On the other hand, they will also execute within a
foreign build tool, for example when generating a VisualStudio solution.

preGenerateCommands on the other hand are always executed before the
project is "generated". For the default mode where DUB itself is the
builder, this means for every invocation. For other generators (e.g.
VisualD) it means just once when "dub generate visuald" is executed, but
never within VisualStudio itself.

Re: Difference between preGenerate- and preBuildCommands

On 18.02.18 10:19, Sönke Ludwig wrote:

Am 17.02.2018 um 10:37 schrieb Christian Köstlin:

Dear all,

I really enjoy working with dub. In the last weeks I played around with
preGenerate- and preBuildCommands. It seems, that preBuildCommands are
not always executed (e.g. if you build a dependency that is pulled from
the dub repository), whereas preGenerateCommands are run more often.
Could somebody describe whats going on there?

Christian Köstlin

preBuildCommands are supposed to get executed right before a certain
package is actually built, so they get skipped when there is already a
cached build result. On the other hand, they will also execute within a
foreign build tool, for example when generating a VisualStudio solution.

preGenerateCommands on the other hand are always executed before the
project is "generated". For the default mode where DUB itself is the
builder, this means for every invocation. For other generators (e.g.
VisualD) it means just once when "dub generate visuald" is executed, but
never within VisualStudio itself.

thanks for the explanation. it looks like preBuildCommands would be the
one that is right for me (I want to generate a version information
module for a dub package). Strangely this does not work out all the
time, and with dub preGenerateCommands are always executed (which is
what I need at the moment).

Is dub caching static/dynamic libraries for dependencies of a project?

Christian