Include current git commit hash in --version output
This commit is contained in:
parent
38b61f8c5d
commit
29c6fe9f79
48
makefile
48
makefile
|
@ -6,9 +6,12 @@ debug: dmdclient debugserver
|
|||
gdc: gdcserver gdcclient
|
||||
ldc: ldcserver ldcclient
|
||||
|
||||
DMD = dmd
|
||||
GDC = gdc
|
||||
LDC = ldc2
|
||||
DMD := dmd
|
||||
GDC := gdc
|
||||
LDC := ldc2
|
||||
|
||||
githash:
|
||||
git log -n 1 --oneline | cut -f 1 -d ' ' > githash.txt
|
||||
|
||||
report:
|
||||
dscanner --report src > dscanner-report.json
|
||||
|
@ -17,34 +20,38 @@ report:
|
|||
clean:
|
||||
rm -rf bin
|
||||
rm -f dscanner-report.json
|
||||
rm -f githash.txt
|
||||
|
||||
CLIENT_SRC = src/client.d\
|
||||
CLIENT_SRC := src/client.d\
|
||||
src/messages.d\
|
||||
src/stupidlog.d\
|
||||
src/dcd_version.d\
|
||||
msgpack-d/src/msgpack.d
|
||||
|
||||
DMD_CLIENT_FLAGS = -Imsgpack-d/src\
|
||||
DMD_CLIENT_FLAGS := -Imsgpack-d/src\
|
||||
-Imsgpack-d/src\
|
||||
-J.\
|
||||
-release\
|
||||
-inline\
|
||||
-O\
|
||||
-wi\
|
||||
-ofbin/dcd-client
|
||||
|
||||
GDC_CLIENT_FLAGS = -Imsgpack-d/src\
|
||||
GDC_CLIENT_FLAGS := -Imsgpack-d/src\
|
||||
-J.\
|
||||
-O3\
|
||||
-frelease\
|
||||
-obin/dcd-client
|
||||
|
||||
LDC_CLIENT_FLAGS = -Imsgpack-d/src\
|
||||
LDC_CLIENT_FLAGS := -Imsgpack-d/src\
|
||||
-Imsgpack-d/src\
|
||||
-J=.\
|
||||
-release\
|
||||
-O5\
|
||||
-oq\
|
||||
-of=bin/dcd-client
|
||||
|
||||
SERVER_SRC = src/actypes.d\
|
||||
SERVER_SRC := src/actypes.d\
|
||||
src/conversion/astconverter.d\
|
||||
src/conversion/first.d\
|
||||
src/conversion/second.d\
|
||||
|
@ -77,65 +84,68 @@ SERVER_SRC = src/actypes.d\
|
|||
containers/src/containers/slist.d\
|
||||
msgpack-d/src/msgpack.d
|
||||
|
||||
DMD_SERVER_FLAGS = -Icontainers/src\
|
||||
DMD_SERVER_FLAGS := -Icontainers/src\
|
||||
-Imsgpack-d/src\
|
||||
-Ilibdparse/src\
|
||||
-J.\
|
||||
-wi\
|
||||
-O\
|
||||
-release\
|
||||
-inline\
|
||||
-ofbin/dcd-server
|
||||
|
||||
DEBUG_SERVER_FLAGS = -Icontainers/src\
|
||||
DEBUG_SERVER_FLAGS := -Icontainers/src\
|
||||
-Imsgpack-d/src\
|
||||
-Ilibdparse/src\
|
||||
-wi\
|
||||
-g\
|
||||
-ofbin/dcd-server
|
||||
|
||||
GDC_SERVER_FLAGS = -Icontainers/src\
|
||||
GDC_SERVER_FLAGS := -Icontainers/src\
|
||||
-Imsgpack-d/src\
|
||||
-Ilibdparse/src\
|
||||
-J.\
|
||||
-O3\
|
||||
-frelease\
|
||||
-obin/dcd-server
|
||||
|
||||
LDC_SERVER_FLAGS = -Icontainers/src\
|
||||
LDC_SERVER_FLAGS := -Icontainers/src\
|
||||
-Imsgpack-d/src\
|
||||
-Ilibdparse/src\
|
||||
-J=.\
|
||||
-O5\
|
||||
-release\
|
||||
-oq\
|
||||
-of=bin/dcd-server
|
||||
|
||||
dmdclient:
|
||||
dmdclient: githash
|
||||
mkdir -p bin
|
||||
rm -f containers/src/std/allocator.d
|
||||
${DMD} ${CLIENT_SRC} ${DMD_CLIENT_FLAGS}
|
||||
|
||||
dmdserver:
|
||||
dmdserver: githash
|
||||
mkdir -p bin
|
||||
rm -f containers/src/std/allocator.d
|
||||
${DMD} ${SERVER_SRC} ${DMD_SERVER_FLAGS}
|
||||
|
||||
debugserver:
|
||||
debugserver: githash
|
||||
mkdir -p bin
|
||||
rm -f containers/src/std/allocator.d
|
||||
${DMD} ${SERVER_SRC} ${DEBUG_SERVER_FLAGS}
|
||||
|
||||
|
||||
gdcclient:
|
||||
gdcclient: githash
|
||||
mkdir -p bin
|
||||
rm -f containers/src/std/allocator.d
|
||||
${GDC} ${CLIENT_SRC} ${GDC_CLIENT_FLAGS}
|
||||
|
||||
gdcserver:
|
||||
gdcserver: githash
|
||||
mkdir -p bin
|
||||
rm -f containers/src/std/allocator.d
|
||||
${GDC} ${SERVER_SRC} ${GDC_SERVER_FLAGS}
|
||||
|
||||
ldcclient:
|
||||
ldcclient: githash
|
||||
${LDC} ${CLIENT_SRC} ${LDC_CLIENT_FLAGS}
|
||||
|
||||
ldcserver:
|
||||
ldcserver: githash
|
||||
${LDC} ${SERVER_SRC} ${LDC_SERVER_FLAGS}
|
||||
|
|
|
@ -67,7 +67,10 @@ int main(string[] args)
|
|||
|
||||
if (printVersion)
|
||||
{
|
||||
writeln(DCD_VERSION);
|
||||
version (Windows)
|
||||
writeln(DCD_VERSION);
|
||||
else
|
||||
write(DCD_VERSION, " ", GIT_HASH);
|
||||
return 0;
|
||||
}
|
||||
else if (help)
|
||||
|
|
|
@ -19,3 +19,4 @@
|
|||
module dcd_version;
|
||||
|
||||
enum DCD_VERSION = "v0.4.0";
|
||||
version (Windows) {} else enum GIT_HASH = import("githash.txt");
|
||||
|
|
|
@ -76,7 +76,10 @@ int main(string[] args)
|
|||
|
||||
if (printVersion)
|
||||
{
|
||||
writeln(DCD_VERSION);
|
||||
version (Windows)
|
||||
writeln(DCD_VERSION);
|
||||
else
|
||||
write(DCD_VERSION, " ", GIT_HASH);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue