From 090caa280993477f6eee5c8787b8d26c53b0a5e9 Mon Sep 17 00:00:00 2001 From: Liu Liu Date: Mon, 13 Jun 2022 06:36:52 -0700 Subject: [PATCH] Move reflection_ts_fbs into a separate directory (#7342) Right now, reflection_ts_fbs target is in reflection/BUILD.bazel. This is not ideal because reflection:reflection_fbs_schema is referenced from :flatc in the root. Thus, for any Bazel projects that want to include flatbuffers, they need to include npm / yarn_install and nodejs support all because reflection/BUILD.bazel loads typescript.bzl and that requires all TypeScript things. This PR separated that target into a different subdirectory, freeing root BUILD.bazel from that dependency. --- reflection/BUILD.bazel | 9 --------- reflection/ts/BUILD.bazel | 8 ++++++++ typescript.bzl | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 reflection/ts/BUILD.bazel diff --git a/reflection/BUILD.bazel b/reflection/BUILD.bazel index fd548776b..f2760933c 100644 --- a/reflection/BUILD.bazel +++ b/reflection/BUILD.bazel @@ -1,14 +1,5 @@ -load("//:typescript.bzl", "flatbuffer_ts_library") - filegroup( name = "reflection_fbs_schema", srcs = ["reflection.fbs"], visibility = ["//visibility:public"], ) - -flatbuffer_ts_library( - name = "reflection_ts_fbs", - srcs = ["reflection.fbs"], - include_reflection = False, - visibility = ["//visibility:public"], -) diff --git a/reflection/ts/BUILD.bazel b/reflection/ts/BUILD.bazel new file mode 100644 index 000000000..64047812f --- /dev/null +++ b/reflection/ts/BUILD.bazel @@ -0,0 +1,8 @@ +load("//:typescript.bzl", "flatbuffer_ts_library") + +flatbuffer_ts_library( + name = "reflection_ts_fbs", + srcs = ["//reflection:reflection_fbs_schema"], + include_reflection = False, + visibility = ["//visibility:public"], +) diff --git a/typescript.bzl b/typescript.bzl index f87eff193..4f7e9aa98 100644 --- a/typescript.bzl +++ b/typescript.bzl @@ -85,7 +85,7 @@ def flatbuffer_ts_library( "types": ["node"], }, }, - deps = deps + ["//ts:flatbuffers"] + (["//reflection:reflection_ts_fbs"] if include_reflection else []), + deps = deps + ["//ts:flatbuffers"] + (["//reflection/ts:reflection_ts_fbs"] if include_reflection else []), ) js_library( name = name,