From 3b10c92f3f5f83f99d9ec8ee8f59a2f23b38db94 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Wed, 28 Nov 2018 13:45:36 -0800 Subject: [PATCH 1/2] Add lint Kokoro tests --- .kokoro/build.sh | 3 +++ .kokoro/continuous/lint.cfg | 13 +++++++++++++ .kokoro/nightly/lint.cfg | 13 +++++++++++++ .kokoro/presubmit/lint.cfg | 13 +++++++++++++ pom.xml | 9 +++++++++ 5 files changed, 51 insertions(+) create mode 100644 .kokoro/continuous/lint.cfg create mode 100644 .kokoro/nightly/lint.cfg create mode 100644 .kokoro/presubmit/lint.cfg diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 313dcccfcfb3..f96afb9019d0 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -33,6 +33,9 @@ test) mvn test -B bash $KOKORO_GFILE_DIR/codecov.sh ;; +lint) + mvn com.coveo:fmt-maven-plugin:check + ;; javadoc) mvn javadoc:javadoc javadoc:test-javadoc ;; diff --git a/.kokoro/continuous/lint.cfg b/.kokoro/continuous/lint.cfg new file mode 100644 index 000000000000..0cc493acd9ed --- /dev/null +++ b/.kokoro/continuous/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} diff --git a/.kokoro/nightly/lint.cfg b/.kokoro/nightly/lint.cfg new file mode 100644 index 000000000000..0cc493acd9ed --- /dev/null +++ b/.kokoro/nightly/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 000000000000..0cc493acd9ed --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} diff --git a/pom.xml b/pom.xml index 6e672307028c..bff8bbbeb036 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,15 @@ false + + com.coveo + fmt-maven-plugin + 2.6.0 + + + true + + From b34601b7b6d3e57f5178a7646369aa947e7299ab Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Wed, 28 Nov 2018 14:56:06 -0800 Subject: [PATCH 2/2] synthtool will now run the java formatter after generating the files --- .../google-cloud-asset/synth.py | 28 ++++++++++++------- .../google-cloud-automl/synth.py | 27 ++++++++++++------ .../synth.py | 27 ++++++++++++------ .../google-cloud-bigquerystorage/synth.py | 22 ++++++++++----- .../google-cloud-bigtable-admin/synth.py | 27 ++++++++++++------ .../google-cloud-bigtable/synth.py | 27 ++++++++++++------ .../google-cloud-compute/synth.py | 20 +++++++++---- .../google-cloud-container/synth.py | 27 ++++++++++++------ .../google-cloud-containeranalysis/synth.py | 27 ++++++++++++------ .../google-cloud-dataproc/synth.py | 22 ++++++++++----- .../google-cloud-datastore/synth.py | 26 ++++++++++------- .../google-cloud-dialogflow/synth.py | 8 +++++- .../google-cloud-dlp/synth.py | 27 ++++++++++++------ .../google-cloud-errorreporting/synth.py | 27 ++++++++++++------ .../google-cloud-firestore/synth.py | 27 ++++++++++++------ .../google-cloud-iot/synth.py | 27 ++++++++++++------ .../google-cloud-kms/synth.py | 27 ++++++++++++------ .../google-cloud-language/synth.py | 22 ++++++++++----- .../google-cloud-logging/synth.py | 27 ++++++++++++------ .../google-cloud-monitoring/synth.py | 27 ++++++++++++------ .../google-cloud-os-login/synth.py | 27 ++++++++++++------ .../google-cloud-pubsub/synth.py | 27 ++++++++++++------ .../google-cloud-redis/synth.py | 22 ++++++++++----- .../google-cloud-scheduler/synth.py | 22 ++++++++++----- .../google-cloud-securitycenter/synth.py | 22 ++++++++++----- .../google-cloud-spanner/synth.py | 11 ++++++-- .../google-cloud-speech/synth.py | 22 ++++++++++----- .../google-cloud-tasks/synth.py | 22 ++++++++++----- .../google-cloud-texttospeech/synth.py | 22 ++++++++++----- .../google-cloud-trace/synth.py | 22 ++++++++++----- .../google-cloud-video-intelligence/synth.py | 22 ++++++++++----- .../google-cloud-vision/synth.py | 22 ++++++++++----- .../google-cloud-websecurityscanner/synth.py | 27 ++++++++++++------ 33 files changed, 532 insertions(+), 257 deletions(-) diff --git a/google-cloud-clients/google-cloud-asset/synth.py b/google-cloud-clients/google-cloud-asset/synth.py index 2957fe4a8ee3..a79afe9d7806 100644 --- a/google-cloud-clients/google-cloud-asset/synth.py +++ b/google-cloud-clients/google-cloud-asset/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -# tasks has two product names, and a poorly named artman yaml -v1beta1_library = gapic.java_library( - service='asset', - version='v1beta1', - config_path='artman_cloudasset_v1beta1.yaml', - artman_output_name='') +service = 'asset' +versions = ['v1beta1'] +config_pattern = '/google/cloud/asset/artman_cloudasset_{version}.yaml' -s.copy(v1beta1_library / 'gapic-google-cloud-asset-v1beta1/src', 'src') -s.copy(v1beta1_library / 'grpc-google-cloud-asset-v1beta1/src', '../../google-api-grpc/grpc-google-cloud-asset-v1beta1/src') -s.copy(v1beta1_library / 'proto-google-cloud-asset-v1beta1/src', '../../google-api-grpc/proto-google-cloud-asset-v1beta1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-automl/synth.py b/google-cloud-clients/google-cloud-automl/synth.py index 2523b0a08e10..a82be2252c8d 100644 --- a/google-cloud-clients/google-cloud-automl/synth.py +++ b/google-cloud-clients/google-cloud-automl/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='automl', - version='v1beta1', - config_path='artman_automl_v1beta1.yaml', - artman_output_name='') +service = 'automl' +versions = ['v1beta1'] +config_pattern = '/google/cloud/automl/artman_automl_{version}.yaml' -s.copy(library / 'gapic-google-cloud-automl-v1beta1/src', 'src') -s.copy(library / 'grpc-google-cloud-automl-v1beta1/src', '../../google-api-grpc/grpc-google-cloud-automl-v1beta1/src') -s.copy(library / 'proto-google-cloud-automl-v1beta1/src', '../../google-api-grpc/proto-google-cloud-automl-v1beta1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-bigquerydatatransfer/synth.py b/google-cloud-clients/google-cloud-bigquerydatatransfer/synth.py index d19701e2c6c2..8ec15ac0ee69 100644 --- a/google-cloud-clients/google-cloud-bigquerydatatransfer/synth.py +++ b/google-cloud-clients/google-cloud-bigquerydatatransfer/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='bigquerydatatransfer', - version='v1', - config_path='/google/cloud/bigquery/datatransfer/artman_bigquerydatatransfer.yaml', - artman_output_name='') +service = 'bigquerydatatransfer' +versions = ['v1'] +config_pattern = '/google/cloud/bigquery/datatransfer/artman_bigquerydatatransfer.yaml' -s.copy(library / 'gapic-google-cloud-bigquerydatatransfer-v1/src', 'src') -s.copy(library / 'grpc-google-cloud-bigquerydatatransfer-v1/src', '../../google-api-grpc/grpc-google-cloud-bigquerydatatransfer-v1/src') -s.copy(library / 'proto-google-cloud-bigquerydatatransfer-v1/src', '../../google-api-grpc/proto-google-cloud-bigquerydatatransfer-v1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-bigquerystorage/synth.py b/google-cloud-clients/google-cloud-bigquerystorage/synth.py index 80e1256098cb..f51b7c4693cf 100644 --- a/google-cloud-clients/google-cloud-bigquerystorage/synth.py +++ b/google-cloud-clients/google-cloud-bigquerystorage/synth.py @@ -15,17 +15,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1beta1"]: +service = 'bigquerystorage' +versions = ['v1beta1'] +config_pattern = '/google/cloud/bigquery/storage/artman_bigquerystorage_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='bigquerystorage', + service=service, version=version, - config_path=f'/google/cloud/bigquery/storage/artman_bigquerystorage_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-bigquerystorage-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-bigquerystorage-{version}/src', f'../../google-api-grpc/grpc-google-cloud-bigquerystorage-{version}/src') - s.copy(library / f'proto-google-cloud-bigquerystorage-{version}/src', f'../../google-api-grpc/proto-google-cloud-bigquerystorage-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-bigtable-admin/synth.py b/google-cloud-clients/google-cloud-bigtable-admin/synth.py index 7744fc36ddcb..7ac3b5755f63 100644 --- a/google-cloud-clients/google-cloud-bigtable-admin/synth.py +++ b/google-cloud-clients/google-cloud-bigtable-admin/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='bigtable-admin', - version='v2', - config_path='/google/bigtable/admin/artman_bigtableadmin.yaml', - artman_output_name='') +service = 'bigtable-admin' +versions = ['v2'] +config_pattern = '/google/bigtable/admin/artman_bigtableadmin.yaml' -s.copy(library / 'gapic-google-cloud-bigtable-admin-v2/src', 'src') -s.copy(library / 'grpc-google-cloud-bigtable-admin-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-admin-v2/src') -s.copy(library / 'proto-google-cloud-bigtable-admin-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-admin-v2/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-bigtable/synth.py b/google-cloud-clients/google-cloud-bigtable/synth.py index d613c549c4b2..132233132df1 100644 --- a/google-cloud-clients/google-cloud-bigtable/synth.py +++ b/google-cloud-clients/google-cloud-bigtable/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='bigtable', - version='v2', - config_path='/google/bigtable/artman_bigtable.yaml', - artman_output_name='') +service = 'bigtable' +versions = ['v2'] +config_pattern = '/google/bigtable/artman_bigtable.yaml' -s.copy(library / 'gapic-google-cloud-bigtable-v2/src', 'src') -s.copy(library / 'grpc-google-cloud-bigtable-v2/src', '../../google-api-grpc/grpc-google-cloud-bigtable-v2/src') -s.copy(library / 'proto-google-cloud-bigtable-v2/src', '../../google-api-grpc/proto-google-cloud-bigtable-v2/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-compute/synth.py b/google-cloud-clients/google-cloud-compute/synth.py index c4188a04f6ee..a8c0faaaf767 100644 --- a/google-cloud-clients/google-cloud-compute/synth.py +++ b/google-cloud-clients/google-cloud-compute/synth.py @@ -16,13 +16,21 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.DiscoGAPICGenerator() -library = gapic.java_library( - service='compute', - version='v1', - config_path='artman_compute.yaml', - artman_output_name='') +service = 'compute' +versions = ['v1'] +config_pattern = '/gapic/google/compute/artman_compute.yaml' -s.copy(library / 'gapic-google-cloud-compute-v1/src', 'src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + + java.format_code('./src') diff --git a/google-cloud-clients/google-cloud-container/synth.py b/google-cloud-clients/google-cloud-container/synth.py index a90b022d7fe7..9912e1b859e5 100644 --- a/google-cloud-clients/google-cloud-container/synth.py +++ b/google-cloud-clients/google-cloud-container/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='container', - version='v1', - config_path='/google/container/artman_container_v1.yaml', - artman_output_name='') +service = 'container' +versions = ['v1'] +config_pattern = '/google/container/artman_container_{version}.yaml' -s.copy(library / 'gapic-google-cloud-container-v1/src', 'src') -s.copy(library / 'grpc-google-cloud-container-v1/src', '../../google-api-grpc/grpc-google-cloud-container-v1/src') -s.copy(library / 'proto-google-cloud-container-v1/src', '../../google-api-grpc/proto-google-cloud-container-v1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-containeranalysis/synth.py b/google-cloud-clients/google-cloud-containeranalysis/synth.py index 507371b20c4f..c718465fe486 100644 --- a/google-cloud-clients/google-cloud-containeranalysis/synth.py +++ b/google-cloud-clients/google-cloud-containeranalysis/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='container', - version='v1beta1', - config_path='/google/devtools/containeranalysis/artman_containeranalysis_v1beta1.yaml', - artman_output_name='') +service = 'containeranalysis' +versions = ['v1beta1'] +config_pattern = '/google/devtools/containeranalysis/artman_containeranalysis_{version}.yaml' -s.copy(library / 'gapic-google-cloud-containeranalysis-v1beta1/src', 'src') -s.copy(library / 'grpc-google-cloud-containeranalysis-v1beta1/src', '../../google-api-grpc/grpc-google-cloud-containeranalysis-v1beta1/src') -s.copy(library / 'proto-google-cloud-containeranalysis-v1beta1/src', '../../google-api-grpc/proto-google-cloud-containeranalysis-v1beta1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-dataproc/synth.py b/google-cloud-clients/google-cloud-dataproc/synth.py index 0eac0f7cf1e3..45f25efcb6b9 100644 --- a/google-cloud-clients/google-cloud-dataproc/synth.py +++ b/google-cloud-clients/google-cloud-dataproc/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1", "v1beta2"]: +service = 'dataproc' +versions = ['v1', 'v1beta2'] +config_pattern = '/google/cloud/dataproc/artman_dataproc_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='dataproc', + service=service, version=version, - config_path=f'/google/cloud/dataproc/artman_dataproc_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-dataproc-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-dataproc-{version}/src', f'../../google-api-grpc/grpc-google-cloud-dataproc-{version}/src') - s.copy(library / f'proto-google-cloud-dataproc-{version}/src', f'../../google-api-grpc/proto-google-cloud-dataproc-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-datastore/synth.py b/google-cloud-clients/google-cloud-datastore/synth.py index 96cd0cc53051..8bbcbb807878 100644 --- a/google-cloud-clients/google-cloud-datastore/synth.py +++ b/google-cloud-clients/google-cloud-datastore/synth.py @@ -16,17 +16,23 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='datastore', - version='v1', - config_path='/google/datastore/artman_datastore.yaml', - artman_output_name='') +service = 'datastore' +versions = ['v1'] +config_pattern = '/google/datastore/artman_datastore.yaml' -# Datastore only generates protos -#s.copy(library / 'gapic-google-cloud-datastore-v1/src', 'src') -#s.copy(library / 'grpc-google-cloud-datastore-v1/src', '../../google-api-grpc/grpc-google-cloud-datastore-v1/src') -s.copy(library / 'proto-google-cloud-datastore-v1/src', '../../google-api-grpc/proto-google-cloud-datastore-v1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + # Datastore only generates protos + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-dialogflow/synth.py b/google-cloud-clients/google-cloud-dialogflow/synth.py index 3a63a84b747e..d1004983db4b 100644 --- a/google-cloud-clients/google-cloud-dialogflow/synth.py +++ b/google-cloud-clients/google-cloud-dialogflow/synth.py @@ -16,9 +16,9 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() library = gapic.java_library( service='dialogflow', @@ -40,3 +40,9 @@ s.copy(library / f'gapic-google-cloud-dialogflow-v2beta1/src', 'src') s.copy(library / f'grpc-google-cloud-dialogflow-v2beta1/src', f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src') s.copy(library / f'proto-google-cloud-dialogflow-v2beta1/src', f'../../google-api-grpc/proto-google-cloud-dialogflow-v2beta1/src') + +java.format_code('./src') +java.format_code(f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2/src') +java.format_code(f'../../google-api-grpc/proto-google-cloud-dialogflow-v2/src') +java.format_code(f'../../google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src') +java.format_code(f'../../google-api-grpc/proto-google-cloud-dialogflow-v2beta1/src') diff --git a/google-cloud-clients/google-cloud-dlp/synth.py b/google-cloud-clients/google-cloud-dlp/synth.py index 3f1fa2ccf42d..1ac59c4c892f 100644 --- a/google-cloud-clients/google-cloud-dlp/synth.py +++ b/google-cloud-clients/google-cloud-dlp/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='dlp', - version='v2', - config_path='/google/privacy/dlp/artman_dlp_v2.yaml', - artman_output_name='') +service = 'dlp' +versions = ['v2'] +config_pattern = '/google/privacy/dlp/artman_dlp_{version}.yaml' -s.copy(library / 'gapic-google-cloud-dlp-v2/src', 'src') -s.copy(library / 'grpc-google-cloud-dlp-v2/src', '../../google-api-grpc/grpc-google-cloud-dlp-v2/src') -s.copy(library / 'proto-google-cloud-dlp-v2/src', '../../google-api-grpc/proto-google-cloud-dlp-v2/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-errorreporting/synth.py b/google-cloud-clients/google-cloud-errorreporting/synth.py index 2d7ffc246ff9..8bc4039fa72a 100644 --- a/google-cloud-clients/google-cloud-errorreporting/synth.py +++ b/google-cloud-clients/google-cloud-errorreporting/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='errorreporting', - version='v1beta1', - config_path='/google/devtools/clouderrorreporting/artman_errorreporting.yaml', - artman_output_name='') +service = 'error-reporting' +versions = ['v1beta1'] +config_pattern = '/google/devtools/clouderrorreporting/artman_errorreporting.yaml' -s.copy(library / 'gapic-google-cloud-error-reporting-v1beta1/src', 'src') -s.copy(library / 'grpc-google-cloud-error-reporting-v1beta1/src', '../../google-api-grpc/grpc-google-cloud-error-reporting-v1beta1/src') -s.copy(library / 'proto-google-cloud-error-reporting-v1beta1/src', '../../google-api-grpc/proto-google-cloud-error-reporting-v1beta1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-firestore/synth.py b/google-cloud-clients/google-cloud-firestore/synth.py index 0d86a493d352..d110596733dc 100644 --- a/google-cloud-clients/google-cloud-firestore/synth.py +++ b/google-cloud-clients/google-cloud-firestore/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='firestore', - version='v1beta1', - config_path='/google/firestore/artman_firestore.yaml', - artman_output_name='') +service = 'firestore' +versions = ['v1beta1'] +config_pattern = '/google/firestore/artman_firestore.yaml' -s.copy(library / 'gapic-google-cloud-firestore-v1beta1/src', 'src') -s.copy(library / 'grpc-google-cloud-firestore-v1beta1/src', '../../google-api-grpc/grpc-google-cloud-firestore-v1beta1/src') -s.copy(library / 'proto-google-cloud-firestore-v1beta1/src', '../../google-api-grpc/proto-google-cloud-firestore-v1beta1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-iot/synth.py b/google-cloud-clients/google-cloud-iot/synth.py index dfa0820c6077..25dad03c2c31 100644 --- a/google-cloud-clients/google-cloud-iot/synth.py +++ b/google-cloud-clients/google-cloud-iot/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='iot', - version='v1', - config_path='/google/cloud/iot/artman_cloudiot.yaml', - artman_output_name='') +service = 'iot' +versions = ['v1'] +config_pattern = '/google/cloud/iot/artman_cloudiot.yaml' -s.copy(library / 'gapic-google-cloud-iot-v1/src', 'src') -s.copy(library / 'grpc-google-cloud-iot-v1/src', '../../google-api-grpc/grpc-google-cloud-iot-v1/src') -s.copy(library / 'proto-google-cloud-iot-v1/src', '../../google-api-grpc/proto-google-cloud-iot-v1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-kms/synth.py b/google-cloud-clients/google-cloud-kms/synth.py index fe1e24b2e91c..7943003f99a1 100644 --- a/google-cloud-clients/google-cloud-kms/synth.py +++ b/google-cloud-clients/google-cloud-kms/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='kms', - version='v1', - config_path='/google/cloud/kms/artman_cloudkms.yaml', - artman_output_name='') +service = 'kms' +versions = ['v1'] +config_pattern = '/google/cloud/kms/artman_cloudkms.yaml' -s.copy(library / 'gapic-google-cloud-kms-v1/src', 'src') -s.copy(library / 'grpc-google-cloud-kms-v1/src', '../../google-api-grpc/grpc-google-cloud-kms-v1/src') -s.copy(library / 'proto-google-cloud-kms-v1/src', '../../google-api-grpc/proto-google-cloud-kms-v1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-language/synth.py b/google-cloud-clients/google-cloud-language/synth.py index 31deeaba0bb9..ab3902783bd3 100644 --- a/google-cloud-clients/google-cloud-language/synth.py +++ b/google-cloud-clients/google-cloud-language/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1", "v1beta2"]: +service = 'language' +versions = ['v1', 'v1beta2'] +config_pattern = '/google/cloud/language/artman_language_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='language', + service=service, version=version, - config_path=f'/google/cloud/language/artman_language_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-language-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-language-{version}/src', f'../../google-api-grpc/grpc-google-cloud-language-{version}/src') - s.copy(library / f'proto-google-cloud-language-{version}/src', f'../../google-api-grpc/proto-google-cloud-language-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-logging/synth.py b/google-cloud-clients/google-cloud-logging/synth.py index 3ef4c9c8296c..089b22bdf47b 100644 --- a/google-cloud-clients/google-cloud-logging/synth.py +++ b/google-cloud-clients/google-cloud-logging/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='logging', - version='v2', - config_path='/google/logging/artman_logging.yaml', - artman_output_name='') +service = 'logging' +versions = ['v2'] +config_pattern = '/google/logging/artman_logging.yaml' -s.copy(library / 'gapic-google-cloud-logging-v2/src', 'src') -s.copy(library / 'grpc-google-cloud-logging-v2/src', '../../google-api-grpc/grpc-google-cloud-logging-v2/src') -s.copy(library / 'proto-google-cloud-logging-v2/src', '../../google-api-grpc/proto-google-cloud-logging-v2/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-monitoring/synth.py b/google-cloud-clients/google-cloud-monitoring/synth.py index f1769da0ef8c..1a15400c025d 100644 --- a/google-cloud-clients/google-cloud-monitoring/synth.py +++ b/google-cloud-clients/google-cloud-monitoring/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='monitoring', - version='v3', - config_path='/google/monitoring/artman_monitoring.yaml', - artman_output_name='') +service = 'monitoring' +versions = ['v3'] +config_pattern = '/google/monitoring/artman_monitoring.yaml' -s.copy(library / 'gapic-google-cloud-monitoring-v3/src', 'src') -s.copy(library / 'grpc-google-cloud-monitoring-v3/src', '../../google-api-grpc/grpc-google-cloud-monitoring-v3/src') -s.copy(library / 'proto-google-cloud-monitoring-v3/src', '../../google-api-grpc/proto-google-cloud-monitoring-v3/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-os-login/synth.py b/google-cloud-clients/google-cloud-os-login/synth.py index 20808c0b9c3c..987801c8e32b 100644 --- a/google-cloud-clients/google-cloud-os-login/synth.py +++ b/google-cloud-clients/google-cloud-os-login/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='oslogin', - version='v1', - config_path='/google/cloud/oslogin/artman_oslogin_v1.yaml', - artman_output_name='') +service = 'os-login' +versions = ['v1'] +config_pattern = '/google/cloud/oslogin/artman_oslogin_{version}.yaml' -s.copy(library / 'gapic-google-cloud-os-login-v1/src', 'src') -s.copy(library / 'grpc-google-cloud-os-login-v1/src', '../../google-api-grpc/grpc-google-cloud-os-login-v1/src') -s.copy(library / 'proto-google-cloud-os-login-v1/src', '../../google-api-grpc/proto-google-cloud-os-login-v1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-pubsub/synth.py b/google-cloud-clients/google-cloud-pubsub/synth.py index cadac3a3c528..f8862c71e023 100644 --- a/google-cloud-clients/google-cloud-pubsub/synth.py +++ b/google-cloud-clients/google-cloud-pubsub/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='pubsub', - version='v1', - config_path='/google/pubsub/artman_pubsub.yaml', - artman_output_name='') +service = 'pubsub' +versions = ['v1'] +config_pattern = '/google/pubsub/artman_pubsub.yaml' -s.copy(library / 'gapic-google-cloud-pubsub-v1/src', 'src') -s.copy(library / 'grpc-google-cloud-pubsub-v1/src', '../../google-api-grpc/grpc-google-cloud-pubsub-v1/src') -s.copy(library / 'proto-google-cloud-pubsub-v1/src', '../../google-api-grpc/proto-google-cloud-pubsub-v1/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-redis/synth.py b/google-cloud-clients/google-cloud-redis/synth.py index eb329f9ec81e..0493e91d02a7 100644 --- a/google-cloud-clients/google-cloud-redis/synth.py +++ b/google-cloud-clients/google-cloud-redis/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1", "v1beta1"]: +service = 'redis' +versions = ['v1', 'v1beta1'] +config_pattern = '/google/cloud/redis/artman_redis_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='redis', + service=service, version=version, - config_path=f'/google/cloud/redis/artman_redis_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-redis-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-redis-{version}/src', f'../../google-api-grpc/grpc-google-cloud-redis-{version}/src') - s.copy(library / f'proto-google-cloud-redis-{version}/src', f'../../google-api-grpc/proto-google-cloud-redis-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-scheduler/synth.py b/google-cloud-clients/google-cloud-scheduler/synth.py index b27381aec46e..475a87d1b931 100644 --- a/google-cloud-clients/google-cloud-scheduler/synth.py +++ b/google-cloud-clients/google-cloud-scheduler/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1beta1"]: +service = 'scheduler' +versions = ['v1beta1'] +config_pattern = '/google/cloud/scheduler/artman_cloudscheduler_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='cloudscheduler', + service=service, version=version, - config_path=f'/google/cloud/scheduler/artman_cloudscheduler_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-cloudscheduler-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-cloudscheduler-{version}/src', f'../../google-api-grpc/grpc-google-cloud-scheduler-{version}/src') - s.copy(library / f'proto-google-cloud-cloudscheduler-{version}/src', f'../../google-api-grpc/proto-google-cloud-scheduler-{version}/src') + s.copy(library / f'gapic-google-cloud-cloud{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-cloud{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-cloud{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-securitycenter/synth.py b/google-cloud-clients/google-cloud-securitycenter/synth.py index 4e596b31952e..6a8fa74779f2 100644 --- a/google-cloud-clients/google-cloud-securitycenter/synth.py +++ b/google-cloud-clients/google-cloud-securitycenter/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1beta1"]: +service = 'securitycenter' +versions = ['v1beta1'] +config_pattern = '/google/cloud/securitycenter/artman_securitycenter_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='securitycenter', + service=service, version=version, - config_path=f'/google/cloud/securitycenter/artman_securitycenter_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-securitycenter-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-securitycenter-{version}/src', f'../../google-api-grpc/grpc-google-cloud-securitycenter-{version}/src') - s.copy(library / f'proto-google-cloud-securitycenter-{version}/src', f'../../google-api-grpc/proto-google-cloud-securitycenter-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-spanner/synth.py b/google-cloud-clients/google-cloud-spanner/synth.py index c40f1f36c16a..fe8266addbfd 100644 --- a/google-cloud-clients/google-cloud-spanner/synth.py +++ b/google-cloud-clients/google-cloud-spanner/synth.py @@ -16,9 +16,9 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() library = gapic.java_library( service='spanner', @@ -30,7 +30,6 @@ s.copy(library / 'grpc-google-cloud-spanner-v1/src', '../../google-api-grpc/grpc-google-cloud-spanner-v1/src') s.copy(library / 'proto-google-cloud-spanner-v1/src', '../../google-api-grpc/proto-google-cloud-spanner-v1/src') - library = gapic.java_library( service='spanner', version='v1', @@ -50,3 +49,11 @@ s.copy(library / 'gapic-google-cloud-spanner-admin-instance-v1/src', 'src') s.copy(library / 'grpc-google-cloud-spanner-admin-instance-v1/src', '../../google-api-grpc/grpc-google-cloud-spanner-admin-instance-v1/src') s.copy(library / 'proto-google-cloud-spanner-admin-instance-v1/src', '../../google-api-grpc/proto-google-cloud-spanner-admin-instance-v1/src') + +java.format_code('./src') +java.format_code(f'../../google-api-grpc/grpc-google-cloud-spanner-v1/src') +java.format_code(f'../../google-api-grpc/proto-google-cloud-spanner-v1/src') +java.format_code(f'../../google-api-grpc/grpc-google-cloud-spanner-admin-database-v1/src') +java.format_code(f'../../google-api-grpc/proto-google-cloud-spanner-admin-database-v1/src') +java.format_code(f'../../google-api-grpc/grpc-google-cloud-spanner-admin-instance-v1/src') +java.format_code(f'../../google-api-grpc/proto-google-cloud-spanner-admin-instance-v1/src') diff --git a/google-cloud-clients/google-cloud-speech/synth.py b/google-cloud-clients/google-cloud-speech/synth.py index 0d70e45687ff..aaa5420c3277 100644 --- a/google-cloud-clients/google-cloud-speech/synth.py +++ b/google-cloud-clients/google-cloud-speech/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1", "v1p1beta1"]: +service = 'speech' +versions = ['v1', 'v1p1beta1'] +config_pattern = '/google/cloud/speech/artman_speech_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='speech', + service=service, version=version, - config_path=f'/google/cloud/speech/artman_speech_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-speech-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-speech-{version}/src', f'../../google-api-grpc/grpc-google-cloud-speech-{version}/src') - s.copy(library / f'proto-google-cloud-speech-{version}/src', f'../../google-api-grpc/proto-google-cloud-speech-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-tasks/synth.py b/google-cloud-clients/google-cloud-tasks/synth.py index 686b8445a22d..e609427ef789 100644 --- a/google-cloud-clients/google-cloud-tasks/synth.py +++ b/google-cloud-clients/google-cloud-tasks/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v2beta2", "v2beta3"]: +service = 'tasks' +versions = ['v2beta2', 'v2beta3'] +config_pattern = '/google/cloud/tasks/artman_cloudtasks_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='tasks', + service=service, version=version, - config_path=f'/google/cloud/tasks/artman_cloudtasks_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-tasks-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-tasks-{version}/src', f'../../google-api-grpc/grpc-google-cloud-tasks-{version}/src') - s.copy(library / f'proto-google-cloud-tasks-{version}/src', f'../../google-api-grpc/proto-google-cloud-tasks-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-texttospeech/synth.py b/google-cloud-clients/google-cloud-texttospeech/synth.py index fba2feb7939a..77b2a0219f59 100644 --- a/google-cloud-clients/google-cloud-texttospeech/synth.py +++ b/google-cloud-clients/google-cloud-texttospeech/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1", "v1beta1"]: +service = 'texttospeech' +versions = ['v1','v1beta1'] +config_pattern = '/google/cloud/texttospeech/artman_texttospeech_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='texttospeech', + service=service, version=version, - config_path=f'/google/cloud/texttospeech/artman_texttospeech_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-texttospeech-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-texttospeech-{version}/src', f'../../google-api-grpc/grpc-google-cloud-texttospeech-{version}/src') - s.copy(library / f'proto-google-cloud-texttospeech-{version}/src', f'../../google-api-grpc/proto-google-cloud-texttospeech-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-trace/synth.py b/google-cloud-clients/google-cloud-trace/synth.py index 0ab28bea0938..bbd7985ee0d1 100644 --- a/google-cloud-clients/google-cloud-trace/synth.py +++ b/google-cloud-clients/google-cloud-trace/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1", "v2"]: +service = 'trace' +versions = ['v1', 'v2'] +config_pattern = '/google/devtools/cloudtrace/artman_cloudtrace_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='trace', + service=service, version=version, - config_path=f'/google/devtools/cloudtrace/artman_cloudtrace_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-trace-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-trace-{version}/src', f'../../google-api-grpc/grpc-google-cloud-trace-{version}/src') - s.copy(library / f'proto-google-cloud-trace-{version}/src', f'../../google-api-grpc/proto-google-cloud-trace-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-video-intelligence/synth.py b/google-cloud-clients/google-cloud-video-intelligence/synth.py index e8f06c79dfc4..2d29b508c24b 100644 --- a/google-cloud-clients/google-cloud-video-intelligence/synth.py +++ b/google-cloud-clients/google-cloud-video-intelligence/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1", "v1beta1", "v1beta2", "v1p1beta1", "v1p2beta1"]: +service = 'video-intelligence' +versions = ['v1', 'v1beta1', 'v1beta2', 'v1p1beta1', 'v1p2beta1'] +config_pattern = '/google/cloud/videointelligence/artman_videointelligence_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='videointelligence', + service=service, version=version, - config_path=f'/google/cloud/videointelligence/artman_videointelligence_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-video-intelligence-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-video-intelligence-{version}/src', f'../../google-api-grpc/grpc-google-cloud-video-intelligence-{version}/src') - s.copy(library / f'proto-google-cloud-video-intelligence-{version}/src', f'../../google-api-grpc/proto-google-cloud-video-intelligence-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-vision/synth.py b/google-cloud-clients/google-cloud-vision/synth.py index 507894aaa77d..772ead0519f7 100644 --- a/google-cloud-clients/google-cloud-vision/synth.py +++ b/google-cloud-clients/google-cloud-vision/synth.py @@ -16,17 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -for version in ["v1", "v1p1beta1", "v1p2beta1", "v1p3beta1"]: +service = 'vision' +versions = ['v1', 'v1p1beta1', 'v1p2beta1', 'v1p3beta1'] +config_pattern = '/google/cloud/vision/artman_vision_{version}.yaml' + +for version in versions: library = gapic.java_library( - service='vision', + service=service, version=version, - config_path=f'/google/cloud/vision/artman_vision_{version}.yaml', + config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-vision-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-vision-{version}/src', f'../../google-api-grpc/grpc-google-cloud-vision-{version}/src') - s.copy(library / f'proto-google-cloud-vision-{version}/src', f'../../google-api-grpc/proto-google-cloud-vision-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') diff --git a/google-cloud-clients/google-cloud-websecurityscanner/synth.py b/google-cloud-clients/google-cloud-websecurityscanner/synth.py index 429fa0222203..96c09b487933 100644 --- a/google-cloud-clients/google-cloud-websecurityscanner/synth.py +++ b/google-cloud-clients/google-cloud-websecurityscanner/synth.py @@ -16,16 +16,25 @@ import synthtool as s import synthtool.gcp as gcp +import synthtool.languages.java as java gapic = gcp.GAPICGenerator() -common_templates = gcp.CommonTemplates() -library = gapic.java_library( - service='websecurityscanner', - version='v1alpha', - config_path='/google/cloud/websecurityscanner/artman_websecurityscanner_v1alpha.yaml', - artman_output_name='') +service = 'websecurityscanner' +versions = ['v1alpha'] +config_pattern = '/google/cloud/websecurityscanner/artman_websecurityscanner_{version}.yaml' -s.copy(library / 'gapic-google-cloud-websecurityscanner-v1alpha/src', 'src') -s.copy(library / 'grpc-google-cloud-websecurityscanner-v1alpha/src', '../../google-api-grpc/grpc-google-cloud-websecurityscanner-v1alpha/src') -s.copy(library / 'proto-google-cloud-websecurityscanner-v1alpha/src', '../../google-api-grpc/proto-google-cloud-websecurityscanner-v1alpha/src') +for version in versions: + library = gapic.java_library( + service=service, + version=version, + config_path=config_pattern.format(version=version), + artman_output_name='') + + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + + java.format_code('./src') + java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') + java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')