feat(ci): respect dont_clean
When dont_clean is set we want to leave the workspace as it is. When
that happens we also need for things to be roughly idempotent so they
can run again and again.
This allows for builds in about 15% of the clean build time.
Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>
Change-Id: I872216aac2442b637194f4c19138d60d061078bd
diff --git a/script/build_package.sh b/script/build_package.sh
index c4a7a7f..f9ac52e 100755
--- a/script/build_package.sh
+++ b/script/build_package.sh
@@ -1366,7 +1366,7 @@
echo "===== Building package in mode: $mode ====="
# Build with a temporary archive
build_archive="$archive/$mode"
- mkdir "$build_archive"
+ mkdir -p "$build_archive"
if [ "$mode" = "debug" ]; then
export bin_mode="debug"
diff --git a/script/run_local_ci.sh b/script/run_local_ci.sh
index 01b4c2f..42d22aa 100755
--- a/script/run_local_ci.sh
+++ b/script/run_local_ci.sh
@@ -419,13 +419,12 @@
# User preferences
[ "$connect_debugger" ] && [ "$connect_debugger" -eq 1 ] && user_connect_debugger=1
user_test_run="${user_connect_debugger:-$test_run}"
-user_dont_clean="$dont_clean"
user_keep_going="$keep_going"
user_primary_live="$primary_live"
user_connect_debugger="${user_connect_debugger:-0}"
export ci_root
-export dont_clean=0
+export dont_clean="${dont_clean:-0}"
export local_ci=1
export parallel
export test_run=0
@@ -434,11 +433,13 @@
export import_cc
export connect_debugger="$user_connect_debugger"
-rm -rf "$workspace"
-mkdir -p "$workspace"
-
source "$ci_root/utils.sh"
+if not_upon "$dont_clean"; then
+ rm -rf "$workspace"
+fi
+mkdir -p "$workspace"
+
# Enable of code coverage and whether there is a local plugin
if upon "$cc_enable" && not_upon "$cc_path"; then
no_cc_t=1
@@ -466,7 +467,6 @@
if not_upon "$parallel" || echo "$parallel" | grep -vq "[0-9]"; then
parallel=1
test_run="$user_test_run"
- dont_clean="$user_dont_clean"
primary_live="$user_primary_live"
fi