mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-18 03:59:09 +00:00
Codechange: Include flag for whether a build is of a tagged revision
This commit is contained in:
committed by
Charles Pigott
parent
412e6132b6
commit
46d97239c4
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user