[+] Added support for Aurora release dates in Version.json handler
This commit is contained in:
parent
21e2df1ebb
commit
af12c8ac8c
@ -1,4 +1,20 @@
|
|||||||
local function doAction()
|
local function GetSnapshotName(full)
|
||||||
|
local strYear = os.date("%y")
|
||||||
|
local strMon = os.date("%m")
|
||||||
|
local iWeekOffset = tonumber(os.date("%w")) - 1
|
||||||
|
local iDayOffset = tonumber(os.date("%d"))
|
||||||
|
local iWeekIdxOffset = math.floor(iDayOffset / 7)
|
||||||
|
local bWeekTest = iWeekOffset > 2
|
||||||
|
local cWeekBase = "A"
|
||||||
|
if (bWeekTest) then cWeekBase = "a" else cWeekBase = "A" end
|
||||||
|
if (iWeekIdxOffset > 4) then iWeekIdxOffset = 4 end
|
||||||
|
local cWeekChar = string.char(string.byte(cWeekBase) + iWeekIdxOffset)
|
||||||
|
|
||||||
|
if (not full) then strYear = strYear:sub(2, 2) end
|
||||||
|
return strYear .. strMon .. cWeekChar
|
||||||
|
end
|
||||||
|
|
||||||
|
local function DoAction()
|
||||||
local projectName = auBuild.projectName
|
local projectName = auBuild.projectName
|
||||||
local version = auBuild.projectRoot .. "/Version.json"
|
local version = auBuild.projectRoot .. "/Version.json"
|
||||||
|
|
||||||
@ -15,12 +31,22 @@ local function doAction()
|
|||||||
local versionHPP = auBuild.projectRoot .. "/Source/" .. prjex .. "Version.hpp"
|
local versionHPP = auBuild.projectRoot .. "/Source/" .. prjex .. "Version.hpp"
|
||||||
local versionC = auBuild.projectRoot .. "/Source/" .. prjex .. "Version.c"
|
local versionC = auBuild.projectRoot .. "/Source/" .. prjex .. "Version.c"
|
||||||
|
|
||||||
if (manifest.patch and manifest.incrementPatchOnBuild) then
|
local patchVer = 0
|
||||||
manifest.patch = manifest.patch + 1;
|
|
||||||
|
if (manifest.patch) then
|
||||||
|
patchVer = manifest.patch
|
||||||
|
|
||||||
|
if (manifest.incrementPatchOnBuild) then
|
||||||
|
manifest.patch = patchVer + 1;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local includeGit = manifest.includeGit
|
local includeGit = manifest.includeGit
|
||||||
|
local includeARD = manifest.includeARD
|
||||||
|
local includeARDExtended = manifest.includeARDExtended
|
||||||
|
local includeARDFull = manifest.includeARDFull
|
||||||
|
|
||||||
|
local relString = ""
|
||||||
local commitString = ""
|
local commitString = ""
|
||||||
|
|
||||||
if (includeGit) then
|
if (includeGit) then
|
||||||
@ -33,11 +59,19 @@ local function doAction()
|
|||||||
commitString = result
|
commitString = result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (includeARD) then
|
||||||
|
relString = GetSnapshotName(includeARDFull)
|
||||||
|
|
||||||
|
if (includeARDExtended) then
|
||||||
|
relString = relString .. patchVer
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
io.writefile(version, json.encode_pretty(manifest))
|
io.writefile(version, json.encode_pretty(manifest))
|
||||||
|
|
||||||
if (manifest.patch) then
|
if (manifest.patch) then
|
||||||
manifest.patch = manifest.patch - 1;
|
manifest.patch = patchVer
|
||||||
end
|
end
|
||||||
|
|
||||||
local hheader = manifest.hheader or ""
|
local hheader = manifest.hheader or ""
|
||||||
@ -62,8 +96,8 @@ local function doAction()
|
|||||||
|
|
||||||
local vis = nil
|
local vis = nil
|
||||||
|
|
||||||
if (manifest.visability) then
|
if (manifest.visibility) then
|
||||||
vis = manifest.visability .. " "
|
vis = manifest.visibility .. " "
|
||||||
else
|
else
|
||||||
vis = ""
|
vis = ""
|
||||||
end
|
end
|
||||||
@ -98,6 +132,15 @@ extern "C"
|
|||||||
cHeaderGitExt = string.format(cHeaderGitExt, vis, projectName)
|
cHeaderGitExt = string.format(cHeaderGitExt, vis, projectName)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (includeARD) then
|
||||||
|
local hARDFooter = [[
|
||||||
|
|
||||||
|
|
||||||
|
%sconst char *Get%sAuroraReleaseDate();]]
|
||||||
|
|
||||||
|
cHeaderGitExt = cHeaderGitExt .. string.format(hARDFooter, vis, projectName)
|
||||||
|
end
|
||||||
|
|
||||||
local formattedChTemplate = string.format(chTemplate,
|
local formattedChTemplate = string.format(chTemplate,
|
||||||
hheader,
|
hheader,
|
||||||
vis, projectName,
|
vis, projectName,
|
||||||
@ -199,7 +242,6 @@ extern "C"
|
|||||||
local strMajor = manifest.major or "0"
|
local strMajor = manifest.major or "0"
|
||||||
local gitFooter = ""
|
local gitFooter = ""
|
||||||
|
|
||||||
|
|
||||||
if (includeGit) then
|
if (includeGit) then
|
||||||
gitFooter = [[
|
gitFooter = [[
|
||||||
|
|
||||||
@ -211,6 +253,24 @@ extern "C"
|
|||||||
gitFooter = string.format(gitFooter, vis, projectName, "\"" .. commitString .. "\"")
|
gitFooter = string.format(gitFooter, vis, projectName, "\"" .. commitString .. "\"")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (manifest.includeARD) then
|
||||||
|
local atfooter = [[
|
||||||
|
|
||||||
|
%sconst char *Get%sAuroraReleaseDate()
|
||||||
|
{
|
||||||
|
return %s;
|
||||||
|
}]]
|
||||||
|
|
||||||
|
if (includeGit) then
|
||||||
|
atfooter = [[
|
||||||
|
|
||||||
|
]] .. atfooter
|
||||||
|
end
|
||||||
|
|
||||||
|
atfooter = string.format(atfooter, vis, projectName, "\"" .. relString .. "\"")
|
||||||
|
|
||||||
|
gitFooter = gitFooter .. atfooter
|
||||||
|
end
|
||||||
|
|
||||||
local formattedCTemplate = string.format(cTemplate,
|
local formattedCTemplate = string.format(cTemplate,
|
||||||
cheader,
|
cheader,
|
||||||
@ -225,4 +285,4 @@ extern "C"
|
|||||||
io.writefile(versionC, formattedCTemplate)
|
io.writefile(versionC, formattedCTemplate)
|
||||||
end
|
end
|
||||||
|
|
||||||
return doAction
|
return DoAction
|
Loading…
Reference in New Issue
Block a user