@@ -39,6 +39,10 @@ ge_server=''
39
39
interactive_mode=' '
40
40
41
41
main () {
42
+ if [[ " $build_scan_publishing_mode " == " off" ]]; then
43
+ verify_build_scan_support_tool_exists
44
+ fi
45
+
42
46
if [ " ${interactive_mode} " == " on" ]; then
43
47
wizard_execute
44
48
else
@@ -63,6 +67,9 @@ execute() {
63
67
execute_second_build
64
68
rename_project_dir " build_${project_name} " " second-build_${project_name} "
65
69
70
+ print_bl
71
+ fetch_build_cache_metrics
72
+
66
73
print_bl
67
74
print_summary
68
75
}
@@ -71,8 +78,16 @@ wizard_execute() {
71
78
print_bl
72
79
print_introduction
73
80
74
- print_bl
75
- explain_prerequisites_ccud_gradle_plugin " "
81
+ if [[ " ${build_scan_publishing_mode} " == " on" ]]; then
82
+ print_bl
83
+ explain_prerequisites_ccud_gradle_plugin " I."
84
+
85
+ print_bl
86
+ explain_prerequisites_api_access " II."
87
+ else
88
+ print_bl
89
+ explain_prerequisites_ccud_gradle_plugin
90
+ fi
76
91
77
92
print_bl
78
93
explain_collect_git_details
@@ -106,23 +121,57 @@ wizard_execute() {
106
121
print_bl
107
122
explain_measure_build_results
108
123
print_bl
124
+ fetch_build_cache_metrics
125
+ print_bl
109
126
explain_and_print_summary
110
127
}
111
128
129
+ # shellcheck disable=SC2086 # splitting expected
112
130
execute_first_build () {
113
131
info " Running first build:"
114
- info " ./gradlew --no-build-cache --scan -Dscan.tag.${EXP_SCAN_TAG} -Dscan.value.runId=${RUN_ID} clean ${tasks} $( print_extra_args) "
115
-
116
- # shellcheck disable=SC2086 # we want tasks to expand with word splitting in this case
117
- invoke_gradle --no-build-cache clean ${tasks}
132
+ execute_build clean ${tasks}
118
133
}
119
134
135
+ # shellcheck disable=SC2086 # splitting expected
120
136
execute_second_build () {
121
137
info " Running second build:"
122
- info " ./gradlew --no-build-cache --scan -Dscan.tag.${EXP_SCAN_TAG} -Dscan.value.runId=${RUN_ID} ${tasks} $( print_extra_args) "
138
+ execute_build ${tasks}
139
+ }
140
+
141
+ execute_build () {
142
+ print_gradle_command " $@ "
143
+ invoke_gradle --no-build-cache " $@ "
144
+ }
123
145
124
- # shellcheck disable=SC2086 # we want tasks to expand with word splitting in this case
125
- invoke_gradle --no-build-cache ${tasks}
146
+ print_gradle_command () {
147
+ local scan_arg
148
+ if [[ " ${build_scan_publishing_mode} " == " on" ]]; then
149
+ scan_arg=" --scan"
150
+ else
151
+ scan_arg=" -Dscan.dump"
152
+ fi
153
+ info " ./gradlew --no-build-cache ${scan_arg} -Dscan.tag.${EXP_SCAN_TAG} -Dscan.value.runId=${RUN_ID} $* $( print_extra_args) "
154
+ }
155
+
156
+ fetch_build_cache_metrics () {
157
+ if [ " $build_scan_publishing_mode " == " on" ]; then
158
+ read_build_scan_metadata
159
+ fetch_and_read_build_scan_data build_cache_metrics_only " ${build_scan_urls[@]} "
160
+ else
161
+ find_and_read_build_scan_dumps
162
+ fi
163
+ }
164
+
165
+ # Overrides info.sh#print_performance_metrics
166
+ print_performance_metrics () {
167
+ print_performance_characteristics
168
+ }
169
+
170
+ # Overrides info.sh#print_performance_characteristics
171
+ print_performance_characteristics () {
172
+ print_performance_characteristics_header
173
+
174
+ print_realized_build_time_savings
126
175
}
127
176
128
177
print_quick_links () {
@@ -216,33 +265,74 @@ EOF
216
265
217
266
explain_measure_build_results () {
218
267
local text
219
- IFS=' ' read -r -d ' ' text << EOF
268
+ if [[ " ${build_scan_publishing_mode} " == " on" ]]; then
269
+ IFS=' ' read -r -d ' ' text << EOF
220
270
$( print_separator)
221
271
${HEADER_COLOR} Measure build results${RESTORE}
222
272
223
- Now that the second build has finished successfully, you are ready to measure in
224
- Gradle Enterprise how well your build leverages Gradle’s incremental build
273
+ Now that the second build has finished successfully, you are ready to measure
274
+ in Gradle Enterprise how well your build leverages Gradle’s incremental build
225
275
functionality for the invoked set of Gradle tasks.
226
276
277
+ Some of the build scan data will be fetched from the build scans produced by
278
+ the two builds to assist you in your investigation.
279
+
227
280
${USER_ACTION_COLOR} Press <Enter> to measure the build results.${RESTORE}
228
281
EOF
282
+ else
283
+ IFS=' ' read -r -d ' ' text << EOF
284
+ $( print_separator)
285
+ ${HEADER_COLOR} Measure build results${RESTORE}
286
+
287
+ Now that the second build has finished successfully, you are ready to measure
288
+ how well your build leverages Gradle’s incremental build functionality for the
289
+ invoked set of Gradle tasks.
290
+
291
+ Some of the build scan data will be extracted from the locally stored,
292
+ intermediate build data produced by the two builds to assist you in your
293
+ investigation.
294
+
295
+ ${USER_ACTION_COLOR} Press <Enter> to measure the build results.${RESTORE}
296
+ EOF
297
+ fi
229
298
print_wizard_text " ${text} "
230
299
wait_for_enter
231
300
}
232
301
233
302
explain_and_print_summary () {
234
303
read_build_scan_metadata
235
304
local text
236
- IFS=' ' read -r -d ' ' text << EOF
237
- The 'Summary' section below captures the configuration of the experiment and the
238
- two build scans that were published as part of running the experiment. The build
239
- scan of the second build is particularly interesting since this is where you can
240
- inspect what tasks were not leveraging Gradle’s incremental build functionality.
305
+ if [[ " ${build_scan_publishing_mode} " == " on" ]]; then
306
+ IFS=' ' read -r -d ' ' text << EOF
307
+ The ‘Summary’ section below captures the configuration of the experiment and
308
+ the two build scans that were published as part of running the experiment. The
309
+ build scan of the second build is particularly interesting since this is where
310
+ you can inspect what tasks were not leveraging Gradle’s incremental build
311
+ functionality.
312
+
313
+ $( explain_performance_characteristics)
314
+
315
+ The ‘Investigation Quick Links’ section below allows quick navigation to the
316
+ most relevant views in build scans to investigate what tasks were up-to-date
317
+ and what tasks executed in the second build, which of those tasks had the
318
+ biggest impact on build performance, and what caused those tasks to not be
319
+ up-to-date.
320
+
321
+ $( explain_command_to_repeat_experiment)
322
+
323
+ $( print_summary)
324
+
325
+ $( print_command_to_repeat_experiment)
326
+
327
+ $( explain_when_to_rerun_experiment)
328
+ EOF
329
+ else
330
+ IFS=' ' read -r -d ' ' text << EOF
331
+ The ‘Summary’ section below captures the configuration of the experiment. No
332
+ build scans are available for inspection since publishing was disabled for the
333
+ experiment.
241
334
242
- The 'Investigation Quick Links' section below allows quick navigation to the
243
- most relevant views in build scans to investigate what tasks were uptodate and
244
- what tasks executed in the second build, which of those tasks had the biggest
245
- impact on build performance, and what caused those tasks to not be uptodate.
335
+ $( explain_performance_characteristics)
246
336
247
337
$( explain_command_to_repeat_experiment)
248
338
@@ -252,8 +342,18 @@ $(print_command_to_repeat_experiment)
252
342
253
343
$( explain_when_to_rerun_experiment)
254
344
EOF
345
+ fi
255
346
print_wizard_text " ${text} "
256
347
}
257
348
349
+ explain_performance_characteristics () {
350
+ local text
351
+ IFS=' ' read -r -d ' ' text << EOF
352
+ The ‘Performance Characteristics’ section below reveals the realized build time
353
+ savings as a result of leveraging Gradle’s incremental build functionality.
354
+ EOF
355
+ echo -n " ${text} "
356
+ }
357
+
258
358
process_arguments " $@ "
259
359
main
0 commit comments