From 631b31c7c0194ac3c3f788eb0d3259cde71109b0 Mon Sep 17 00:00:00 2001 From: Eric Haag Date: Fri, 30 Dec 2022 12:10:14 -0600 Subject: [PATCH] Add variable for debug mode --- .../gradle/04-validate-remote-build-caching-ci-ci.sh | 2 +- .../gradle/05-validate-remote-build-caching-ci-local.sh | 2 +- components/scripts/lib/build_scan.sh | 4 ++-- components/scripts/lib/config.sh | 6 +++++- components/scripts/lib/info.sh | 4 ++-- components/scripts/lib/java.sh | 2 +- .../scripts/maven/03-validate-remote-build-caching-ci-ci.sh | 2 +- .../maven/04-validate-remote-build-caching-ci-local.sh | 2 +- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/components/scripts/gradle/04-validate-remote-build-caching-ci-ci.sh b/components/scripts/gradle/04-validate-remote-build-caching-ci-ci.sh index 8205f70d..1b2f5677 100755 --- a/components/scripts/gradle/04-validate-remote-build-caching-ci-ci.sh +++ b/components/scripts/gradle/04-validate-remote-build-caching-ci-ci.sh @@ -327,7 +327,7 @@ generate_command_to_repeat_experiment() { cmd+=("-f") fi - if [[ "${_arg_debug}" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then cmd+=("--debug") fi diff --git a/components/scripts/gradle/05-validate-remote-build-caching-ci-local.sh b/components/scripts/gradle/05-validate-remote-build-caching-ci-local.sh index 0c2ae6c7..dddeb65c 100755 --- a/components/scripts/gradle/05-validate-remote-build-caching-ci-local.sh +++ b/components/scripts/gradle/05-validate-remote-build-caching-ci-local.sh @@ -492,7 +492,7 @@ generate_command_to_repeat_experiment() { cmd+=("-f") fi - if [[ "${_arg_debug}" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then cmd+=("--debug") fi diff --git a/components/scripts/lib/build_scan.sh b/components/scripts/lib/build_scan.sh index bcd5d75b..f0dcc337 100644 --- a/components/scripts/lib/build_scan.sh +++ b/components/scripts/lib/build_scan.sh @@ -17,7 +17,7 @@ read_build_scan_metadata() { local build_scan_metadata build_scan_metadata=$(< "${BUILD_SCAN_FILE}") - if [[ "$_arg_debug" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then debug "Raw Build Scan metadata (build-scans.csv)" debug "---------------------------" debug "${build_scan_metadata}" @@ -45,7 +45,7 @@ fetch_and_read_build_scan_data() { local args=() - if [[ "$_arg_debug" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then args+=("--debug") fi diff --git a/components/scripts/lib/config.sh b/components/scripts/lib/config.sh index 881dd7a6..cb29e103 100644 --- a/components/scripts/lib/config.sh +++ b/components/scripts/lib/config.sh @@ -69,6 +69,10 @@ process_arguments() { if [ -n "${_arg_interactive+x}" ]; then interactive_mode="${_arg_interactive}" fi + + if [ -n "${_arg_debug+x}" ]; then + debug_mode="${_arg_debug}" + fi } validate_required_config() { @@ -277,7 +281,7 @@ generate_command_to_repeat_experiment() { cmd+=("-f") fi - if [[ "${_arg_debug}" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then cmd+=("--debug") fi diff --git a/components/scripts/lib/info.sh b/components/scripts/lib/info.sh index 94290552..ac067afa 100644 --- a/components/scripts/lib/info.sh +++ b/components/scripts/lib/info.sh @@ -24,7 +24,7 @@ warn() { } debug() { - if [[ "$_arg_debug" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then echo "${DEBUG_COLOR}$*${RESTORE}" fi } @@ -48,7 +48,7 @@ comparison_summary_row() { } print_bl() { - if [[ "$_arg_debug" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then debug "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" else echo diff --git a/components/scripts/lib/java.sh b/components/scripts/lib/java.sh index 06697f49..860a8e37 100644 --- a/components/scripts/lib/java.sh +++ b/components/scripts/lib/java.sh @@ -98,7 +98,7 @@ invoke_java() { eval set -- -Dpicocli.ansi=true -jar "\"$classpath\"" "$(save "${args[@]}")" # shellcheck disable=SC2154 - if [[ "$_arg_debug" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then debug "$JAVACMD $*" 1>&2 print_bl 1>&2 fi diff --git a/components/scripts/maven/03-validate-remote-build-caching-ci-ci.sh b/components/scripts/maven/03-validate-remote-build-caching-ci-ci.sh index 19b08473..9b65453a 100755 --- a/components/scripts/maven/03-validate-remote-build-caching-ci-ci.sh +++ b/components/scripts/maven/03-validate-remote-build-caching-ci-ci.sh @@ -325,7 +325,7 @@ generate_command_to_repeat_experiment() { cmd+=("-f") fi - if [[ "${_arg_debug}" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then cmd+=("--debug") fi diff --git a/components/scripts/maven/04-validate-remote-build-caching-ci-local.sh b/components/scripts/maven/04-validate-remote-build-caching-ci-local.sh index 194d4803..b64009a4 100755 --- a/components/scripts/maven/04-validate-remote-build-caching-ci-local.sh +++ b/components/scripts/maven/04-validate-remote-build-caching-ci-local.sh @@ -499,7 +499,7 @@ generate_command_to_repeat_experiment() { cmd+=("-f") fi - if [[ "${_arg_debug}" == "on" ]]; then + if [[ "${debug_mode}" == "on" ]]; then cmd+=("--debug") fi