Travis will now generate and use the custom version header file
This commit is contained in:
parent
66fb23edb5
commit
08b485a310
2 changed files with 17 additions and 13 deletions
|
@ -3,10 +3,7 @@ language: c
|
||||||
#
|
#
|
||||||
before_install:
|
before_install:
|
||||||
#
|
#
|
||||||
# Travis runs a detached head. We need to find the current branch
|
# Fetch the tag information for the current branch
|
||||||
- git checkout `git branch --contains HEAD | grep -v '*'`
|
|
||||||
#
|
|
||||||
# Also tags for the root(s) of the minor version(s)
|
|
||||||
- git fetch origin --tags
|
- git fetch origin --tags
|
||||||
#
|
#
|
||||||
# Publish the buildroot script folder
|
# Publish the buildroot script folder
|
||||||
|
@ -50,6 +47,10 @@ before_script:
|
||||||
# Change current working directory to the build dir
|
# Change current working directory to the build dir
|
||||||
- cd ${TRAVIS_BUILD_DIR}
|
- cd ${TRAVIS_BUILD_DIR}
|
||||||
#
|
#
|
||||||
|
# Generate custom version include
|
||||||
|
- generate_version_header_for_marlin ${TRAVIS_BUILD_DIR}/Marlin
|
||||||
|
- cat ${TRAVIS_BUILD_DIR}/Marlin/_Version.h
|
||||||
|
#
|
||||||
script:
|
script:
|
||||||
#
|
#
|
||||||
# Backup Configuration.h, Configuration_adv.h, and pins_RAMPS_14.h
|
# Backup Configuration.h, Configuration_adv.h, and pins_RAMPS_14.h
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# generate_version_header_for_marlin
|
# generate_version_header_for_marlin
|
||||||
|
|
||||||
DIR="$1"
|
DIR="${1}"
|
||||||
OUTFILE="$2"
|
|
||||||
|
|
||||||
BUILDATE=$(date '+%s')
|
BUILDATE=$(date '+%s')
|
||||||
DISTDATE=$(date '+%Y-%m-%d %H:%M')
|
DISTDATE=$(date '+%Y-%m-%d %H:%M')
|
||||||
|
@ -10,15 +9,16 @@ DISTDATE=$(date '+%Y-%m-%d %H:%M')
|
||||||
BRANCH=$(git -C "${DIR}" symbolic-ref -q --short HEAD)
|
BRANCH=$(git -C "${DIR}" symbolic-ref -q --short HEAD)
|
||||||
VERSION=$(git -C "${DIR}" describe --tags --first-parent 2>/dev/null)
|
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
|
if [ -z "${VERSION}" ]; then
|
||||||
VERSION=$(git -C "${DIR}" describe --tags --first-parent --always 2>/dev/null)
|
VERSION=$(git -C "${DIR}" describe --tags --first-parent --always 2>/dev/null)
|
||||||
SHORT_BUILD_VERSION=$(echo "${VERSION}" | sed "s/-.*/${BRANCH}/")
|
fi
|
||||||
DETAILED_BUILD_VERSION=$(echo "${VERSION}" | sed "s/-/${BRANCH}-/")
|
|
||||||
else
|
|
||||||
SHORT_BUILD_VERSION=$(echo "${BRANCH}")
|
SHORT_BUILD_VERSION=$(echo "${BRANCH}")
|
||||||
DETAILED_BUILD_VERSION=$(echo "${BRANCH}-${VERSION}")
|
DETAILED_BUILD_VERSION=$(echo "${BRANCH}-${VERSION}")
|
||||||
fi
|
|
||||||
|
|
||||||
# Gets some misc options from their defaults
|
# Gets some misc options from their defaults
|
||||||
DEFAULT_MACHINE_UUID=$(awk -F'"' \
|
DEFAULT_MACHINE_UUID=$(awk -F'"' \
|
||||||
|
@ -32,10 +32,13 @@ SOURCE_CODE_URL=$(awk -F'"' \
|
||||||
WEBSITE_URL=$(awk -F'"' \
|
WEBSITE_URL=$(awk -F'"' \
|
||||||
'/#define WEBSITE_URL/{ print $2 }' < "${DIR}/Version.h")
|
'/#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.
|
* THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
|
||||||
* IT DOES NOT GET COMMITTED TO THE REPOSITORY.
|
* IT DOES NOT GET COMMITTED TO THE REPOSITORY.
|
||||||
|
*
|
||||||
|
* Branch: ${BRANCH}
|
||||||
|
* Version: ${VERSION}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BUILD_UNIX_DATETIME "${BUILDATE}"
|
#define BUILD_UNIX_DATETIME "${BUILDATE}"
|
||||||
|
|
Reference in a new issue