Skip to content

Commit 64f48ec

Browse files
committed
Revert "Use environment variables to configure Gradle init scripts"
This reverts commit 5fd0927.
1 parent ee734e1 commit 64f48ec

File tree

2 files changed

+33
-45
lines changed

2 files changed

+33
-45
lines changed

components/scripts/gradle/05-validate-remote-build-caching-ci-local.sh

+10-9
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,19 @@ validate_build_config() {
194194
}
195195

196196
execute_build() {
197-
info "Running build:"
198-
print_gradle_command
197+
local args
198+
args=(--build-cache --init-script "${INIT_SCRIPTS_DIR}/configure-remote-build-caching.gradle")
199+
if [ -n "${remote_build_cache_url}" ]; then
200+
args+=("-Ddevelocity.build-validation.remoteBuildCacheUrl=${remote_build_cache_url}")
201+
fi
199202

200-
# shellcheck disable=SC2086 # we want tasks to expand with word splitting in this case
201-
invoke_gradle 1 \
202-
--build-cache \
203-
--init-script "${INIT_SCRIPTS_DIR}/configure-remote-build-caching.gradle" \
204-
clean ${tasks}
205-
}
203+
# shellcheck disable=SC2206 # we want tasks to expand with word splitting in this case
204+
args+=(clean ${tasks})
206205

207-
print_gradle_command() {
206+
info "Running build:"
208207
info "./gradlew --build-cache -Dscan.tag.${EXP_SCAN_TAG} -Dscan.value.runId=${RUN_ID} -Dpts.enabled=false clean ${tasks}$(print_extra_args)"
208+
209+
invoke_gradle 1 "${args[@]}"
209210
}
210211

211212
# Overrides summary.sh#print_experiment_specific_summary_info

components/scripts/lib/gradle.sh

+23-36
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env bash
22

33
invoke_gradle() {
4-
local run_num
4+
local run_num args
5+
args=()
56
run_num=$1
67
shift
78

@@ -11,45 +12,35 @@ invoke_gradle() {
1112
cd "${project_dir}" > /dev/null 2>&1 || die "ERROR: Subdirectory ${project_dir} (set with --project-dir) does not exist in ${project_name}" "${INVALID_INPUT}"
1213
fi
1314

14-
envs+=(
15-
DEVELOCITY_INJECTION_INIT_SCRIPT_NAME=develocity-injection.gradle
16-
DEVELOCITY_INJECTION_ENABLED=true
15+
args+=(
16+
--init-script "${INIT_SCRIPTS_DIR}/develocity-injection.gradle"
17+
--init-script "${INIT_SCRIPTS_DIR}/configure-build-validation.gradle"
18+
-Ddevelocity.injection.init-script-name=develocity-injection.gradle
19+
-Ddevelocity.injection-enabled=true
1720
)
1821

1922
if [ "$enable_ge" == "on" ]; then
20-
envs+=(
21-
GRADLE_PLUGIN_REPOSITORY_URL=https://plugins.gradle.org/m2
22-
DEVELOCITY_PLUGIN_VERSION="3.14.1"
23-
DEVELOCITY_CCUD_PLUGIN_VERSION="2.0.2"
23+
args+=(
24+
-Dgradle.plugin-repository.url=https://plugins.gradle.org/m2
25+
-Ddevelocity.plugin.version="3.14.1"
26+
-Ddevelocity.ccud.plugin.version="2.0.2"
2427
)
2528
fi
2629

2730
if [ -n "${ge_server}" ]; then
28-
envs+=(
29-
DEVELOCITY_BUILD_VALIDATION_URL="${ge_server}"
30-
DEVELOCITY_BUILD_VALIDATION_ALLOW_UNTRUSTED_SERVER=false
31-
)
32-
fi
33-
34-
if [ -n "${remote_build_cache_url}" ]; then
35-
envs+=(
36-
DEVELOCITY_BUILD_VALIDATION_REMOTEBUILDCACHEURL="${remote_build_cache_url}"
31+
args+=(
32+
-Ddevelocity.build-validation.url="${ge_server}"
33+
-Ddevelocity.build-validation.allow-untrusted-server=false
3734
)
3835
fi
3936

40-
envs+=(
41-
DEVELOCITY_BUILD_VALIDATION_EXPDIR="${EXP_DIR}"
42-
DEVELOCITY_BUILD_VALIDATION_EXPID="${EXP_SCAN_TAG}"
43-
DEVELOCITY_BUILD_VALIDATION_RUNID="${RUN_ID}"
44-
DEVELOCITY_BUILD_VALIDATION_RUNNUM="${run_num}"
45-
DEVELOCITY_BUILD_VALIDATION_SCRIPTSVERSION="${SCRIPT_VERSION}"
46-
DEVELOCITY_CAPTURE_FILE_FINGERPRINTS=true
47-
)
48-
49-
local args
50-
args=(
51-
--init-script "${INIT_SCRIPTS_DIR}/develocity-injection.gradle"
52-
--init-script "${INIT_SCRIPTS_DIR}/configure-build-validation.gradle"
37+
args+=(
38+
-Ddevelocity.build-validation.expDir="${EXP_DIR}"
39+
-Ddevelocity.build-validation.expId="${EXP_SCAN_TAG}"
40+
-Ddevelocity.build-validation.runId="${RUN_ID}"
41+
-Ddevelocity.build-validation.runNum="${run_num}"
42+
-Ddevelocity.build-validation.scriptsVersion="${SCRIPT_VERSION}"
43+
-Ddevelocity.capture-file-fingerprints=true
5344
-Dpts.enabled=false
5445
)
5546

@@ -66,13 +57,9 @@ invoke_gradle() {
6657
rm -f "${EXP_DIR}/errors.txt"
6758

6859
debug "Current directory: $(pwd)"
69-
# shellcheck disable=SC2145
70-
debug export "${envs[@]}"';' ./gradlew "${args[@]}"
60+
debug ./gradlew "${args[@]}"
7161

72-
# The parenthesis below will intentionally create a subshell. This causes the
73-
# environment variables to only be exported for the child process and not leak
74-
# to the rest of the script.
75-
if (export "${envs[@]}"; ./gradlew "${args[@]}"); then
62+
if ./gradlew "${args[@]}"; then
7663
build_outcomes+=("SUCCESSFUL")
7764
else
7865
build_outcomes+=("FAILED")

0 commit comments

Comments
 (0)