Skip to content

Commit

Permalink
Better version number support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackerpilot committed Jan 29, 2015
1 parent feb097b commit e498d46
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ dscanner-report.json

#debug build
dsc

# Git hash
githash.txt
15 changes: 9 additions & 6 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ all: dmdbuild
ldc: ldcbuild
gdc: gdcbuild

githash:
git log -1 --format="%H" > githash.txt

debug:
${DMD} -w -g -ofdsc ${VERSIONS} ${DEBUG_VERSIONS} ${INCLUDE_PATHS} ${SRC}

dmdbuild:
dmdbuild: githash
mkdir -p bin
${DMD} -w -O -release -inline -ofbin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC}
${DMD} -w -O -release -inline -ofbin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC} -J.
rm -f bin/dscanner.o

gdcbuild:
gdcbuild: githash
mkdir -p bin
${GDC} -O3 -frelease -obin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC}
${GDC} -O3 -frelease -obin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC} -J.

ldcbuild:
ldcbuild: githash
mkdir -p bin
${LDC} -O5 -release -oq -of=bin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC}
${LDC} -O5 -release -oq -of=bin/dscanner ${VERSIONS} ${INCLUDE_PATHS} ${SRC} -J.

test:
@./test.sh
Expand Down
20 changes: 20 additions & 0 deletions src/dscanner_version.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright Brian Schott (Hackerpilot) 2015.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

module dscanner_version;

/**
* Human-readable version number
*/
enum DSCANNER_VERSION = "v0.2.0-dev";

version (Windows) {}
else
{
/**
* Current build's Git commit hash
*/
enum GIT_HASH = import("githash.txt");
}
6 changes: 5 additions & 1 deletion src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import outliner;
import symbol_finder;
import analysis.run;
import analysis.config;
import dscanner_version;

import inifiled;

Expand Down Expand Up @@ -101,7 +102,10 @@ int run(string[] args)

if (printVersion)
{
writeln("v0.1.0");
version (Windows)
writeln(DSCANNER_VERSION);
else
write(DSCANNER_VERSION, " ", GIT_HASH);
return 0;
}

Expand Down

0 comments on commit e498d46

Please sign in to comment.