summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUILD17
-rw-r--r--build_defs.bzl19
-rwxr-xr-xtools/make_cmakelists.py7
3 files changed, 35 insertions, 8 deletions
diff --git a/BUILD b/BUILD
index 9593936..1c6cdef 100644
--- a/BUILD
+++ b/BUILD
@@ -7,6 +7,7 @@ load(
"lua_library",
"lua_test",
"make_shell_script",
+ "map_dep",
"upb_amalgamation",
"upb_proto_library",
"upb_proto_reflection_library",
@@ -122,9 +123,9 @@ cc_library(
],
hdrs = ["upbc/generator.h"],
deps = [
- "@absl//absl/strings",
- "@com_google_protobuf//:protobuf",
- "@com_google_protobuf//:protoc_lib",
+ map_dep("@absl//absl/strings"),
+ map_dep("@com_google_protobuf//:protobuf"),
+ map_dep("@com_google_protobuf//:protoc_lib"),
],
)
@@ -133,10 +134,16 @@ cc_binary(
srcs = ["upbc/main.cc"],
deps = [
":upbc_generator",
- "@com_google_protobuf//:protoc_lib",
+ map_dep("@com_google_protobuf//:protoc_lib"),
],
)
+
+# We strip the tests and remaining rules from google3 until the upb_proto_library()
+# and upb_proto_reflection_library() rules are fixed.
+
+# copybara:strip_for_google3_begin
+
# C/C++ tests ##################################################################
cc_library(
@@ -487,3 +494,5 @@ generated_file_staleness_test(
],
generated_pattern = "generated/%s",
)
+
+# copybara:strip_end
diff --git a/build_defs.bzl b/build_defs.bzl
index bb4d6f8..1c26a00 100644
--- a/build_defs.bzl
+++ b/build_defs.bzl
@@ -207,6 +207,21 @@ upb_amalgamation = rule(
},
)
+is_bazel = not hasattr(native, "genmpm")
+
+google3_dep_map = {
+ "@absl//absl/strings": "//third_party/absl/strings",
+ "@com_google_protobuf//:protoc": "//third_party/protobuf:protoc",
+ "@com_google_protobuf//:protobuf": "//third_party/protobuf:protobuf",
+ "@com_google_protobuf//:protoc_lib": "//third_party/protobuf:libprotoc",
+}
+
+def map_dep(dep):
+ if is_bazel:
+ return dep
+ else:
+ return google3_dep_map[dep]
+
# upb_proto_library() rule
def _remove_up(string):
@@ -261,7 +276,7 @@ _upb_proto_library_srcs = rule(
"protoc": attr.label(
executable = True,
cfg = "host",
- default = "@com_google_protobuf//:protoc",
+ default = map_dep("@com_google_protobuf//:protoc"),
),
"deps": attr.label_list(),
},
@@ -291,7 +306,7 @@ _upb_proto_reflection_library_srcs = rule(
"protoc": attr.label(
executable = True,
cfg = "host",
- default = "@com_google_protobuf//:protoc",
+ default = map_dep("@com_google_protobuf//:protoc"),
),
"deps": attr.label_list(),
},
diff --git a/tools/make_cmakelists.py b/tools/make_cmakelists.py
index 1e1c1ee..86544cb 100755
--- a/tools/make_cmakelists.py
+++ b/tools/make_cmakelists.py
@@ -134,12 +134,15 @@ class BuildFileFunctions(object):
def select(self, arg_dict):
return []
- def glob(*args):
+ def glob(self, *args):
return []
- def licenses(*args):
+ def licenses(self, *args):
pass
+ def map_dep(self, arg):
+ return arg
+
class WorkspaceFileFunctions(object):
def __init__(self, converter):
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback