On Monday, 21 November 2016 at 23:46:41 UTC, Basile B. wrote:
On Monday, 21 November 2016 at 21:32:16 UTC, mab-on wrote:
What i want is a clever mechanism to store the SemVer (or Commit-ID) in the binary at compiletime - automatically. Otherwise i have to think to update a const in the code every time i build a new Version.

    enum versionData = import("version.dat");
    enum min = anyCTFEFunctionThatParsesMin(versionData);
    enum maj = anyCTFEFunctionThatParsesMaj(versionData);
    // etc... you can even use compile-time regex...

The path to the file "version.dat" must be specified with the -J DMD command line. Generating the file is another story, maybe a git script could do that.

I have an example here:


I don't use semVer but you basically get the method.

Reply via email to