summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Martin Hansen <nielsm@indvikleren.dk>2019-02-10 18:01:30 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-02-12 21:32:43 +0000
commit46d97239c4aaead07e61f676fa88268b5b5208fa (patch)
tree3066405f23277f8aab0d743cd1e4e13603f83668
parent412e6132b60ad5db8912643befb0b895f4e11710 (diff)
downloadopenttd-46d97239c4aaead07e61f676fa88268b5b5208fa.tar.xz
Codechange: Include flag for whether a build is of a tagged revision
-rw-r--r--Makefile.src.in5
-rwxr-xr-xfindversion.sh5
-rwxr-xr-xprojects/determineversion.vbs22
-rw-r--r--src/rev.cpp.in7
-rw-r--r--src/rev.h1
5 files changed, 30 insertions, 10 deletions
diff --git a/Makefile.src.in b/Makefile.src.in
index 94534fd60..19231d45c 100644
--- a/Makefile.src.in
+++ b/Makefile.src.in
@@ -91,6 +91,7 @@ MODIFIED := $(shell echo "$(VERSIONS)" | cut -f 3 -d' ')
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' ')
# Make sure we have something in VERSION and ISODATE
ifeq ($(VERSION),)
@@ -276,10 +277,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" > $(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" > $(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" > $(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" > $(SRC_DIR)/os/windows/ottdres.rc
FORCE:
diff --git a/findversion.sh b/findversion.sh
index 5d2322adb..37e483cae 100755
--- a/findversion.sh
+++ b/findversion.sh
@@ -82,8 +82,10 @@ if [ -d "$ROOT_DIR/.git" ]; then
if [ -n "$TAG" ]; then
VERSION="${TAG}"
+ ISTAG="1"
else
VERSION="${ISODATE}-${BRANCH}${hashprefix}${SHORTHASH}"
+ ISTAG="0"
fi
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
@@ -99,6 +101,7 @@ else
ISODATE=""
TAG=""
VERSION=""
+ ISTAG="0"
fi
-echo "$VERSION $ISODATE $MODIFIED $HASH"
+echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG"
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
diff --git a/src/rev.cpp.in b/src/rev.cpp.in
index 3c68e18eb..b4855d4cc 100644
--- a/src/rev.cpp.in
+++ b/src/rev.cpp.in
@@ -63,6 +63,13 @@ const char _openttd_revision_hash[] = "!!GITHASH!!";
const byte _openttd_revision_modified = !!MODIFIED!!;
/**
+ * Indicate whether this is a tagged version.
+ * If this is non-0, then _openttd_revision is the name of the tag,
+ * and the version is likely a beta, release candidate, or real release.
+ */
+const byte _openttd_revision_tagged = !!ISTAG!!;
+
+/**
* The NewGRF revision of OTTD:
* bits meaning.
* 28-31 major version
diff --git a/src/rev.h b/src/rev.h
index 55fc08699..55674cc80 100644
--- a/src/rev.h
+++ b/src/rev.h
@@ -16,6 +16,7 @@ extern const char _openttd_revision[];
extern const char _openttd_build_date[];
extern const char _openttd_revision_hash[];
extern const byte _openttd_revision_modified;
+extern const byte _openttd_revision_tagged;
extern const uint32 _openttd_newgrf_version;
bool IsReleasedVersion();