From f17c8455e9af78e145767d3567431fb78881a493 Mon Sep 17 00:00:00 2001 From: Adam Liddell Date: Sun, 4 Jun 2023 23:21:51 +0100 Subject: [PATCH] Add support for passing data attr to Python library rules, closes #257 --- python/python_grpc_library.bzl | 1 + python/python_grpclib_library.bzl | 1 + python/python_proto_library.bzl | 1 + tools/rulegen/python.go | 3 +++ 4 files changed, 6 insertions(+) diff --git a/python/python_grpc_library.bzl b/python/python_grpc_library.bzl index 7c03120d..bec78aa7 100644 --- a/python/python_grpc_library.bzl +++ b/python/python_grpc_library.bzl @@ -22,6 +22,7 @@ def python_grpc_library(name, **kwargs): name = name, srcs = [name_pb], deps = GRPC_DEPS + kwargs.get("deps", []), + data = kwargs.get("data", []), # See https://github.com/rules-proto-grpc/rules_proto_grpc/issues/257 for use case imports = [name_pb], **{ k: v diff --git a/python/python_grpclib_library.bzl b/python/python_grpclib_library.bzl index 3c84a03d..7755e8d7 100644 --- a/python/python_grpclib_library.bzl +++ b/python/python_grpclib_library.bzl @@ -24,6 +24,7 @@ def python_grpclib_library(name, **kwargs): deps = [ "@com_google_protobuf//:protobuf_python", ] + GRPC_DEPS + kwargs.get("deps", []), + data = kwargs.get("data", []), # See https://github.com/rules-proto-grpc/rules_proto_grpc/issues/257 for use case imports = [name_pb], **{ k: v diff --git a/python/python_proto_library.bzl b/python/python_proto_library.bzl index 74555aa0..7af7957e 100644 --- a/python/python_proto_library.bzl +++ b/python/python_proto_library.bzl @@ -22,6 +22,7 @@ def python_proto_library(name, **kwargs): name = name, srcs = [name_pb], deps = PROTO_DEPS + kwargs.get("deps", []), + data = kwargs.get("data", []), # See https://github.com/rules-proto-grpc/rules_proto_grpc/issues/257 for use case imports = [name_pb], **{ k: v diff --git a/tools/rulegen/python.go b/tools/rulegen/python.go index 533ffd96..8600f169 100644 --- a/tools/rulegen/python.go +++ b/tools/rulegen/python.go @@ -53,6 +53,7 @@ def {{ .Rule.Name }}(name, **kwargs): name = name, srcs = [name_pb], deps = PROTO_DEPS + kwargs.get("deps", []), + data = kwargs.get("data", []), # See https://github.com/rules-proto-grpc/rules_proto_grpc/issues/257 for use case imports = [name_pb], {{ .Common.LibraryArgsForwardingSnippet }} ) @@ -78,6 +79,7 @@ def {{ .Rule.Name }}(name, **kwargs): name = name, srcs = [name_pb], deps = GRPC_DEPS + kwargs.get("deps", []), + data = kwargs.get("data", []), # See https://github.com/rules-proto-grpc/rules_proto_grpc/issues/257 for use case imports = [name_pb], {{ .Common.LibraryArgsForwardingSnippet }} ) @@ -106,6 +108,7 @@ def {{ .Rule.Name }}(name, **kwargs): deps = [ "@com_google_protobuf//:protobuf_python", ] + GRPC_DEPS + kwargs.get("deps", []), + data = kwargs.get("data", []), # See https://github.com/rules-proto-grpc/rules_proto_grpc/issues/257 for use case imports = [name_pb], {{ .Common.LibraryArgsForwardingSnippet }} )