forked from BigfootDev/flatbuffers
[TS/Bazel] Minor improvements to typescript.bzl (#7300)
* 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. * Minor improvements to typescript.bzl * Uses @...// dependencies so that flatbuffers can actually be used as an external repo (had forgotten to upstream this earlier). * Allows using flatbuffer_ts_library to generate reflection schemas in the same way that flatbuffer_cc_library does (but default it to off to avoid behavioral changes). * Pass through a package_name attribute to flatbuffer_ts_library to allow non-relative imports of generated typescript code. Co-authored-by: Liu Liu <i@liuliu.me>
This commit is contained in:
@@ -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"],
|
||||
)
|
||||
|
||||
16
reflection/ts/BUILD.bazel
Normal file
16
reflection/ts/BUILD.bazel
Normal file
@@ -0,0 +1,16 @@
|
||||
load("//:typescript.bzl", "flatbuffer_ts_library")
|
||||
|
||||
genrule(
|
||||
name = "copy_schema_to_folder",
|
||||
srcs = ["//reflection:reflection_fbs_schema"],
|
||||
outs = ["reflection.fbs"],
|
||||
cmd = "cp $< $@",
|
||||
)
|
||||
|
||||
flatbuffer_ts_library(
|
||||
name = "reflection_ts_fbs",
|
||||
package_name = "flatbuffers_reflection",
|
||||
srcs = [":reflection.fbs"],
|
||||
include_reflection = False,
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
Reference in New Issue
Block a user