Skip to content

Commit

Permalink
chore: add temp code replacement hack due to gapic code-gen template …
Browse files Browse the repository at this point in the history
…bug (#201)

* chore: add file exclusion due to gapic code-gen template bug

* update based on comments

* update based on comments
  • Loading branch information
stephaniewang526 authored Apr 22, 2020
1 parent 440d85b commit fbdb52a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.java as java
import os

AUTOSYNTH_MULTIPLE_COMMITS = True

Expand All @@ -35,3 +36,26 @@
)

java.common_templates()

# TODO: Remove all below s.replace() logic when upstream correction is made in gapic https://github.com/googleapis/gapic-generator/issues/3181
# Remove line added by gapic generator
s.replace("google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/MockBigQueryWriteImpl.java",
"final Object response = responses.remove();",
"")

# Add back lines removed by gapic generator
s.replace("google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1alpha2/MockBigQueryWriteImpl.java",
"""
public void onNext(AppendRowsRequest value) {
if (response instanceof AppendRowsResponse) {
""",
"""
public void onNext(AppendRowsRequest value) {
requests.add(value);
final Object response = responses.remove();
if (response instanceof AppendRowsResponse) {
"""
)

# Re-run java code formatter after making hacky code change
os.system("mvn com.coveo:fmt-maven-plugin:format")

0 comments on commit fbdb52a

Please sign in to comment.