On 2018-01-31 18:50, Russel Winder wrote:

SCons, Autotools, CMake, Meson, and others all assume the current application (or library) version is specified in the build configuration file. This can be transferred to being embedded in the executable by stream editing a template file and compiling it in.

Dub appears not to support this way of working, unless of course I am just missing it.

So what is the way of specifying the application version in Dub builds, and what is the canonical way of getting this data into the built executable?

I use a preGenerateCommand that outputs the version to a file [1]. Then
using an import expression to get the version into the executable [2].

[1] https://github.com/jacob-carlborg/dstep/blob/master/dub.json#L18
[2]
https://github.com/jacob-carlborg/dstep/blob/master/dstep/Configuration.d#L18

/Jacob Carlborg