85
85
grep -v ' ^ *#' < " ${proto_path_list} " | while IFS= read -r line; do
86
86
proto_path=$( echo " $line " | cut -d " " -f 1)
87
87
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)
89
89
# parse destination_path
90
90
pushd " ${output_folder} "
91
91
echo " Checking out googleapis-gen repository..."
@@ -110,8 +110,8 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do
110
110
service_yaml=${service_yaml} ,
111
111
include_samples=${include_samples} ."
112
112
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 '
115
115
popd # output folder
116
116
continue
117
117
else
@@ -126,7 +126,7 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do
126
126
# generate GAPIC client library
127
127
echo " Generating library from ${proto_path} , to ${destination_path} ..."
128
128
generation_start=$( date " +%s" )
129
- if [ $ enable_postprocessing == " true" ]; then
129
+ if [ " ${ enable_postprocessing} " == " true" ]; then
130
130
if [[ " ${repository_path} " == " null" ]]; then
131
131
# we need a repository to compare the generated results with. Skip this
132
132
# library
@@ -173,9 +173,14 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do
173
173
echo " Generate library finished."
174
174
echo " Compare generation result..."
175
175
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
176
181
echo " Checking out repository..."
177
182
pushd " ${target_folder} "
178
- SOURCE_DIFF_RESULT =0
183
+ source_diff_result =0
179
184
git diff \
180
185
--ignore-space-at-eol \
181
186
-r \
@@ -184,34 +189,34 @@ grep -v '^ *#' < "${proto_path_list}" | while IFS= read -r line; do
184
189
' :!*pom.xml' \
185
190
' :!*README.md' \
186
191
' :!*package-info.java' \
187
- || SOURCE_DIFF_RESULT =$?
192
+ || source_diff_result =$?
188
193
189
- POM_DIFF_RESULT =$( compare_poms " ${target_folder} " )
194
+ pom_diff_result =$( compare_poms " ${target_folder} " )
190
195
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
192
197
echo " SUCCESS: Comparison finished, no difference is found."
193
198
# Delete google-cloud-java to allow a sparse clone of the next library
194
199
rm -rdf google-cloud-java
195
- elif [ ${SOURCE_DIFF_RESULT } != 0 ]; then
200
+ elif [ ${source_diff_result } != 0 ]; then
196
201
echo " FAILURE: Differences found in proto path: ${proto_path} ."
197
202
exit " ${SOURCE_DIFF_RESULT} "
198
- elif [ ${POM_DIFF_RESULT } != 0 ]; then
203
+ elif [ ${pom_diff_result } != 0 ]; then
199
204
echo " FAILURE: Differences found in generated poms"
200
- exit " ${POM_DIFF_RESULT } "
205
+ exit " ${pom_diff_result } "
201
206
fi
202
- elif [ $ enable_postprocessing == " false" ]; then
207
+ elif [ " ${ enable_postprocessing} " == " false" ]; then
203
208
# include gapic_metadata.json and package-info.java after
204
209
# resolving https://github.com/googleapis/sdk-platform-java/issues/1986
205
- SOURCE_DIFF_RESULT =0
210
+ source_diff_result =0
206
211
diff --strip-trailing-cr -r " googleapis-gen/${proto_path} /${destination_path} " " ${output_folder} /${destination_path} " \
207
212
-x " *gradle*" \
208
213
-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
211
216
echo " SUCCESS: Comparison finished, no difference is found."
212
217
else
213
218
echo " FAILURE: Differences found in proto path: ${proto_path} ."
214
- exit " ${SOURCE_DIFF_RESULT } "
219
+ exit " ${source_diff_result } "
215
220
fi
216
221
fi
217
222
0 commit comments