mirror of https://github.com/OpenTTD/OpenTTD.git
Add: Detect stable tags automatically, and set the 'stable' flag in '_openttd_newgrf_version' accordingly. (#7317)
This commit is contained in:
parent
8016b8b3e9
commit
39cda89e85
|
@ -92,6 +92,7 @@ VERSION := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
|
||||||
ISODATE := $(shell echo "$(VERSIONS)" | cut -f 2 -d' ')
|
ISODATE := $(shell echo "$(VERSIONS)" | cut -f 2 -d' ')
|
||||||
GITHASH := $(shell echo "$(VERSIONS)" | cut -f 4 -d' ')
|
GITHASH := $(shell echo "$(VERSIONS)" | cut -f 4 -d' ')
|
||||||
ISTAG := $(shell echo "$(VERSIONS)" | cut -f 5 -d' ')
|
ISTAG := $(shell echo "$(VERSIONS)" | cut -f 5 -d' ')
|
||||||
|
ISSTABLETAG := $(shell echo "$(VERSIONS)" | cut -f 6 -d' ')
|
||||||
|
|
||||||
# Make sure we have something in VERSION and ISODATE
|
# Make sure we have something in VERSION and ISODATE
|
||||||
ifeq ($(VERSION),)
|
ifeq ($(VERSION),)
|
||||||
|
@ -277,10 +278,10 @@ endif
|
||||||
# Revision files
|
# Revision files
|
||||||
|
|
||||||
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
|
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
|
||||||
$(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g" > $(SRC_DIR)/rev.cpp
|
$(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g" > $(SRC_DIR)/rev.cpp
|
||||||
|
|
||||||
$(SRC_DIR)/os/windows/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/os/windows/ottdres.rc.in
|
$(SRC_DIR)/os/windows/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/os/windows/ottdres.rc.in
|
||||||
$(Q)cat $(SRC_DIR)/os/windows/ottdres.rc.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g" > $(SRC_DIR)/os/windows/ottdres.rc
|
$(Q)cat $(SRC_DIR)/os/windows/ottdres.rc.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g" > $(SRC_DIR)/os/windows/ottdres.rc
|
||||||
|
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
|
|
|
@ -83,9 +83,15 @@ if [ -d "$ROOT_DIR/.git" ]; then
|
||||||
if [ -n "$TAG" ]; then
|
if [ -n "$TAG" ]; then
|
||||||
VERSION="${TAG}"
|
VERSION="${TAG}"
|
||||||
ISTAG="1"
|
ISTAG="1"
|
||||||
|
if [ -n "`echo \"${TAG}\" | grep \"^[0-9.]*$\"`" ]; then
|
||||||
|
ISSTABLETAG="1"
|
||||||
|
else
|
||||||
|
ISSTABLETAG="0"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
VERSION="${ISODATE}-${BRANCH}${hashprefix}${SHORTHASH}"
|
VERSION="${ISODATE}-${BRANCH}${hashprefix}${SHORTHASH}"
|
||||||
ISTAG="0"
|
ISTAG="0"
|
||||||
|
ISSTABLETAG="0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
|
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
|
||||||
|
@ -102,6 +108,7 @@ else
|
||||||
TAG=""
|
TAG=""
|
||||||
VERSION=""
|
VERSION=""
|
||||||
ISTAG="0"
|
ISTAG="0"
|
||||||
|
ISSTABLETAG="0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG"
|
echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG $ISSTABLETAG"
|
||||||
|
|
|
@ -21,7 +21,7 @@ Sub FindReplaceInFile(filename, to_find, replacement)
|
||||||
file.Close
|
file.Close
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, filename)
|
Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, isstabletag, filename)
|
||||||
FSO.CopyFile filename & ".in", filename
|
FSO.CopyFile filename & ".in", filename
|
||||||
FindReplaceInFile filename, "!!MODIFIED!!", modified
|
FindReplaceInFile filename, "!!MODIFIED!!", modified
|
||||||
FindReplaceInFile filename, "!!ISODATE!!", isodate
|
FindReplaceInFile filename, "!!ISODATE!!", isodate
|
||||||
|
@ -29,10 +29,11 @@ Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, filename)
|
||||||
FindReplaceInFile filename, "!!DATE!!", cur_date
|
FindReplaceInFile filename, "!!DATE!!", cur_date
|
||||||
FindReplaceInFile filename, "!!GITHASH!!", githash
|
FindReplaceInFile filename, "!!GITHASH!!", githash
|
||||||
FindReplaceInFile filename, "!!ISTAG!!", istag
|
FindReplaceInFile filename, "!!ISTAG!!", istag
|
||||||
|
FindReplaceInFile filename, "!!ISSTABLETAG!!", isstabletag
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub UpdateFiles(version)
|
Sub UpdateFiles(version)
|
||||||
Dim modified, isodate, cur_date, githash, istag
|
Dim modified, isodate, cur_date, githash, istag, isstabletag
|
||||||
cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date)
|
cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date)
|
||||||
|
|
||||||
If InStr(version, Chr(9)) Then
|
If InStr(version, Chr(9)) Then
|
||||||
|
@ -41,20 +42,23 @@ Sub UpdateFiles(version)
|
||||||
modified = Mid(isodate, InStr(isodate, Chr(9)) + 1)
|
modified = Mid(isodate, InStr(isodate, Chr(9)) + 1)
|
||||||
githash = Mid(modified, InStr(modified, Chr(9)) + 1)
|
githash = Mid(modified, InStr(modified, Chr(9)) + 1)
|
||||||
istag = Mid(githash, InStr(githash, Chr(9)) + 1)
|
istag = Mid(githash, InStr(githash, Chr(9)) + 1)
|
||||||
|
isstabletag = Mid(istag, InStr(istag, Chr(9)) + 1)
|
||||||
' Remove tails from fields
|
' Remove tails from fields
|
||||||
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
|
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
|
||||||
isodate = Mid(isodate, 1, InStr(isodate, Chr(9)) - 1)
|
isodate = Mid(isodate, 1, InStr(isodate, Chr(9)) - 1)
|
||||||
modified = Mid(modified, 1, InStr(modified, Chr(9)) - 1)
|
modified = Mid(modified, 1, InStr(modified, Chr(9)) - 1)
|
||||||
githash = Mid(githash, 1, InStr(githash, Chr(9)) - 1)
|
githash = Mid(githash, 1, InStr(githash, Chr(9)) - 1)
|
||||||
|
istag = Mid(istag, 1, InStr(istag, Chr(9)) - 1)
|
||||||
Else
|
Else
|
||||||
isodate = 0
|
isodate = 0
|
||||||
modified = 1
|
modified = 1
|
||||||
githash = ""
|
githash = ""
|
||||||
istag = 0
|
istag = 0
|
||||||
|
isstabletag = 0
|
||||||
End If
|
End If
|
||||||
|
|
||||||
UpdateFile modified, isodate, version, cur_date, githash, istag, "../src/rev.cpp"
|
UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/rev.cpp"
|
||||||
UpdateFile modified, isodate, version, cur_date, githash, istag, "../src/os/windows/ottdres.rc"
|
UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/os/windows/ottdres.rc"
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Function DetermineVersion()
|
Function DetermineVersion()
|
||||||
|
@ -143,7 +147,7 @@ Function DetermineVersion()
|
||||||
DetermineVersion = "norev000"
|
DetermineVersion = "norev000"
|
||||||
modified = 1
|
modified = 1
|
||||||
Else
|
Else
|
||||||
Dim version, hashprefix, istag
|
Dim version, hashprefix, istag, isstabletag
|
||||||
If modified = 0 Then
|
If modified = 0 Then
|
||||||
hashprefix = "-g"
|
hashprefix = "-g"
|
||||||
ElseIf modified = 2 Then
|
ElseIf modified = 2 Then
|
||||||
|
@ -155,12 +159,21 @@ Function DetermineVersion()
|
||||||
If tag <> "" Then
|
If tag <> "" Then
|
||||||
version = tag
|
version = tag
|
||||||
istag = 1
|
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
|
Else
|
||||||
version = isodate & "-" & branch & hashprefix & shorthash
|
version = isodate & "-" & branch & hashprefix & shorthash
|
||||||
istag = 0
|
istag = 0
|
||||||
|
isstabletag = 0
|
||||||
End If
|
End If
|
||||||
|
|
||||||
DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash & Chr(9) & istag
|
DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash & Chr(9) & istag & Chr(9) & isstabletag
|
||||||
End If
|
End If
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ const byte _openttd_revision_tagged = !!ISTAG!!;
|
||||||
* final release will always have a lower version number than the released
|
* final release will always have a lower version number than the released
|
||||||
* version, thus making comparisons on specific revisions easy.
|
* version, thus making comparisons on specific revisions easy.
|
||||||
*/
|
*/
|
||||||
const uint32 _openttd_newgrf_version = 1 << 28 | 9 << 24 | 0 << 20 | 0 << 19 | 28004;
|
const uint32 _openttd_newgrf_version = 1 << 28 | 9 << 24 | 0 << 20 | !!ISSTABLETAG!! << 19 | 28004;
|
||||||
|
|
||||||
#ifdef __MORPHOS__
|
#ifdef __MORPHOS__
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue