aboutsummaryrefslogtreecommitdiff
path: root/protobuf.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'protobuf.bzl')
-rw-r--r--protobuf.bzl25
1 files changed, 25 insertions, 0 deletions
diff --git a/protobuf.bzl b/protobuf.bzl
index 71eaba22..fbcae0b3 100644
--- a/protobuf.bzl
+++ b/protobuf.bzl
@@ -199,6 +199,31 @@ def cc_proto_library(
includes=includes,
**kargs)
+
+def internal_gen_well_known_protos_java(srcs):
+ """Bazel rule to generate the gen_well_known_protos_java genrule
+
+ Args:
+ srcs: the well known protos
+ """
+ root = Label("%s//protobuf_java" % (REPOSITORY_NAME)).workspace_root
+ if root == "":
+ include = " -Isrc "
+ else:
+ include = " -I%s/src " % root
+ native.genrule(
+ name = "gen_well_known_protos_java",
+ srcs = srcs,
+ outs = [
+ "wellknown.srcjar",
+ ],
+ cmd = "$(location :protoc) --java_out=$(@D)/wellknown.jar" +
+ " %s $(SRCS) " % include +
+ " && mv $(@D)/wellknown.jar $(@D)/wellknown.srcjar",
+ tools = [":protoc"],
+ )
+
+
def py_proto_library(
name,
srcs=[],