mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 19:02:40 +00:00
Migrate from rules_nodejs to rules_js/rules_ts (#7923)
* Start using pnpm
* Add @npm
* get more stuff set up
* Get the analysis phase passing.
* Get esbuild working?
* Get it compiling?
$ bazel build //tests/ts/...
* Try to get the test working
* test is passing
* Get the other tests working
* clarify comment
* clean up a bit
* Try to add another test
* Add another test
* clean up more
* remove unused reference
* Add e2e test
* Get more of the test working
* add lock file
* Get test working on its own
* Get e2e test passing
* fix infinite recursion
* Add comments
* clean up some more
* clean up more again
* Source typescript version from package.json
* run buildifier
* lint
* Fix unset `extra_env`
* Incorporate feedback
* run buildifier
---------
Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
Rules for building typescript flatbuffers with Bazel.
|
||||
"""
|
||||
|
||||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
|
||||
load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
load(":build_defs.bzl", "flatbuffer_library_public")
|
||||
|
||||
DEFAULT_FLATC_TS_ARGS = [
|
||||
@@ -24,8 +24,7 @@ def flatbuffer_ts_library(
|
||||
flatc_args = DEFAULT_FLATC_TS_ARGS,
|
||||
visibility = None,
|
||||
restricted_to = None,
|
||||
gen_reflections = False,
|
||||
package_name = None):
|
||||
gen_reflections = False):
|
||||
"""Generates a ts_library rule for a given flatbuffer definition.
|
||||
|
||||
Args:
|
||||
@@ -46,7 +45,6 @@ def flatbuffer_ts_library(
|
||||
to use.
|
||||
gen_reflections: Optional, if true this will generate the flatbuffer
|
||||
reflection binaries for the schemas.
|
||||
package_name: Optional, Package name to use for the generated code.
|
||||
"""
|
||||
srcs_lib = "%s_srcs" % (name)
|
||||
out_base = [s.replace(".fbs", "").split("/")[-1].split(":")[-1] for s in srcs]
|
||||
@@ -64,6 +62,7 @@ def flatbuffer_ts_library(
|
||||
language_flag = "--ts",
|
||||
includes = includes,
|
||||
include_paths = include_paths,
|
||||
extra_env = "ESBUILD_BIN=$(ESBUILD_BIN)",
|
||||
flatc_args = flatc_args + ["--filename-suffix _generated"],
|
||||
compatible_with = compatible_with,
|
||||
restricted_to = restricted_to,
|
||||
@@ -71,6 +70,8 @@ def flatbuffer_ts_library(
|
||||
reflection_visibility = visibility,
|
||||
target_compatible_with = target_compatible_with,
|
||||
flatc_path = "@com_github_google_flatbuffers//ts:compile_flat_file",
|
||||
toolchains = ["@aspect_rules_esbuild//esbuild:resolved_toolchain"],
|
||||
tools = ["@aspect_rules_esbuild//esbuild:resolved_toolchain"],
|
||||
)
|
||||
js_library(
|
||||
name = name,
|
||||
@@ -79,7 +80,6 @@ def flatbuffer_ts_library(
|
||||
restricted_to = restricted_to,
|
||||
target_compatible_with = target_compatible_with,
|
||||
srcs = outs,
|
||||
package_name = package_name,
|
||||
)
|
||||
native.filegroup(
|
||||
name = "%s_includes" % (name),
|
||||
|
||||
Reference in New Issue
Block a user