From 1755918f8edded7c4edd7e1091ae40dee0d16b68 Mon Sep 17 00:00:00 2001 From: "Brian J. Watson" Date: Wed, 7 Sep 2016 13:29:54 -0700 Subject: [PATCH] Only build common protos with --grpc option for LRO. --- config/common_protos.yml | 2 +- config/dependencies.yml | 2 +- lib/api_repo.js | 16 +++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/config/common_protos.yml b/config/common_protos.yml index 353c581..c845a03 100644 --- a/config/common_protos.yml +++ b/config/common_protos.yml @@ -33,4 +33,4 @@ packages: version: '' # semver is the semantic version of the common protos package. -semver: 1.3.2 +semver: 1.3.3 diff --git a/config/dependencies.yml b/config/dependencies.yml index 44ff431..8cb2cde 100644 --- a/config/dependencies.yml +++ b/config/dependencies.yml @@ -67,7 +67,7 @@ protobuf: googleapis_common_protos: python: - version: '1.3.2' + version: '1.3.3' ruby: version: '1.2.0' diff --git a/lib/api_repo.js b/lib/api_repo.js index f596626..3299fd5 100644 --- a/lib/api_repo.js +++ b/lib/api_repo.js @@ -56,6 +56,9 @@ var DEFAULT_PROTO_COMPILER = 'protoc'; // Python builds using grpcio-tools. var NO_PROTOC_PLUGIN = ['nodejs', 'java', 'python']; +// common protos for which we build gRPC service methods +var COMMON_GRPC_PROTOS = ['operations.proto']; + // the default include path, where install the protobuf runtime installs its // protos. var DEFAULT_INCLUDE_PATH = Object.freeze(['/usr/local/include']); @@ -1018,11 +1021,14 @@ ApiRepo.prototype._makeProtocFunc = function _makeProtocFunc(opts, language) { pluginOption = '--plugin='; } else { args.push('--' + language + '_out=' + outDir); - if (language === 'python') { - // required per https://github.com/grpc/grpc/issues/7857 - args.push('--grpc_python_out=' + outDir); - } else { - args.push('--grpc_out=' + outDir); + if (!opts.buildCommonProtos || + _.includes(COMMON_GRPC_PROTOS, protoPath)) { + if (language === 'python') { + // required per https://github.com/grpc/grpc/issues/7857 + args.push('--grpc_python_out=' + outDir); + } else { + args.push('--grpc_out=' + outDir); + } } } if (!_.includes(NO_PROTOC_PLUGIN, language)) {