Skip to content

Commit 89bce36

Browse files
authored
Add lint test and format generated code (#4114)
* Add lint Kokoro tests * synthtool will now run the java formatter after generating the files
1 parent 08b18b8 commit 89bce36

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

google-cloud-logging/synth.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,25 @@
1616

1717
import synthtool as s
1818
import synthtool.gcp as gcp
19+
import synthtool.languages.java as java
1920

2021
gapic = gcp.GAPICGenerator()
21-
common_templates = gcp.CommonTemplates()
2222

23-
library = gapic.java_library(
24-
service='logging',
25-
version='v2',
26-
config_path='/google/logging/artman_logging.yaml',
27-
artman_output_name='')
23+
service = 'logging'
24+
versions = ['v2']
25+
config_pattern = '/google/logging/artman_logging.yaml'
2826

29-
s.copy(library / 'gapic-google-cloud-logging-v2/src', 'src')
30-
s.copy(library / 'grpc-google-cloud-logging-v2/src', '../../google-api-grpc/grpc-google-cloud-logging-v2/src')
31-
s.copy(library / 'proto-google-cloud-logging-v2/src', '../../google-api-grpc/proto-google-cloud-logging-v2/src')
27+
for version in versions:
28+
library = gapic.java_library(
29+
service=service,
30+
version=version,
31+
config_path=config_pattern.format(version=version),
32+
artman_output_name='')
33+
34+
s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src')
35+
s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
36+
s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')
37+
38+
java.format_code('./src')
39+
java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
40+
java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')

0 commit comments

Comments
 (0)