Skip to content

Commit 61dda73

Browse files
committed
chore: document the --relative flag
1 parent 549fbdd commit 61dda73

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

.kokoro/build.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ case ${JOB_TYPE} in
157157
fi
158158
;;
159159
graalvm-single)
160-
generate_modified_modules_list false
160+
generate_modified_modules_list false
161161
if [[ "$(release_please_snapshot_pull_request)" == "true" ]]; then
162162
echo "Not running GraalVM checks -- this is Release Please SNAPSHOT pull request."
163163
elif [[ ! " ${modified_module_list[*]} " =~ " ${BUILD_SUBDIR} " ]]; then
@@ -200,7 +200,9 @@ case ${JOB_TYPE} in
200200
if [ -n "${BASE_SHA}" ] && [ -n "${HEAD_SHA}" ]; then
201201
# Optimize the build by identifying ONLY the Maven modules that contain changed Java source files.
202202
# Format those specific modules instead of the entire codebase, reducing format check time.
203-
changed_file_list=$(git diff --name-only "${BASE_SHA}" "${HEAD_SHA}")
203+
# The --relative flag is when building in the submodule as only files modified in the module
204+
# should be accounted for.
205+
changed_file_list=$(git diff --name-only "${BASE_SHA}" "${HEAD_SHA}" --relative)
204206
echo "${changed_file_list}"
205207

206208
has_code_change="false"
@@ -232,17 +234,16 @@ case ${JOB_TYPE} in
232234
done
233235
if [ -f "${dir}/pom.xml" ] && [ "${dir}" != "." ]; then
234236
# Filter out directories not participating in the default formatting reactor:
235-
# - samples/tutorials are wrapped in the include-samples profile
236-
# - proto-*/grpc-* are generated code and should not be formatted manually
237+
# - samples are handwritten by developers
238+
# - proto-*/grpc-* are generated code and should use the compiler format
237239
# - *-bom/parents are POM-only and contain no Java source
238240
if [[ "${dir}" != *"samples"* ]] && \
239-
[[ "${dir}" != *"tutorials"* ]] && \
240241
[[ "$(basename "${dir}")" != "proto-google-"* ]] && \
241242
[[ "$(basename "${dir}")" != "grpc-google-"* ]] && \
242243
[[ "$(basename "${dir}")" != *"-bom" ]] && \
243244
[[ "$(basename "${dir}")" != "google-cloud-pom-parent" ]] && \
244245
[[ "$(basename "${dir}")" != "google-cloud-jar-parent" ]]; then
245-
246+
246247
changed_modules+=("${dir}")
247248
fi
248249
fi
@@ -251,7 +252,7 @@ case ${JOB_TYPE} in
251252

252253
echo "Changed Modules: ${changed_modules[*]}"
253254

254-
# Deduplicate the modules using sort -u, so that we pass a concise list of unique modules
255+
# Deduplicate the modules using sort -u to pass a concise list of unique modules
255256
# via the Maven `-pl` argument.
256257
if [ ${#changed_modules[@]} -gt 0 ]; then
257258
unique_modules=$(printf '%s\n' "${changed_modules[@]}" | sort -u | paste -sd ',' -)
@@ -292,4 +293,4 @@ if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then
292293
fi
293294

294295
echo "exiting with ${RETURN_CODE}"
295-
exit ${RETURN_CODE}
296+
exit ${RETURN_CODE}

0 commit comments

Comments
 (0)