8585grep -v ' ^ *#' < " ${proto_path_list} " | while IFS= read -r line; do
8686 proto_path=$( echo " $line " | cut -d " " -f 1)
8787 repository_path=$( echo " $line " | cut -d " " -f 2)
88- is_handwritten =$( echo " $line " | cut -d " " -f 3)
88+ skip_postprocessing =$( echo " $line " | cut -d " " -f 3)
8989 # parse destination_path
9090 pushd " ${output_folder} "
9191 echo " Checking out googleapis-gen repository..."
@@ -110,8 +110,8 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do
110110 service_yaml=${service_yaml} ,
111111 include_samples=${include_samples} ."
112112 pushd " ${output_folder} "
113- if [ " ${is_handwritten } " == " true" ]; then
114- echo ' this is a handwritten library '
113+ if [ " ${skip_postprocessing } " == " true" ]; then
114+ echo ' this library is not intended for postprocessing test '
115115 popd # output folder
116116 continue
117117 else
@@ -126,7 +126,7 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do
126126 # generate GAPIC client library
127127 echo " Generating library from ${proto_path} , to ${destination_path} ..."
128128 generation_start=$( date " +%s" )
129- if [ $ enable_postprocessing == " true" ]; then
129+ if [ " ${ enable_postprocessing} " == " true" ]; then
130130 if [[ " ${repository_path} " == " null" ]]; then
131131 # we need a repository to compare the generated results with. Skip this
132132 # library
@@ -173,9 +173,14 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do
173173 echo " Generate library finished."
174174 echo " Compare generation result..."
175175 if [ $enable_postprocessing == " true" ]; then
176+ if [ $( find " ${output_folder} /workspace" -name ' *.java' | wc -l) -eq 0 ];
177+ then
178+ echo ' no java files found in workspace. This probably means that owlbot copy failed'
179+ exit 1
180+ fi
176181 echo " Checking out repository..."
177182 pushd " ${target_folder} "
178- SOURCE_DIFF_RESULT =0
183+ source_diff_result =0
179184 git diff \
180185 --ignore-space-at-eol \
181186 -r \
@@ -184,34 +189,34 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do
184189 ' :!*pom.xml' \
185190 ' :!*README.md' \
186191 ' :!*package-info.java' \
187- || SOURCE_DIFF_RESULT =$?
192+ || source_diff_result =$?
188193
189- POM_DIFF_RESULT =$( compare_poms " ${target_folder} " )
194+ pom_diff_result =$( compare_poms " ${target_folder} " )
190195 popd # target_folder
191- if [[ ${SOURCE_DIFF_RESULT } == 0 ]] && [[ ${POM_DIFF_RESULT } == 0 ]] ; then
196+ if [[ ${source_diff_result } == 0 ]] && [[ ${pom_diff_result } == 0 ]] ; then
192197 echo " SUCCESS: Comparison finished, no difference is found."
193198 # Delete google-cloud-java to allow a sparse clone of the next library
194199 rm -rdf google-cloud-java
195- elif [ ${SOURCE_DIFF_RESULT } != 0 ]; then
200+ elif [ ${source_diff_result } != 0 ]; then
196201 echo " FAILURE: Differences found in proto path: ${proto_path} ."
197202 exit " ${SOURCE_DIFF_RESULT} "
198- elif [ ${POM_DIFF_RESULT } != 0 ]; then
203+ elif [ ${pom_diff_result } != 0 ]; then
199204 echo " FAILURE: Differences found in generated poms"
200- exit " ${POM_DIFF_RESULT } "
205+ exit " ${pom_diff_result } "
201206 fi
202- elif [ $ enable_postprocessing == " false" ]; then
207+ elif [ " ${ enable_postprocessing} " == " false" ]; then
203208 # include gapic_metadata.json and package-info.java after
204209 # resolving https://github.com/googleapis/sdk-platform-java/issues/1986
205- SOURCE_DIFF_RESULT =0
210+ source_diff_result =0
206211 diff --strip-trailing-cr -r " googleapis-gen/${proto_path} /${destination_path} " " ${output_folder} /${destination_path} " \
207212 -x " *gradle*" \
208213 -x " gapic_metadata.json" \
209- -x " package-info.java" || SOURCE_DIFF_RESULT =$?
210- if [ ${SOURCE_DIFF_RESULT } == 0 ] ; then
214+ -x " package-info.java" || source_diff_result =$?
215+ if [ ${source_diff_result } == 0 ] ; then
211216 echo " SUCCESS: Comparison finished, no difference is found."
212217 else
213218 echo " FAILURE: Differences found in proto path: ${proto_path} ."
214- exit " ${SOURCE_DIFF_RESULT } "
219+ exit " ${source_diff_result } "
215220 fi
216221 fi
217222
0 commit comments