@@ -14,12 +14,14 @@ def _diff_integration_goldens_impl(ctx):
1414
1515 script = """
1616 mkdir codegen_tmp
17- unzip -j {input} -d codegen_tmp
18- unzip -j {input_resource_name} -d codegen_tmp
19- unzip -j {input_test} -d codegen_tmp
17+ unzip {input} -d codegen_tmp
18+ unzip {input_resource_name} -d codegen_tmp
19+ unzip {input_test} -d codegen_tmp
2020 cd codegen_tmp
2121 # Remove unneeded non-Java files, like MANIFEST
2222 rm -rf $(find ./ -type f ! -name '*.java' -a ! -name '*gapic_metadata.json')
23+ rm -rf $(find ./ -type f -name 'PlaceholderFile.java')
24+ rm -r $(find ./ -type d -empty)
2325 cd ..
2426 diff codegen_tmp test/integration/goldens/{api_name}/ > {diff_output}
2527 # Bash `diff` command will return exit code 1 when there are differences between the two
@@ -114,12 +116,14 @@ def _overwrite_golden_impl(ctx):
114116
115117 script = """
116118 mkdir codegen_tmp
117- unzip -j {input} -d codegen_tmp
118- unzip -j {input_resource_name} -d codegen_tmp
119- unzip -j {input_test} -d codegen_tmp
119+ unzip {input} -d codegen_tmp
120+ unzip {input_resource_name} -d codegen_tmp
121+ unzip {input_test} -d codegen_tmp
120122 cd codegen_tmp
121123 # Remove unneeded non-Java files, like MANIFEST
122124 rm -rf $(find ./ -type f ! -name '*.java' -a ! -name '*gapic_metadata.json')
125+ rm -rf $(find ./ -type f -name 'PlaceholderFile.java')
126+ rm -r $(find ./ -type d -empty)
123127 zip -r ../{goldens_output_zip} .
124128 """ .format (
125129 goldens_output_zip = goldens_output_zip .path ,
@@ -141,8 +145,10 @@ def _overwrite_golden_impl(ctx):
141145 # Overwrite the goldens.
142146 golden_update_script_content = """
143147 cd ${{BUILD_WORKSPACE_DIRECTORY}}
144- rm -r test/integration/goldens/{api_name}/*.java
145- rm -r test/integration/goldens/{api_name}/gapic_metadata.json
148+ # Clear out existing Java and JSON files.
149+ rm -r $(find test/integration/goldens/{api_name}/ -name '*.java')
150+ rm -r $(find test/integration/goldens/{api_name}/ -name 'gapic_metadata.json')
151+ rm -r $(find ./ -type d -empty)
146152 unzip -ao {goldens_output_zip} -d test/integration/goldens/{api_name}
147153 """ .format (
148154 goldens_output_zip = goldens_output_zip .path ,
0 commit comments