Skip to content
This repository was archived by the owner on Jan 18, 2026. It is now read-only.

Commit 2d77494

Browse files
fix: make plugin parameters work properly (#574)
1 parent baaf40d commit 2d77494

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

rules_typescript_gapic/typescript_gapic.bzl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ def typescript_gapic_library(
2626
extra_protoc_parameters = [],
2727
extra_protoc_file_parameters = {},
2828
**kwargs):
29-
# Note: if extra parameters contain any of the named parameters, the behavior is undefined
30-
# (up to the plugin implementation)
3129

3230
plugin_args_dict = {}
3331
if package_name:
@@ -38,12 +36,16 @@ def typescript_gapic_library(
3836
plugin_args_dict["iam-service"] = iam_service
3937

4038
file_args = {} # note: keys are filenames, values are parameter name, aligned with the prior art
39+
for key, value in extra_protoc_file_parameters:
40+
file_args[key] = value
4141
if grpc_service_config:
4242
file_args[grpc_service_config] = "grpc-service-config"
4343
if bundle_config:
4444
file_args[bundle_config] = "bundle-config"
4545

46-
plugin_args = extra_protoc_parameters
46+
plugin_args = []
47+
for parameter in extra_protoc_parameters:
48+
plugin_args.append(parameter)
4749
for key, value in plugin_args_dict.items():
4850
plugin_args.append("{}={}".format(key, value))
4951

src/generator.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,14 @@ export class Generator {
7979
const parameters = parameter.split(',');
8080
for (let param of parameters) {
8181
// remove double quote
82-
param = param.substring(1, param.length - 1);
82+
if (param[0] === '"' && param[param.length - 1] === '"') {
83+
param = param.substring(1, param.length - 1);
84+
}
8385
const arr = param.split('=');
8486
this.paramMap[arr[0].toKebabCase()] = arr[1];
8587
}
88+
// Print the parameters to simplify transition to Bazel build.
89+
console.warn('gapic-generator-typescript parameters:', this.paramMap);
8690
}
8791

8892
private async readGrpcServiceConfig() {

0 commit comments

Comments
 (0)