summaryrefslogtreecommitdiff
path: root/build_defs.bzl
diff options
context:
space:
mode:
authorJosh Haberman <jhaberman@gmail.com>2019-01-27 21:57:28 -0800
committerJosh Haberman <jhaberman@gmail.com>2019-01-27 21:57:28 -0800
commit68d86cbc5906b6821fd2d44080634891fb9f3fab (patch)
tree1033bf8b79ec94ca8bad111749f1aad1b62bb9f0 /build_defs.bzl
parent9ea6bb467810b958c8c2fb0bcf96d0af2b243801 (diff)
Ported BUILD file fixes for google3 to arrayapi branch.
Diffstat (limited to 'build_defs.bzl')
-rw-r--r--build_defs.bzl36
1 files changed, 27 insertions, 9 deletions
diff --git a/build_defs.bzl b/build_defs.bzl
index 7445fce..a6e5086 100644
--- a/build_defs.bzl
+++ b/build_defs.bzl
@@ -1,4 +1,3 @@
-
_shell_find_runfiles = """
# --- begin runfiles.bash initialization ---
# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash).
@@ -100,7 +99,7 @@ BASE=$(dirname $(rlocation upb/upb_c.so))
export LUA_CPATH="$BASE/?.so"
export LUA_PATH="$BASE/?.lua"
$(rlocation lua/lua) $(rlocation upb/tools/upbc.lua) "$@"
-"""
+""",
)
rule(
@@ -109,10 +108,10 @@ $(rlocation lua/lua) $(rlocation upb/tools/upbc.lua) "$@"
data = ["@lua//:lua", "@bazel_tools//tools/bash/runfiles", luamain] + luadeps,
)
-def lua_binary(name, luamain, luadeps=[]):
+def lua_binary(name, luamain, luadeps = []):
_lua_binary_or_test(name, luamain, luadeps, native.sh_binary)
-def lua_test(name, luamain, luadeps=[]):
+def lua_test(name, luamain, luadeps = []):
_lua_binary_or_test(name, luamain, luadeps, native.sh_test)
def generated_file_staleness_test(name, outs, generated_pattern):
@@ -163,9 +162,9 @@ def generated_file_staleness_test(name, outs, generated_pattern):
SrcList = provider(
fields = {
- 'srcs' : 'list of srcs',
- 'hdrs' : 'list of hdrs',
- }
+ "srcs": "list of srcs",
+ "hdrs": "list of hdrs",
+ },
)
def _file_list_aspect_impl(target, ctx):
@@ -205,9 +204,24 @@ upb_amalgamation = rule(
),
"libs": attr.label_list(aspects = [_file_list_aspect]),
"outs": attr.output_list(),
- }
+ },
)
+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):
@@ -223,7 +237,7 @@ def _upb_proto_library_srcs_impl(ctx):
outs = []
include_dirs = {}
for dep in ctx.attr.deps:
- if hasattr(dep, 'proto'):
+ if hasattr(dep, "proto"):
for src in dep.proto.transitive_sources:
sources.append(src)
include_dirs[_remove_suffix(src.path, _remove_up(src.short_path) + "." + src.extension)] = True
@@ -273,3 +287,7 @@ def upb_proto_library(name, deps, upbc):
deps = [":upb"],
copts = ["-Ibazel-out/k8-fastbuild/bin"],
)
+
+def licenses(*args):
+ # No-op (for Google-internal usage).
+ pass
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback