diff options
Diffstat (limited to 'projects/determineversion.vbs')
-rwxr-xr-x | projects/determineversion.vbs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs index 98c704553..a2f348faf 100755 --- a/projects/determineversion.vbs +++ b/projects/determineversion.vbs @@ -21,34 +21,40 @@ Sub FindReplaceInFile(filename, to_find, replacement) file.Close End Sub -Sub UpdateFile(modified, isodate, version, cur_date, githash, filename) +Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, filename) FSO.CopyFile filename & ".in", filename FindReplaceInFile filename, "!!MODIFIED!!", modified FindReplaceInFile filename, "!!ISODATE!!", isodate FindReplaceInFile filename, "!!VERSION!!", version FindReplaceInFile filename, "!!DATE!!", cur_date FindReplaceInFile filename, "!!GITHASH!!", githash + FindReplaceInFile filename, "!!ISTAG!!", istag End Sub Sub UpdateFiles(version) - Dim modified, isodate, cur_date, githash + Dim modified, isodate, cur_date, githash, istag cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date) If InStr(version, Chr(9)) Then + ' Split string into field with tails isodate = Mid(version, InStr(version, Chr(9)) + 1) modified = Mid(isodate, InStr(isodate, Chr(9)) + 1) githash = Mid(modified, InStr(modified, Chr(9)) + 1) + istag = Mid(githash, InStr(githash, Chr(9)) + 1) + ' Remove tails from fields + version = Mid(version, 1, InStr(version, Chr(9)) - 1) isodate = Mid(isodate, 1, InStr(isodate, Chr(9)) - 1) modified = Mid(modified, 1, InStr(modified, Chr(9)) - 1) - version = Mid(version, 1, InStr(version, Chr(9)) - 1) + githash = Mid(githash, 1, InStr(githash, Chr(9)) - 1) Else isodate = 0 modified = 1 githash = "" + istag = 0 End If - UpdateFile modified, isodate, version, cur_date, githash, "../src/rev.cpp" - UpdateFile modified, isodate, version, cur_date, githash, "../src/os/windows/ottdres.rc" + UpdateFile modified, isodate, version, cur_date, githash, istag, "../src/rev.cpp" + UpdateFile modified, isodate, version, cur_date, githash, istag, "../src/os/windows/ottdres.rc" End Sub Function DetermineVersion() @@ -137,7 +143,7 @@ Function DetermineVersion() DetermineVersion = "norev000" modified = 1 Else - Dim version, hashprefix + Dim version, hashprefix, istag If modified = 0 Then hashprefix = "-g" ElseIf modified = 2 Then @@ -148,11 +154,13 @@ Function DetermineVersion() If tag <> "" Then version = tag + istag = 1 Else version = isodate & "-" & branch & hashprefix & shorthash + istag = 0 End If - DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash + DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash & Chr(9) & istag End If End Function |