aboutsummaryrefslogtreecommitdiff
path: root/protobuf.bzl
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2015-10-19 14:41:00 -0700
committerJisi Liu <jisi.liu@gmail.com>2015-10-19 14:41:00 -0700
commit6dac0822c4f7dab9a1f6abc6e20cd0dc80a96915 (patch)
tree47b0f8679ea55461a0d2a93c18446eff4fd9687e /protobuf.bzl
parent3101e7337cdade287bdba97dd7c08ee5d4c14587 (diff)
downloadprotobuf-6dac0822c4f7dab9a1f6abc6e20cd0dc80a96915.tar.gz
protobuf-6dac0822c4f7dab9a1f6abc6e20cd0dc80a96915.tar.bz2
protobuf-6dac0822c4f7dab9a1f6abc6e20cd0dc80a96915.zip
Allow include to be None.
This enables the use case where all the paths are relative to the workspace root, e.g. foo/bar/BUILD /foo.proto -- package foo.bar would generate the message correctly.
Diffstat (limited to 'protobuf.bzl')
-rw-r--r--protobuf.bzl10
1 files changed, 8 insertions, 2 deletions
diff --git a/protobuf.bzl b/protobuf.bzl
index 79dabd02..b83f7f5a 100644
--- a/protobuf.bzl
+++ b/protobuf.bzl
@@ -1,6 +1,8 @@
# -*- mode: python; -*- PYTHON-PREPROCESSING-REQUIRED
def _gen_dir(ctx):
+ if ctx.attr.include == None:
+ return ""
if not ctx.attr.include:
return ctx.label.package
if not ctx.label.package:
@@ -70,7 +72,7 @@ def cc_proto_library(
srcs=[],
deps=[],
cc_libs=[],
- include="",
+ include=None,
protoc=":protoc",
internal_bootstrap_hack=False,
**kargs):
@@ -119,9 +121,13 @@ def cc_proto_library(
outs=outs,
)
+ includes = []
+ if include != None:
+ includes = [include]
+
native.cc_library(
name=name,
srcs=outs,
deps=cc_libs + deps,
- includes=[include],
+ includes=includes,
**kargs)