Skip to content

Commit 69a0348

Browse files
committed
chore: Add comments to explain the logic
1 parent 8d490b0 commit 69a0348

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.kokoro/common.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ function parse_submodules() {
6868
submodules_array=()
6969
if [ -f "$1/pom.xml" ]; then
7070
local modules
71+
72+
# Use grep to find the modules in the aggregator pom file
73+
# Faster than invoking mvn help:evaluate to list all the project modules
7174
modules=$(grep '<module>' "$1/pom.xml" | sed 's/.*<module>\(.*\)<\/module>.*/\1/')
7275
if [ -n "$modules" ]; then
7376
for submodule in $modules; do
@@ -222,10 +225,14 @@ function generate_modified_modules_list() {
222225

223226
# Filters the modified_module_list to only include modules that contain
224227
# integration test files (matching IT*.java or *IT.java in src/test/java).
225-
# Sets filtered_it_module_list as a bash array.
228+
# Not all modules will have ITs written and there is not need to test
229+
# modules without ITs.
226230
function filter_modules_with_integration_tests() {
227231
filtered_it_module_list=()
228232
for module in "${modified_module_list[@]}"; do
233+
# 1. Search for files in the Java test directory (*/src/test/java/*)
234+
# 2. Filter for ITs that match the typical file name (IT prefix or suffix)
235+
# 3. Stop searching when a single file match has been found
229236
if find "$module" -path '*/src/test/java/*' \( -name 'IT*.java' -o -name '*IT.java' \) -print -quit 2>/dev/null | grep -q .; then
230237
filtered_it_module_list+=("$module")
231238
fi

0 commit comments

Comments
 (0)