From e55f48dbe24cf72312c8bb62ca28fd61fd14a104 Mon Sep 17 00:00:00 2001 From: /dev/urandom Date: Sun, 17 Jan 2016 21:47:40 +0100 Subject: [PATCH] premake5: Add "version" command which prints the version string. Needed for the CI to apply build naming by revision number. --- premake5.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/premake5.lua b/premake5.lua index 4568cee6..abe92d2f 100644 --- a/premake5.lua +++ b/premake5.lua @@ -11,6 +11,20 @@ newoption { description = "Do not use new virtual path structure (separating headers and source files)." } +newaction { + trigger = "version", + description = "Returns the version string for the current commit of the source code.", + onWorkspace = function(wks) + -- get revision number via git + local proc = assert(io.popen("git rev-list --count HEAD", "r")) + local revNumber = assert(proc:read('*a')):gsub("%s+", "") + proc:close() + + print(revNumber) + os.exit(0) + end +} + newaction { trigger = "generate-buildinfo", description = "Sets up build information file like version.h.",