@@ -14,12 +14,14 @@ def _diff_integration_goldens_impl(ctx):
14
14
15
15
script = """
16
16
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
20
20
cd codegen_tmp
21
21
# Remove unneeded non-Java files, like MANIFEST
22
22
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)
23
25
cd ..
24
26
diff codegen_tmp test/integration/goldens/{api_name}/ > {diff_output}
25
27
# Bash `diff` command will return exit code 1 when there are differences between the two
@@ -114,12 +116,14 @@ def _overwrite_golden_impl(ctx):
114
116
115
117
script = """
116
118
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
120
122
cd codegen_tmp
121
123
# Remove unneeded non-Java files, like MANIFEST
122
124
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)
123
127
zip -r ../{goldens_output_zip} .
124
128
""" .format (
125
129
goldens_output_zip = goldens_output_zip .path ,
@@ -141,8 +145,10 @@ def _overwrite_golden_impl(ctx):
141
145
# Overwrite the goldens.
142
146
golden_update_script_content = """
143
147
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)
146
152
unzip -ao {goldens_output_zip} -d test/integration/goldens/{api_name}
147
153
""" .format (
148
154
goldens_output_zip = goldens_output_zip .path ,
0 commit comments