aboutsummaryrefslogtreecommitdiff
path: root/protobuf.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'protobuf.bzl')
-rw-r--r--protobuf.bzl19
1 files changed, 13 insertions, 6 deletions
diff --git a/protobuf.bzl b/protobuf.bzl
index 86c6f251..f674a6c6 100644
--- a/protobuf.bzl
+++ b/protobuf.bzl
@@ -1,13 +1,19 @@
# -*- mode: python; -*- PYTHON-PREPROCESSING-REQUIRED
+def _GetPath(ctx, path):
+ if ctx.label.workspace_root:
+ return ctx.label.workspace_root + '/' + path
+ else:
+ return path
+
def _GenDir(ctx):
if not ctx.attr.includes:
- return ""
+ return ctx.label.workspace_root
if not ctx.attr.includes[0]:
- return ctx.label.package
+ return _GetPath(ctx, ctx.label.package)
if not ctx.label.package:
- return ctx.attr.includes[0]
- return ctx.label.package + '/' + ctx.attr.includes[0]
+ return _GetPath(ctx, ctx.attr.includes[0])
+ return _GetPath(ctx, ctx.label.package + '/' + ctx.attr.includes[0])
def _CcOuts(srcs):
return [s[:-len(".proto")] + ".pb.h" for s in srcs] + \
@@ -36,8 +42,6 @@ def _RelativeOutputPath(path, include):
return path[len(PACKAGE_NAME)+1:]
-
-
def _proto_gen_impl(ctx):
"""General implementation for generating protos"""
srcs = ctx.files.srcs
@@ -141,6 +145,7 @@ def cc_proto_library(
deps=[s + "_genproto" for s in deps],
includes=includes,
protoc=protoc,
+ visibility=["//visibility:public"],
)
# An empty cc_library to make rule dependency consistent.
native.cc_library(
@@ -157,6 +162,7 @@ def cc_proto_library(
protoc=protoc,
gen_cc=1,
outs=outs,
+ visibility=["//visibility:public"],
)
if default_runtime and not default_runtime in cc_libs:
@@ -245,6 +251,7 @@ def py_proto_library(
protoc=protoc,
gen_py=1,
outs=outs,
+ visibility=["//visibility:public"],
)
if include != None: