forked from stackb/rules_proto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_proto_library.bzl
More file actions
29 lines (25 loc) · 893 Bytes
/
python_proto_library.bzl
File metadata and controls
29 lines (25 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
load("//python:python_proto_compile.bzl", "python_proto_compile")
load("@protobuf_py_deps//:requirements.bzl", protobuf_requirements = "all_requirements")
def python_proto_library(**kwargs):
name = kwargs.get("name")
deps = kwargs.get("deps")
visibility = kwargs.get("visibility")
name_pb = name + "_pb"
python_proto_compile(
name = name_pb,
deps = deps,
visibility = visibility,
verbose = kwargs.pop("verbose", 0),
transitivity = kwargs.pop("transitivity", {}),
transitive = kwargs.pop("transitive", True),
)
native.py_library(
name = name,
srcs = [name_pb],
deps = protobuf_requirements,
# This magically adds REPOSITORY_NAME/PACKAGE_NAME/{name_pb} to PYTHONPATH
imports = [name_pb],
visibility = visibility,
)
# Alias
py_proto_library = python_proto_library