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

Commit 2d33224

Browse files
authored
feat: Add opt_args to py_gapic_library (#411)
This is to suport <plugin_name>_opt command line args for protoc with a <plugin>. See #390 for more details. This PR depends on googleapis/gapic-generator#3191 Example of usage: ```bzl py_gapic_library( name = "documentai_py_gapic", srcs = [":documentai_proto"], opt_args = [ "old-naming", "lazy-import", "python-gapic-name=documentai", "python-gapic-templates=ads-templates", ], ) ```
1 parent b670319 commit 2d33224

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

repositories.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def gapic_generator_python():
5858
_maybe(
5959
http_archive,
6060
name = "com_google_api_codegen",
61-
strip_prefix = "gapic-generator-b32c73219d617f90de70bfa6ff0ea0b0dd638dfe",
62-
urls = ["https://github.com/googleapis/gapic-generator/archive/b32c73219d617f90de70bfa6ff0ea0b0dd638dfe.zip"],
61+
strip_prefix = "gapic-generator-03abac35ec0716c6f426ffc1532f9a62f1c9e6a2",
62+
urls = ["https://github.com/googleapis/gapic-generator/archive/03abac35ec0716c6f426ffc1532f9a62f1c9e6a2.zip"],
6363
)
6464

6565
def gapic_generator_register_toolchains():

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ MarkupSafe==1.1.1
66
protobuf==3.11.3
77
pypandoc==1.5
88
PyYAML==5.3.1
9-
dataclasses==0.7
9+
dataclasses==0.6

rules_python_gapic/py_gapic.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
load("@com_google_api_codegen//rules_gapic:gapic.bzl", "proto_custom_library")
1616

17-
def py_gapic_library(name, srcs, plugin_args = [], **kwargs):
17+
def py_gapic_library(name, srcs, plugin_args = [], opt_args = [], **kwargs):
1818
# srcjar_target_name = "%s_srcjar" % name
1919
srcjar_target_name = name
2020
srcjar_output_suffix = ".srcjar"
@@ -25,6 +25,7 @@ def py_gapic_library(name, srcs, plugin_args = [], **kwargs):
2525
plugin = Label("@gapic_generator_python//:gapic_plugin"),
2626
plugin_args = plugin_args,
2727
plugin_file_args = {},
28+
opt_args = opt_args,
2829
output_type = "python_gapic",
2930
output_suffix = srcjar_output_suffix,
3031
**kwargs

0 commit comments

Comments
 (0)