Skip to content

Commit 527accd

Browse files
committed
build: update flatbuffers dependency to v23.5.26
Update the third_party flatbuffers library to v23.5.26, synchronizing the override BUILD and build_defs.bzl files with those from upstream TF at e4485c98eae. BUG=unsuccessful attempt to fix warning in #2183
1 parent f2f53c1 commit 527accd

File tree

3 files changed

+25
-29
lines changed

3 files changed

+25
-29
lines changed

third_party/flatbuffers/BUILD.external

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,23 @@ load(":build_defs.bzl", "flatbuffer_py_strip_prefix_srcs")
22

33
package(default_visibility = ["//visibility:public"])
44

5-
licenses(["notice"])
5+
licenses(["notice"]) # Apache 2.0
66

7-
exports_files(["LICENSE.txt"])
8-
9-
licenses(["notice"])
7+
exports_files(["LICENSE"])
108

119
config_setting(
12-
name = "freebsd",
10+
name = "platform_freebsd",
1311
values = {"cpu": "freebsd"},
1412
)
1513

16-
config_setting(
17-
name = "windows",
18-
values = {"cpu": "x64_windows"},
19-
)
20-
2114
config_setting(
2215
name = "platform_openbsd",
2316
values = {"cpu": "openbsd"},
2417
)
2518

2619
config_setting(
27-
name = "platform_freebsd",
28-
values = {"cpu": "freebsd"},
20+
name = "windows",
21+
values = {"cpu": "x64_windows"},
2922
)
3023

3124
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
@@ -47,12 +40,13 @@ filegroup(
4740
"include/flatbuffers/allocator.h",
4841
"include/flatbuffers/array.h",
4942
"include/flatbuffers/base.h",
50-
"include/flatbuffers/bfbs_generator.h",
5143
"include/flatbuffers/buffer.h",
5244
"include/flatbuffers/buffer_ref.h",
45+
"include/flatbuffers/code_generator.h",
5346
"include/flatbuffers/code_generators.h",
5447
"include/flatbuffers/default_allocator.h",
5548
"include/flatbuffers/detached_buffer.h",
49+
"include/flatbuffers/file_manager.h",
5650
"include/flatbuffers/flatbuffer_builder.h",
5751
"include/flatbuffers/flatbuffers.h",
5852
"include/flatbuffers/flex_flat_util.h",
@@ -73,7 +67,7 @@ filegroup(
7367
"include/flatbuffers/vector_downward.h",
7468
"include/flatbuffers/verifier.h",
7569
],
76-
visibility = ["//:__subpackages__"],
70+
visibility = ["//visibility:public"],
7771
)
7872

7973
# Public flatc compiler library.
@@ -90,9 +84,11 @@ cc_library(
9084
cc_binary(
9185
name = "flatc",
9286
linkopts = select({
93-
":freebsd": [
87+
":platform_freebsd": [
9488
"-lm",
9589
],
90+
# If Visual Studio 2022 developers facing linking errors,
91+
# change the line below as ":windows": ["/DEFAULTLIB:msvcrt.lib"],
9692
":windows": [],
9793
"//conditions:default": [
9894
"-lm",
@@ -110,7 +106,7 @@ filegroup(
110106
srcs = [
111107
"include/flatbuffers/flatc.h",
112108
],
113-
visibility = ["//:__subpackages__"],
109+
visibility = ["//visibility:public"],
114110
)
115111

116112
# Library used by flatbuffer_cc_library rules.
@@ -120,22 +116,13 @@ cc_library(
120116
"include/flatbuffers/allocator.h",
121117
"include/flatbuffers/array.h",
122118
"include/flatbuffers/base.h",
123-
"include/flatbuffers/bfbs_generator.h",
124119
"include/flatbuffers/buffer.h",
125120
"include/flatbuffers/buffer_ref.h",
126-
"include/flatbuffers/code_generators.h",
127121
"include/flatbuffers/default_allocator.h",
128122
"include/flatbuffers/detached_buffer.h",
129123
"include/flatbuffers/flatbuffer_builder.h",
130124
"include/flatbuffers/flatbuffers.h",
131125
"include/flatbuffers/flexbuffers.h",
132-
"include/flatbuffers/grpc.h",
133-
"include/flatbuffers/hash.h",
134-
"include/flatbuffers/idl.h",
135-
"include/flatbuffers/minireflect.h",
136-
"include/flatbuffers/reflection.h",
137-
"include/flatbuffers/reflection_generated.h",
138-
"include/flatbuffers/registry.h",
139126
"include/flatbuffers/stl_emulation.h",
140127
"include/flatbuffers/string.h",
141128
"include/flatbuffers/struct.h",
@@ -187,4 +174,4 @@ py_library(
187174
name = "runtime_py",
188175
srcs = [":runtime_py_srcs"],
189176
visibility = ["//visibility:public"],
190-
)
177+
)

third_party/flatbuffers/build_defs.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ def _gen_flatbuffer_srcs_impl(ctx):
279279
else:
280280
no_includes_statement = []
281281

282+
if ctx.attr.language_flag == "--python":
283+
onefile_statement = ["--gen-onefile"]
284+
else:
285+
onefile_statement = []
286+
282287
# Need to generate all files in a directory.
283288
if not outputs:
284289
outputs = [ctx.actions.declare_directory("{}_all".format(ctx.attr.name))]
@@ -314,6 +319,7 @@ def _gen_flatbuffer_srcs_impl(ctx):
314319
"-I",
315320
ctx.bin_dir.path,
316321
] + no_includes_statement +
322+
onefile_statement +
317323
include_paths_cmd_line + [
318324
"--no-union-value-namespacing",
319325
"--gen-object-api",
@@ -394,6 +400,7 @@ def _concat_flatbuffer_py_srcs_impl(ctx):
394400
ctx.attr.deps[0].files.to_list()[0].path,
395401
ctx.outputs.out.path,
396402
),
403+
use_default_shell_env = True,
397404
)
398405

399406
_concat_flatbuffer_py_srcs = rule(
@@ -432,6 +439,8 @@ def flatbuffer_py_library(
432439
deps = deps,
433440
include_paths = include_paths,
434441
)
442+
443+
# TODO(b/235550563): Remove the concatnation rule with 2.0.6 update.
435444
all_srcs_no_include = "{}_srcs_no_include".format(name)
436445
_gen_flatbuffer_srcs(
437446
name = all_srcs_no_include,

third_party/flatbuffers/workspace.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ load("//third_party:repo.bzl", "tf_http_archive")
55
def repo():
66
tf_http_archive(
77
name = "flatbuffers",
8-
strip_prefix = "flatbuffers-a66de58af9565586832c276fbb4251fc416bf07f",
9-
sha256 = "da06ac2fc6fed8e38b6392f5a20fa24a4290cecaadd87aef16b6b84960408680",
8+
strip_prefix = "flatbuffers-23.5.26",
9+
sha256 = "1cce06b17cddd896b6d73cc047e36a254fb8df4d7ea18a46acf16c4c0cd3f3f3",
1010
urls = [
11-
"https://github.com/google/flatbuffers/archive/a66de58af9565586832c276fbb4251fc416bf07f.tar.gz",
11+
"https://github.com/google/flatbuffers/archive/v23.5.26.tar.gz",
1212
],
1313
build_file = "//third_party/flatbuffers:BUILD.external",
1414
system_build_file = "//third_party/flatbuffers:BUILD.system",

0 commit comments

Comments
 (0)