From be67bf30adcf239f6fd17359e994d58217e59e7f Mon Sep 17 00:00:00 2001 From: Summer Ji Date: Wed, 6 May 2020 16:37:54 -0700 Subject: [PATCH] fix: synth.py clean up for multiple version (#463) --- packages/google-cloud-language/src/index.ts | 11 +++++------ packages/google-cloud-language/synth.metadata | 12 ++++++++++-- packages/google-cloud-language/synth.py | 12 +++++++----- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/packages/google-cloud-language/src/index.ts b/packages/google-cloud-language/src/index.ts index 99569d71493..eedcf282434 100644 --- a/packages/google-cloud-language/src/index.ts +++ b/packages/google-cloud-language/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC +// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,17 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** This file is automatically generated by synthtool. ** +// ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** -import * as v1beta2 from './v1beta2'; import * as v1 from './v1'; +import * as v1beta2 from './v1beta2'; const LanguageServiceClient = v1.LanguageServiceClient; + export {v1, v1beta2, LanguageServiceClient}; -// For compatibility with JavaScript libraries we need to provide this default export: -// tslint:disable-next-line no-default-export export default {v1, v1beta2, LanguageServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-language/synth.metadata b/packages/google-cloud-language/synth.metadata index b2d7c132976..2aed1b22ad8 100644 --- a/packages/google-cloud-language/synth.metadata +++ b/packages/google-cloud-language/synth.metadata @@ -4,14 +4,22 @@ "git": { "name": ".", "remote": "git@github.com:googleapis/nodejs-language.git", - "sha": "51a2004bb353d2222a9783a0a9908cd86f200f9e" + "sha": "84b62fdebba9b81746d0bceb993ff0e967c9ce5e" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "6dfd72d028a0d0a43764e060f7b15e004385c3a1", + "internalRef": "310168181" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "ab883569eb0257bbf16a6d825fd018b3adde3912" + "sha": "756bc4dfc24e8bc4c5dd4116daa41a0440ebf5a0" } } ], diff --git a/packages/google-cloud-language/synth.py b/packages/google-cloud-language/synth.py index 6ec607fda94..488f984b760 100644 --- a/packages/google-cloud-language/synth.py +++ b/packages/google-cloud-language/synth.py @@ -9,25 +9,27 @@ gapic = gcp.GAPICMicrogenerator() +versions = ['v1', 'v1beta2'] # tasks has two product names, and a poorly named artman yaml -for version in ['v1', 'v1beta2']: +for version in versions: library = gapic.typescript_library( 'language', generator_args={ "grpc-service-config": f"google/cloud/language/{version}/language_grpc_service_config.json", - "package-name":f"@google-cloud/language" - }, + "package-name": f"@google-cloud/language" + }, proto_path=f'/google/cloud/language/{version}', version=version) # skip index, protos, package.json, and README.md s.copy( library, - excludes=['package.json', 'README.md', 'src/index.ts']) + excludes=['package.json', 'README.md']) # Update common templates common_templates = gcp.CommonTemplates() -templates = common_templates.node_library(source_location='build/src') +templates = common_templates.node_library( + source_location='build/src', versions=versions, default_version='v1') s.copy(templates) node.postprocess_gapic_library()