|
@@ -1,8 +1,7 @@
|
1
|
1
|
#!/usr/bin/env bash
|
2
|
2
|
# generate_version_header_for_marlin
|
3
|
3
|
|
4
|
|
-DIR="$1"
|
5
|
|
-OUTFILE="$2"
|
|
4
|
+DIR="${1}"
|
6
|
5
|
|
7
|
6
|
BUILDATE=$(date '+%s')
|
8
|
7
|
DISTDATE=$(date '+%Y-%m-%d %H:%M')
|
|
@@ -10,16 +9,17 @@ DISTDATE=$(date '+%Y-%m-%d %H:%M')
|
10
|
9
|
BRANCH=$(git -C "${DIR}" symbolic-ref -q --short HEAD)
|
11
|
10
|
VERSION=$(git -C "${DIR}" describe --tags --first-parent 2>/dev/null)
|
12
|
11
|
|
13
|
|
-# Voodoo version tag generator
|
|
12
|
+if [ -z "${BRANCH}" ]; then
|
|
13
|
+ BRANCH=$(echo "${TRAVIS_BRANCH}")
|
|
14
|
+fi
|
|
15
|
+
|
14
|
16
|
if [ -z "${VERSION}" ]; then
|
15
|
17
|
VERSION=$(git -C "${DIR}" describe --tags --first-parent --always 2>/dev/null)
|
16
|
|
- SHORT_BUILD_VERSION=$(echo "${VERSION}" | sed "s/-.*/${BRANCH}/")
|
17
|
|
- DETAILED_BUILD_VERSION=$(echo "${VERSION}" | sed "s/-/${BRANCH}-/")
|
18
|
|
-else
|
19
|
|
- SHORT_BUILD_VERSION=$(echo "${BRANCH}")
|
20
|
|
- DETAILED_BUILD_VERSION=$(echo "${BRANCH}-${VERSION}")
|
21
|
18
|
fi
|
22
|
19
|
|
|
20
|
+SHORT_BUILD_VERSION=$(echo "${BRANCH}")
|
|
21
|
+DETAILED_BUILD_VERSION=$(echo "${BRANCH}-${VERSION}")
|
|
22
|
+
|
23
|
23
|
# Gets some misc options from their defaults
|
24
|
24
|
DEFAULT_MACHINE_UUID=$(awk -F'"' \
|
25
|
25
|
'/#define DEFAULT_MACHINE_UUID/{ print $2 }' < "${DIR}/Version.h")
|
|
@@ -32,10 +32,13 @@ SOURCE_CODE_URL=$(awk -F'"' \
|
32
|
32
|
WEBSITE_URL=$(awk -F'"' \
|
33
|
33
|
'/#define WEBSITE_URL/{ print $2 }' < "${DIR}/Version.h")
|
34
|
34
|
|
35
|
|
-cat > "$OUTFILE" <<EOF
|
|
35
|
+cat > "${DIR}/_Version.h" <<EOF
|
36
|
36
|
/**
|
37
|
37
|
* THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
|
38
|
38
|
* IT DOES NOT GET COMMITTED TO THE REPOSITORY.
|
|
39
|
+ *
|
|
40
|
+ * Branch: ${BRANCH}
|
|
41
|
+ * Version: ${VERSION}
|
39
|
42
|
*/
|
40
|
43
|
|
41
|
44
|
#define BUILD_UNIX_DATETIME "${BUILDATE}"
|