SPEC-7135 Provide a method to re-trigger compiler detection for changes that require it (#1092)

* SPEC-7135 Provide a method to re-trigger compiler detection for changes that require it

* removing check (is wrong and is not necessary)

* Invert existance check

* add empty lines at the end

* Clean is triggering on each build

* clearing if the variable is false

* test code to understand what is going on...

* yeap, looks good

* handling "false" in linux/mac

* fix for linux/mac

* Fixing typos
This commit is contained in:
Esteban Papp
2021-06-03 18:05:05 -07:00
committed by GitHub
parent 8ae800f579
commit 29ac17a090
6 changed files with 116 additions and 6 deletions
+2 -1
View File
@@ -14,6 +14,7 @@ set -o errexit # exit on the first failure encountered
BASEDIR=$(dirname "$0")
source $BASEDIR/env_linux.sh
source $BASEDIR/clean_linux.sh
mkdir -p ${OUTPUT_DIRECTORY}
SOURCE_DIRECTORY=${PWD}
@@ -46,4 +47,4 @@ fi
echo [ci_build] cmake --build . --target ${CMAKE_TARGET} --config ${CONFIGURATION} -j $(grep -c processor /proc/cpuinfo) -- ${CMAKE_NATIVE_BUILD_ARGS}
cmake --build . --target ${CMAKE_TARGET} --config ${CONFIGURATION} -j $(grep -c processor /proc/cpuinfo) -- ${CMAKE_NATIVE_BUILD_ARGS}
popd
popd
+36 -1
View File
@@ -12,6 +12,16 @@
set -o errexit # exit on the first failure encountered
# Jenkins defines environment variables for parameters and passes "false" to variables
# that are not set. Here we clear them if they are false so we can also just define them
# from command line
if [[ "${CLEAN_ASSETS}" == "false" ]]; then
CLEAN_ASSETS=
fi
if [[ "${CLEAN_OUTPUT_DIRECTORY}" == "false" ]]; then
CLEAN_OUTPUT_DIRECTORY=
fi
if [[ -n "$CLEAN_ASSETS" ]]; then
echo "[ci_build] CLEAN_ASSETS option set"
for project in $(echo $CMAKE_LY_PROJECTS | sed "s/;/ /g")
@@ -23,10 +33,35 @@ if [[ -n "$CLEAN_ASSETS" ]]; then
done
fi
# If the node label changes, we issue a clean output since node changes can change SDK/CMake/toolchains/etc
LAST_CONFIGURE_NODE_LABEL_FILE=ci_last_node_label.txt
if [[ -n "$NODE_LABEL" ]]; then
if [[ -d $OUTPUT_DIRECTORY ]]; then
pushd $OUTPUT_DIRECTORY
if [[ -e ${LAST_CONFIGURE_NODE_LABEL_FILE} ]]; then
LAST_NODE_LABEL=$(<${LAST_CONFIGURE_NODE_LABEL_FILE})
else
LAST_NODE_LABEL=
fi
# Detect if the node label has changed
if [[ "${LAST_NODE_LABEL}" != "${NODE_LABEL}" ]]; then
echo [ci_build] Last run was done with node label \"${LAST_NODE_LABEL}\", new node label is \"${NODE_LABEL}\", forcing CLEAN_OUTPUT_DIRECTORY
CLEAN_OUTPUT_DIRECTORY=1
fi
popd
fi
fi
if [[ -n "$CLEAN_OUTPUT_DIRECTORY" ]]; then
echo "[ci_build] CLEAN_OUTPUT_DIRECTORY option set"
if [[ -d $OUTPUT_DIRECTORY ]]; then
echo "[ci_build] Deleting \"${OUTPUT_DIRECTORY}\""
rm -rf ${OUTPUT_DIRECTORY}
fi
fi
fi
mkdir -p ${OUTPUT_DIRECTORY}
# Save the node label
pushd $OUTPUT_DIRECTORY
echo "${NODE_LABEL}" > ${LAST_CONFIGURE_NODE_LABEL_FILE}
popd
+1
View File
@@ -14,6 +14,7 @@ set -o errexit # exit on the first failure encountered
BASEDIR=$(dirname "$0")
source $BASEDIR/env_mac.sh
source $BASEDIR/clean_mac.sh
mkdir -p ${OUTPUT_DIRECTORY}
SOURCE_DIRECTORY=${PWD}
+36 -1
View File
@@ -12,6 +12,16 @@
set -o errexit # exit on the first failure encountered
# Jenkins defines environment variables for parameters and passes "false" to variables
# that are not set. Here we clear them if they are false so we can also just define them
# from command line
if [[ "${CLEAN_ASSETS}" == "false" ]]; then
CLEAN_ASSETS=
fi
if [[ "${CLEAN_OUTPUT_DIRECTORY}" == "false" ]]; then
CLEAN_OUTPUT_DIRECTORY=
fi
if [[ -n "$CLEAN_ASSETS" ]]; then
echo "[ci_build] CLEAN_ASSETS option set"
for project in $(echo $CMAKE_LY_PROJECTS | sed "s/;/ /g")
@@ -23,10 +33,35 @@ if [[ -n "$CLEAN_ASSETS" ]]; then
done
fi
# If the node label changes, we issue a clean output since node changes can change SDK/CMake/toolchains/etc
LAST_CONFIGURE_NODE_LABEL_FILE=ci_last_node_label.txt
if [[ -n "$NODE_LABEL" ]]; then
if [[ -d $OUTPUT_DIRECTORY ]]; then
pushd $OUTPUT_DIRECTORY
if [[ -e ${LAST_CONFIGURE_NODE_LABEL_FILE} ]]; then
LAST_NODE_LABEL=$(<${LAST_CONFIGURE_NODE_LABEL_FILE})
else
LAST_NODE_LABEL=
fi
# Detect if the node label has changed
if [[ "${LAST_NODE_LABEL}" != "${NODE_LABEL}" ]]; then
echo [ci_build] Last run was done with node label \"${LAST_NODE_LABEL}\", new node label is \"${NODE_LABEL}\", forcing CLEAN_OUTPUT_DIRECTORY
CLEAN_OUTPUT_DIRECTORY=1
fi
popd
fi
fi
if [[ -n "$CLEAN_OUTPUT_DIRECTORY" ]]; then
echo "[ci_build] CLEAN_OUTPUT_DIRECTORY option set"
if [[ -d $OUTPUT_DIRECTORY ]]; then
echo "[ci_build] Deleting \"${OUTPUT_DIRECTORY}\""
rm -rf ${OUTPUT_DIRECTORY}
fi
fi
fi
mkdir -p ${OUTPUT_DIRECTORY}
# Save the node label
pushd $OUTPUT_DIRECTORY
echo "${NODE_LABEL}" > ${LAST_CONFIGURE_NODE_LABEL_FILE}
popd
@@ -13,6 +13,7 @@ REM
SETLOCAL EnableDelayedExpansion
CALL %~dp0env_windows.cmd
CALL %~dp0clean_windows.cmd
IF NOT EXIST "%OUTPUT_DIRECTORY%" (
MKDIR %OUTPUT_DIRECTORY%.
@@ -70,4 +71,4 @@ EXIT /b 0
:error
POPD
EXIT /b 1
EXIT /b 1
@@ -12,6 +12,16 @@ REM
SETLOCAL EnableDelayedExpansion
REM Jenkins defines environment variables for parameters and passes "false" to variables
REM that are not set. Here we clear them if they are false so we can also just define them
REM from command line
IF "%CLEAN_ASSETS%"=="false" (
set CLEAN_ASSETS=
)
IF "%CLEAN_OUTPUT_DIRECTORY%"=="false" (
set CLEAN_OUTPUT_DIRECTORY=
)
IF DEFINED CLEAN_ASSETS (
ECHO [ci_build] CLEAN_ASSETS option set
FOR %%P in (%CMAKE_LY_PROJECTS%) do (
@@ -19,7 +29,26 @@ IF DEFINED CLEAN_ASSETS (
ECHO [ci_build] Deleting "%%P\Cache"
DEL /s /q /f %%P\Cache 1>nul
)
)
)
)
REM If the node label changes, we issue a clean output since node changes can change SDK/CMake/toolchains/etc
SET LAST_CONFIGURE_NODE_LABEL_FILE=ci_last_node_label.txt
IF DEFINED NODE_LABEL (
IF EXIST %OUTPUT_DIRECTORY% (
PUSHD %OUTPUT_DIRECTORY%
IF EXIST !LAST_CONFIGURE_NODE_LABEL_FILE! (
FOR /F "delims=" %%x in (%LAST_CONFIGURE_NODE_LABEL_FILE%) DO SET LAST_NODE_LABEL=%%x
) ELSE (
SET LAST_NODE_LABEL=
)
REM Detect if the node label has changed
IF !LAST_NODE_LABEL! NEQ !NODE_LABEL! (
ECHO [ci_build] Last run was done with node label "!LAST_NODE_LABEL!", new node label is "!NODE_LABEL!", forcing CLEAN_OUTPUT_DIRECTORY
SET CLEAN_OUTPUT_DIRECTORY=1
)
POPD
)
)
IF DEFINED CLEAN_OUTPUT_DIRECTORY (
@@ -28,4 +57,12 @@ IF DEFINED CLEAN_OUTPUT_DIRECTORY (
ECHO [ci_build] Deleting "%OUTPUT_DIRECTORY%"
DEL /s /q /f %OUTPUT_DIRECTORY% 1>nul
)
)
)
IF NOT EXIST "%OUTPUT_DIRECTORY%" (
MKDIR %OUTPUT_DIRECTORY%.
)
REM Save the node label
PUSHD %OUTPUT_DIRECTORY%
ECHO !NODE_LABEL!> !LAST_CONFIGURE_NODE_LABEL_FILE!
POPD