implementing --version?
Basile B. via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Nov 21 15:50:09 PST 2016
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:
https://github.com/BBasile/Coedit/blob/master/cesetup/cesetup.d#L165
I don't use semVer but you basically get the method.
More information about the Digitalmars-d-learn
mailing list