Does dub support generating source files?

Bastiaan Veelo Bastiaan at Veelo.net
Sat Jan 6 13:23:59 UTC 2018


Hi,

One of my source files (epparser.d) should be generated by 
calling rdmd on another soure file (make.d) and therefore should 
depend on changes in make.d and an additional module 
(epgrammar.d). An include path to Pegged is required for 
compilation. epparser.d should be part of the main project, but 
make.d and epgrammar.d should not. I have tried using a dub 
subpackage for this with preBuildCommands ("cd ./subpackage && 
dub run") in the main project, but that doesn't update epparser.d 
when epgrammar.d changes (oddly enough; is does update when 
subpackage targetType is "library", but it must be "executable"). 
epparser.d should not be generated unnecessarily.

I could script a custom preBuildCommand that checks modification 
dates and supplies the Pegged include path explicitly but that 
seems hackish and non-portable and typically something that the 
build system should do.

Can dub do this or is this a thing for reggae? It must work on 
Windows though.

Thanks!


More information about the Digitalmars-d-learn mailing list