summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <github@elsenhans.name>2019-03-03 20:08:28 +0100
committerGitHub <noreply@github.com>2019-03-03 20:08:28 +0100
commit39cda89e858325cf4c8b76a78566d96294d95b43 (patch)
treed92131ebdaf320c5c43767f62a265a439c297529
parent8016b8b3e9f0e1c0190a3dba74ba4d02ed6053c1 (diff)
downloadopenttd-39cda89e858325cf4c8b76a78566d96294d95b43.tar.xz
Add: Detect stable tags automatically, and set the 'stable' flag in '_openttd_newgrf_version' accordingly. (#7317)
-rw-r--r--Makefile.src.in5
-rwxr-xr-xfindversion.sh9
-rwxr-xr-xprojects/determineversion.vbs25
-rw-r--r--src/rev.cpp.in2
4 files changed, 31 insertions, 10 deletions
diff --git a/Makefile.src.in b/Makefile.src.in
index 19231d45c..6b235be9d 100644
--- a/Makefile.src.in
+++ b/Makefile.src.in
@@ -92,6 +92,7 @@ VERSION := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
ISODATE := $(shell echo "$(VERSIONS)" | cut -f 2 -d' ')
GITHASH := $(shell echo "$(VERSIONS)" | cut -f 4 -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
ifeq ($(VERSION),)
@@ -277,10 +278,10 @@ endif
# Revision files
$(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
- $(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:
diff --git a/findversion.sh b/findversion.sh
index 37e483cae..95a041bac 100755
--- a/findversion.sh
+++ b/findversion.sh
@@ -83,9 +83,15 @@ if [ -d "$ROOT_DIR/.git" ]; then
if [ -n "$TAG" ]; then
VERSION="${TAG}"
ISTAG="1"
+ if [ -n "`echo \"${TAG}\" | grep \"^[0-9.]*$\"`" ]; then
+ ISSTABLETAG="1"
+ else
+ ISSTABLETAG="0"
+ fi
else
VERSION="${ISODATE}-${BRANCH}${hashprefix}${SHORTHASH}"
ISTAG="0"
+ ISSTABLETAG="0"
fi
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
@@ -102,6 +108,7 @@ else
TAG=""
VERSION=""
ISTAG="0"
+ ISSTABLETAG="0"
fi
-echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG"
+echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG $ISSTABLETAG"
diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs
index a2f348faf..10b38d35a 100755
--- a/projects/determineversion.vbs
+++ b/projects/determineversion.vbs
@@ -21,7 +21,7 @@ Sub FindReplaceInFile(filename, to_find, replacement)
file.Close
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
FindReplaceInFile filename, "!!MODIFIED!!", modified
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, "!!GITHASH!!", githash
FindReplaceInFile filename, "!!ISTAG!!", istag
+ FindReplaceInFile filename, "!!ISSTABLETAG!!", isstabletag
End Sub
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)
If InStr(version, Chr(9)) Then
@@ -41,20 +42,23 @@ Sub UpdateFiles(version)
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)
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, githash, istag, "../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/rev.cpp"
+ UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/os/windows/ottdres.rc"
End Sub
Function DetermineVersion()
@@ -143,7 +147,7 @@ Function DetermineVersion()
DetermineVersion = "norev000"
modified = 1
Else
- Dim version, hashprefix, istag
+ Dim version, hashprefix, istag, isstabletag
If modified = 0 Then
hashprefix = "-g"
ElseIf modified = 2 Then
@@ -155,12 +159,21 @@ Function DetermineVersion()
If tag <> "" Then
version = tag
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 & hashprefix & shorthash
istag = 0
+ isstabletag = 0
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 Function
diff --git a/src/rev.cpp.in b/src/rev.cpp.in
index b4855d4cc..2d58bb152 100644
--- a/src/rev.cpp.in
+++ b/src/rev.cpp.in
@@ -82,7 +82,7 @@ const byte _openttd_revision_tagged = !!ISTAG!!;
* final release will always have a lower version number than the released
* 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__
/**