[Premake] Add feature branch name to version string.

This commit is contained in:
/dev/urandom 2019-10-02 11:30:01 +02:00
parent b828d447cf
commit 261e76ee36
No known key found for this signature in database
GPG Key ID: 41322B973E0F295E

View File

@ -1,4 +1,5 @@
gitVersioningCommand = "git describe --tags --dirty --always"
gitCurrentBranchCommand = "git symbolic-ref -q --short HEAD"
-- Quote the given string input as a C string
function cstrquote(value)
@ -86,8 +87,19 @@ newaction {
local proc = assert(io.popen(gitVersioningCommand, "r"))
local gitDescribeOutput = assert(proc:read('*a')):gsub("%s+", "")
proc:close()
local version = gitDescribeOutput
print(gitDescribeOutput)
proc = assert(io.popen(gitCurrentBranchCommand, "r"))
local gitCurrentBranchOutput = assert(proc:read('*a')):gsub("%s+", "")
local gitCurrentBranchSuccess = proc:close()
if gitCurrentBranchSuccess then
-- We got a branch name, check if it is a feature branch
if gitCurrentBranchOutput ~= "develop" and gitCurrentBranchOutput ~= "master" then
version = version .. "-" .. gitCurrentBranchOutput
end
end
print(version)
os.exit(0)
end
}