@@ -29,16 +29,32 @@ for module in $(find . -mindepth 2 -maxdepth 2 -name pom.xml | sort | xargs dirn
29
29
# and locate artifact id of client library
30
30
folder=$( find . -mindepth 1 -maxdepth 1 -type d -name " google-*" ! -name " *-bom" )
31
31
echo " folder: ${folder} "
32
+ if [[ -z " ${folder} " ]]; then
33
+ echo " Warning: No 'google-*' folder found in ${module} , skipping..."
34
+ cd .. # Ensure we go back to the parent directory
35
+ continue
36
+ fi
32
37
cd " ${folder} " || continue
33
38
artifact_id_string=$( find . -name ' pom.xml' -print -quit | xargs grep -m 1 ' <artifactId>' | cut -d ' >' -f 2 | cut -d ' <' -f 1)
34
39
echo " artifact_id_string: ${artifact_id_string} "
40
+ if [[ -z " ${artifact_id_string} " ]]; then
41
+ echo " Warning: Could not find <artifactId> in pom.xml within ${folder} , skipping..."
42
+ cd .. # Exit from ${folder}
43
+ cd .. # Exit from ${module}
44
+ continue
45
+ fi
35
46
cd .. # exist from folder ${folder}
36
47
37
48
# Find *StubSettings file, get the first line containing '.googleapis.com:443'
38
49
# Extract service name from it
39
- string=$( find . -name ' *StubSettings.java' -print -quit | xargs grep -m 1 ' .googleapis.com:443' )
40
- service_name=$( echo " ${string} " | grep -o ' ".*"' | tr -d ' "' | cut -d " ." -f 1 | cut -d " -" -f 1)
41
- echo " service name: ${service_name} "
50
+ first_line_contain_endpoint=$( find . -name ' *StubSettings.java' -print -quit | xargs grep -m 1 ' .googleapis.com:443' )
51
+ service_name=" " # Initialize service_name to an empty string
52
+ if [[ -n " ${first_line_contain_endpoint} " ]]; then
53
+ service_name=$( echo " ${first_line_contain_endpoint} " | grep -o ' ".*"' | tr -d ' "' | cut -d " ." -f 1 | cut -d " -" -f 1)
54
+ echo " service name: ${service_name} "
55
+ else
56
+ echo " Warning: Could not find '*StubSettings.java' containing '.googleapis.com:443' in ${module} "
57
+ fi
42
58
echo " ${artifact_id_string} , ${service_name} " >> " $filename "
43
59
cd .. # exit from ${module}
44
60
done
62
78
cd ..
63
79
mv ./google-cloud-java/artifacts_to_services.txt ./libraries-release-data/artifacts_to_services.txt
64
80
# clean up
65
- rm -rf google-cloud-java/
81
+ rm -rf google-cloud-java/
0 commit comments