Use git --describe tags as version string

This commit is contained in:
Sebastian Wilzbach 2018-04-06 09:28:27 +02:00
parent b03adf1dff
commit d96b48f765
3 changed files with 6 additions and 10 deletions

View File

@ -36,7 +36,7 @@ ldc: ldcbuild
gdc: gdcbuild
githash:
git log -1 --format="%H" > githash.txt
git describe --tags > githash.txt
debug:
${DC} -w -g -J. -ofdsc ${VERSIONS} ${DEBUG_VERSIONS} ${INCLUDE_PATHS} ${SRC}

View File

@ -8,19 +8,20 @@ module dscanner.dscanner_version;
/**
* Human-readable version number
*/
enum DSCANNER_VERSION = "v0.4.0";
enum DEFAUULT_DSCANNER_VERSION = "v0.5.0";
version (built_with_dub)
{
enum GIT_HASH = import("dubhash.txt");
enum DSCANNER_VERSION = import("dubhash.txt");
}
else version (Windows)
{
enum DSCANNER_VERSION = DEFAUULT_DSCANNER_VERSION;
}
else
{
/**
* Current build's Git commit hash
*/
enum GIT_HASH = import("githash.txt");
enum DSCANNER_VERSION = import("githash.txt");
}

View File

@ -139,12 +139,7 @@ else
if (printVersion)
{
version (Windows)
writeln(DSCANNER_VERSION);
else version (built_with_dub)
writeln(DSCANNER_VERSION);
else
write(DSCANNER_VERSION, " ", GIT_HASH);
write(DSCANNER_VERSION);
return 0;
}