Re: How to inform dub of generated source files?

2018-05-17 Thread Bastiaan Veelo via Digitalmars-d-learn

On Thursday, 17 May 2018 at 17:42:21 UTC, Bastiaan Veelo wrote:

Isn't preGenerateCommands meant to cover this case?


Appears to be a bug. Filed 
https://github.com/dlang/dub/issues/1474


How to inform dub of generated source files?

2018-05-17 Thread Bastiaan Veelo via Digitalmars-d-learn

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