How to inform dub of generated source files?

Bastiaan Veelo Bastiaan at Veelo.net
Thu May 17 17:42:21 UTC 2018


Hi,

Context: https://github.com/veelo/Pascal2D

One of my source files is generated by executing `cd source && 
rdmd generate.d`, which creates the file `source/epparser.d`. 
(There is actually one step in between, calling `rdmd make.d`, 
which checks creation times, but that's not relevant here).

I have added this step as preGenerateCommands in dub.json [1].

The problem is that the first time `dub build` is run, it does 
not seem to be aware of `source/epparser.d` and linking fails 
[2]. A second `dub build` succeeds.

Isn't preGenerateCommands meant to cover this case?

I can add `epparser.d` in an extra soureFile line in dub.json, 
which fixes the very first build, but that makes successive 
builds fail because it causes the file name to appear twice in 
the arguments to dmd once the file exists.

Changing preGenerateCommands into preBuildCommands makes no 
difference.


Thanks!
Bastiaan.

[1] https://github.com/veelo/Pascal2D/blob/master/dub.json#L22
[2] https://travis-ci.org/veelo/Pascal2D/builds/379096446#L511


More information about the Digitalmars-d-learn mailing list