mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-02 22:18:21 +00:00
[Bazel] Fix gen_reflections for flatbuffers_ts_library (#7981)
If you used flatbuffers_ts_library with gen_reflections = True then it attempted to use the flat-file compiler rather than flatc itself. Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -87,6 +87,7 @@ def flatbuffer_library_public(
|
|||||||
optionally a Fileset([reflection_name]) with all generated reflection
|
optionally a Fileset([reflection_name]) with all generated reflection
|
||||||
binaries.
|
binaries.
|
||||||
"""
|
"""
|
||||||
|
reflection_include_paths = include_paths
|
||||||
if include_paths == None:
|
if include_paths == None:
|
||||||
include_paths = default_include_paths(flatc_path)
|
include_paths = default_include_paths(flatc_path)
|
||||||
include_paths_cmd = ["-I %s" % (s) for s in include_paths]
|
include_paths_cmd = ["-I %s" % (s) for s in include_paths]
|
||||||
@@ -124,13 +125,16 @@ def flatbuffer_library_public(
|
|||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
if reflection_name:
|
if reflection_name:
|
||||||
|
if reflection_include_paths == None:
|
||||||
|
reflection_include_paths = default_include_paths(TRUE_FLATC_PATH)
|
||||||
|
reflection_include_paths_cmd = ["-I %s" % (s) for s in reflection_include_paths]
|
||||||
reflection_genrule_cmd = " ".join([
|
reflection_genrule_cmd = " ".join([
|
||||||
"SRCS=($(SRCS));",
|
"SRCS=($(SRCS));",
|
||||||
"for f in $${SRCS[@]:0:%s}; do" % len(srcs),
|
"for f in $${SRCS[@]:0:%s}; do" % len(srcs),
|
||||||
"$(location %s)" % (TRUE_FLATC_PATH),
|
"$(location %s)" % (TRUE_FLATC_PATH),
|
||||||
"-b --schema",
|
"-b --schema",
|
||||||
" ".join(flatc_args),
|
" ".join(flatc_args),
|
||||||
" ".join(include_paths_cmd),
|
" ".join(reflection_include_paths_cmd),
|
||||||
language_flag,
|
language_flag,
|
||||||
output_directory,
|
output_directory,
|
||||||
"$$f;",
|
"$$f;",
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ genrule(
|
|||||||
flatbuffer_ts_library(
|
flatbuffer_ts_library(
|
||||||
name = "reflection_ts_fbs",
|
name = "reflection_ts_fbs",
|
||||||
srcs = [":reflection.fbs"],
|
srcs = [":reflection.fbs"],
|
||||||
|
gen_reflections = True,
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user