Merge branch 'cpp-11' into crashlog_improvements
# Conflicts: # Makefile.src.in # projects/determineversion.vbs # source.list # src/crashlog.cpp # src/misc.cpp # src/os/unix/crashlog_unix.cpp # src/os/windows/crashlog_win.cpp # src/rev.h # src/thread/thread.h # src/thread/thread_morphos.cpp # src/thread/thread_none.cpp # src/thread/thread_os2.cpp # src/thread/thread_pthread.cpp # src/thread/thread_win32.cpp
This commit is contained in:
@@ -21,32 +21,45 @@ Sub FindReplaceInFile(filename, to_find, replacement)
|
||||
file.Close
|
||||
End Sub
|
||||
|
||||
Sub UpdateFile(modified, isodate, version, cur_date, filename)
|
||||
Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, isstabletag, 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
|
||||
FindReplaceInFile filename, "!!ISSTABLETAG!!", isstabletag
|
||||
FindReplaceInFile filename, "!!CONFIGURE_INVOCATION!!", ""
|
||||
End Sub
|
||||
|
||||
Sub UpdateFiles(version)
|
||||
Dim modified, isodate, cur_date
|
||||
Dim modified, isodate, cur_date, githash, istag, isstabletag
|
||||
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)
|
||||
isstabletag = Mid(istag, InStr(istag, 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)
|
||||
istag = Mid(istag, 1, InStr(istag, Chr(9)) - 1)
|
||||
Else
|
||||
isodate = 0
|
||||
modified = 1
|
||||
githash = ""
|
||||
istag = 0
|
||||
isstabletag = 0
|
||||
End If
|
||||
|
||||
UpdateFile modified, isodate, version, cur_date, "../src/rev.cpp"
|
||||
UpdateFile modified, isodate, version, cur_date, "../src/os/windows/ottdres.rc"
|
||||
UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/rev.cpp"
|
||||
UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/os/windows/ottdres.rc"
|
||||
End Sub
|
||||
|
||||
Function DetermineVersion()
|
||||
@@ -54,7 +67,7 @@ Function DetermineVersion()
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
On Error Resume Next
|
||||
|
||||
modified = 1
|
||||
modified = 0
|
||||
hash = ""
|
||||
shorthash = ""
|
||||
branch = ""
|
||||
@@ -72,7 +85,7 @@ Function DetermineVersion()
|
||||
|
||||
If oExec.ExitCode = 0 Then
|
||||
hash = oExec.StdOut.ReadLine()
|
||||
shorthash = Mid(hash, 1, 8)
|
||||
shorthash = Mid(hash, 1, 10)
|
||||
' Make sure index is in sync with disk
|
||||
Set oExec = WshShell.Exec("git update-index --refresh")
|
||||
If Err.Number = 0 Then
|
||||
@@ -133,21 +146,35 @@ Function DetermineVersion()
|
||||
rev_file.Close()
|
||||
ElseIf hash = "" Then
|
||||
DetermineVersion = "norev000"
|
||||
modified = 1
|
||||
Else
|
||||
Dim version
|
||||
Dim version, hashprefix, istag, isstabletag
|
||||
If modified = 0 Then
|
||||
hashprefix = "-g"
|
||||
ElseIf modified = 2 Then
|
||||
hashprefix = "-m"
|
||||
Else
|
||||
hashprefix = "-u"
|
||||
End If
|
||||
|
||||
If tag <> "" Then
|
||||
version = tag
|
||||
ElseIf branch = "master" Then
|
||||
version = isodate & "-g" & shorthash
|
||||
istag = 1
|
||||
|
||||
Set stable_regexp = New RegExp
|
||||
stable_regexp.Pattern = "^[0-9.]*$"
|
||||
If stable_regexp.Test(tag) Then
|
||||
isstabletag = 1
|
||||
Else
|
||||
isstabletag = 0
|
||||
End If
|
||||
Else
|
||||
version = isodate & "-" & branch & "-g" & shorthash
|
||||
version = isodate & "-" & branch & hashprefix & shorthash
|
||||
istag = 0
|
||||
isstabletag = 0
|
||||
End If
|
||||
|
||||
If modified = 2 Then
|
||||
version = version & "M"
|
||||
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 & Chr(9) & isstabletag
|
||||
End If
|
||||
End Function
|
||||
|
||||
|
Reference in New Issue
Block a user