From 204473cdb58a354506040826b47ef9329dc5c79c Mon Sep 17 00:00:00 2001 From: James Kuszmaul Date: Wed, 31 May 2023 11:07:37 -0700 Subject: [PATCH] [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 --- build_defs.bzl | 6 +++++- reflection/ts/BUILD.bazel | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build_defs.bzl b/build_defs.bzl index e2d21e454..fff235448 100644 --- a/build_defs.bzl +++ b/build_defs.bzl @@ -87,6 +87,7 @@ def flatbuffer_library_public( optionally a Fileset([reflection_name]) with all generated reflection binaries. """ + reflection_include_paths = include_paths if include_paths == None: include_paths = default_include_paths(flatc_path) include_paths_cmd = ["-I %s" % (s) for s in include_paths] @@ -124,13 +125,16 @@ def flatbuffer_library_public( **kwargs ) 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([ "SRCS=($(SRCS));", "for f in $${SRCS[@]:0:%s}; do" % len(srcs), "$(location %s)" % (TRUE_FLATC_PATH), "-b --schema", " ".join(flatc_args), - " ".join(include_paths_cmd), + " ".join(reflection_include_paths_cmd), language_flag, output_directory, "$$f;", diff --git a/reflection/ts/BUILD.bazel b/reflection/ts/BUILD.bazel index 18ffd983b..0b3dfbe9a 100644 --- a/reflection/ts/BUILD.bazel +++ b/reflection/ts/BUILD.bazel @@ -10,5 +10,6 @@ genrule( flatbuffer_ts_library( name = "reflection_ts_fbs", srcs = [":reflection.fbs"], + gen_reflections = True, visibility = ["//visibility:public"], )