[SC64][BUILD] Moved getting commit info to build.sh script

This commit is contained in:
Mateusz Faderewski 2025-03-08 22:14:35 +01:00
parent 3fbb6f3823
commit 9193e9c6f2
2 changed files with 19 additions and 9 deletions

@ -27,6 +27,8 @@ FILES=(
"./README.md"
)
HAVE_COMMIT_INFO=false
BUILT_BOOTLOADER=false
BUILT_CONTROLLER=false
BUILT_CIC=false
@ -36,9 +38,24 @@ BUILT_RELEASE=false
FORCE_CLEAN=false
get_last_commit_info () {
if [ "$HAVE_COMMIT_INFO" = true ]; then return; fi
SAFE_DIRECTORY="-c safe.directory=$(pwd)"
GIT_BRANCH=$(git $SAFE_DIRECTORY rev-parse --abbrev-ref HEAD)
GIT_TAG=$(git $SAFE_DIRECTORY describe --tags 2> /dev/null)
GIT_SHA=$(git $SAFE_DIRECTORY rev-parse HEAD)
GIT_MESSAGE=$(git $SAFE_DIRECTORY log --oneline --format=%B -n 1 HEAD | head -n 1)
HAVE_COMMIT_INFO=true
}
build_bootloader () {
if [ "$BUILT_BOOTLOADER" = true ]; then return; fi
get_last_commit_info
pushd sw/bootloader > /dev/null
if [ "$FORCE_CLEAN" = true ]; then
make clean
@ -98,6 +115,8 @@ build_fpga () {
build_update () {
if [ "$BUILT_UPDATE" = true ]; then return; fi
get_last_commit_info
build_bootloader
build_controller
build_cic

@ -5,11 +5,6 @@ BUILDER_PLATFORM="linux/x86_64"
pushd $(dirname $0) > /dev/null
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
GIT_TAG=$(git describe --tags 2> /dev/null)
GIT_SHA=$(git rev-parse HEAD)
GIT_MESSAGE=$(git log --oneline --format=%B -n 1 HEAD | head -n 1)
if [ -t 1 ]; then
DOCKER_OPTIONS="-it"
fi
@ -22,10 +17,6 @@ docker run \
-v "$(pwd)"/fw/project/lcmxo2/license.dat:/flexlm/license.dat \
-v "$(pwd)":/workdir \
-h=`hostname` \
-e GIT_BRANCH="$GIT_BRANCH" \
-e GIT_TAG="$GIT_TAG" \
-e GIT_SHA="$GIT_SHA" \
-e GIT_MESSAGE="$GIT_MESSAGE" \
-e SC64_VERSION=${SC64_VERSION:-""} \
--platform $BUILDER_PLATFORM \
$BUILDER_IMAGE \