Skip to content
Snippets Groups Projects
Commit 2dd5f2ce authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Run git clean on incremental builds

The main reason is to remove stale compiled-python files but there
is no harm in removing untracked files.
Refs #0
parent ac91d7ef
No related branches found
No related tags found
No related merge requests found
......@@ -107,12 +107,14 @@ fi
# For a clean build the entire thing is removed to guarantee it is clean. All
# other build types are assumed to be incremental and the following items
# are removed to ensure stale build objects don't interfere with each other:
# - those removed by git clean -fdx --exclude=`basename $BUILD_DIR`
# - build/bin/**: if libraries are removed from cmake they are not deleted
# from bin and can cause random failures
# - build/ExternalData/**: data files will change over time and removing
# the links helps keep it fresh
###############################################################################
BUILD_DIR=$WORKSPACE/build
BUILD_DIR_REL=build
BUILD_DIR=$WORKSPACE/$BUILD_DIR_REL
if [ -z "$BUILD_DIR" ]; then
echo "Build directory not set. Cannot continue"
exit 1
......@@ -122,6 +124,7 @@ if [[ "$CLEANBUILD" == true ]]; then
rm -rf $BUILD_DIR
fi
if [ -d $BUILD_DIR ]; then
git clean -fdx --exclude=${BUILD_DIR_REL}
rm -rf ${BUILD_DIR:?}/bin ${BUILD_DIR:?}/ExternalData
find ${BUILD_DIR:?} -name 'TEST-*.xml' -delete
if [[ -n ${CLEAN_EXTERNAL_PROJECTS} && "${CLEAN_EXTERNAL_PROJECTS}" == true ]]; then
......
......@@ -84,12 +84,14 @@ if not "%JOB_NAME%" == "%JOB_NAME:debug=%" (
:: For a clean build the entire thing is removed to guarantee it is clean. All
:: other build types are assumed to be incremental and the following items
:: are removed to ensure stale build objects don't interfere with each other:
:: - those removed by git clean -fdx --exclude=build
:: - build/bin: if libraries are removed from cmake they are not deleted
:: from bin and can cause random failures
:: - build/ExternalData/**: data files will change over time and removing
:: the links helps keep it fresh
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set BUILD_DIR=%WORKSPACE%\build
set BUILD_DIR_REL=build
set BUILD_DIR=%WORKSPACE%\%BUILD_DIR_REL%
call %~dp0setupcompiler.bat %BUILD_DIR%
if "!CLEANBUILD!" == "yes" (
......@@ -98,6 +100,7 @@ if "!CLEANBUILD!" == "yes" (
)
if EXIST %BUILD_DIR% (
git clean -fdx --exclude=%BUILD_DIR_REL%
rmdir /S /Q %BUILD_DIR%\bin %BUILD_DIR%\ExternalData
for /f %%F in ('dir /b /a-d /S "TEST-*.xml"') do del /Q %%F >/nul
if "!CLEAN_EXTERNAL_PROJECTS!" == "true" (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment