On 01.02.18 22:44, Jacob Carlborg wrote:

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

Does this also work for you when you add versions to libraries?
Is $PACKAGE_DIR always set to the package, that is just build?
e.g. an executable has a dependency to a libarary with a version.