Flatbuffers Merge commit '8cd6f0538a362ceefbcfcbf6c7b8b3f341d1fb41' into master
Upgrade flatbuffers to the latest.
Change-Id: I901787ac6fc5d7ce2c4019cc0d275de68086b4d8
diff --git a/third_party/flatbuffers/build_defs.bzl b/third_party/flatbuffers/build_defs.bzl
index f4c1dc7..afafe1c 100644
--- a/third_party/flatbuffers/build_defs.bzl
+++ b/third_party/flatbuffers/build_defs.bzl
@@ -4,6 +4,7 @@
"""
Rules for building C++ flatbuffers with Bazel.
"""
+
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library")
flatc_path = "@com_github_google_flatbuffers//:flatc"
@@ -48,6 +49,7 @@
reflection_name = "",
reflection_visibility = None,
compatible_with = None,
+ restricted_to = None,
output_to_bindir = False):
"""Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
@@ -65,6 +67,11 @@
reflection binaries for the schemas.
reflection_visibility: The visibility of the generated reflection Fileset.
output_to_bindir: Passed to genrule for output to bin directory.
+ compatible_with: Optional, The list of environments this rule can be
+ built for, in addition to default-supported environments.
+ restricted_to: Optional, The list of environments this rule can be built
+ for, instead of default-supported environments.
+ output_to_bindir: Passed to genrule for output to bin directory.
This rule creates a filegroup(name) with all generated source files, and
@@ -97,8 +104,9 @@
output_to_bindir = output_to_bindir,
tools = [flatc_path],
cmd = genrule_cmd,
- message = "Generating flatbuffer files for %s:" % (name),
compatible_with = compatible_with,
+ restricted_to = restricted_to,
+ message = "Generating flatbuffer files for %s:" % (name),
)
if reflection_name:
reflection_genrule_cmd = " ".join([
@@ -123,27 +131,30 @@
outs = reflection_outs,
output_to_bindir = output_to_bindir,
tools = [flatc_path],
+ compatible_with = compatible_with,
+ restricted_to = restricted_to,
cmd = reflection_genrule_cmd,
message = "Generating flatbuffer reflection binary for %s:" % (name),
- compatible_with = compatible_with,
)
native.filegroup(
name = "%s_out" % reflection_name,
srcs = reflection_outs,
visibility = reflection_visibility,
compatible_with = compatible_with,
+ restricted_to = restricted_to,
)
def flatbuffer_cc_library(
name,
srcs,
srcs_filegroup_name = "",
- compatible_with = None,
out_prefix = "",
includes = [],
include_paths = DEFAULT_INCLUDE_PATHS,
flatc_args = DEFAULT_FLATC_ARGS,
visibility = None,
+ compatible_with = None,
+ restricted_to = None,
srcs_filegroup_visibility = None,
gen_reflections = False):
'''A cc_library with the generated reader/writers for the given flatbuffer definitions.
@@ -167,6 +178,10 @@
By default, use the value of the visibility parameter above.
gen_reflections: Optional, if true this will generate the flatbuffer
reflection binaries for the schemas.
+ compatible_with: Optional, The list of environments this rule can be built
+ for, in addition to default-supported environments.
+ restricted_to: Optional, The list of environments this rule can be built
+ for, instead of default-supported environments.
This produces:
filegroup([name]_srcs): all generated .h files.
@@ -222,9 +237,10 @@
includes = includes,
include_paths = include_paths,
flatc_args = flatc_args,
+ compatible_with = compatible_with,
+ restricted_to = restricted_to,
reflection_name = reflection_name,
reflection_visibility = visibility,
- compatible_with = compatible_with,
)
native.cc_library(
name = name,
@@ -241,9 +257,10 @@
"@com_github_google_flatbuffers//:runtime_cc",
],
includes = [],
+ compatible_with = compatible_with,
+ restricted_to = restricted_to,
linkstatic = 1,
visibility = visibility,
- compatible_with = compatible_with,
)
# A filegroup for the `srcs`. That is, all the schema files for this
@@ -251,8 +268,9 @@
native.filegroup(
name = srcs_filegroup_name if srcs_filegroup_name else "%s_includes" % (name),
srcs = srcs,
- visibility = srcs_filegroup_visibility if srcs_filegroup_visibility != None else visibility,
compatible_with = compatible_with,
+ restricted_to = restricted_to,
+ visibility = srcs_filegroup_visibility if srcs_filegroup_visibility != None else visibility,
)
def flatbuffer_py_library(