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