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