Revert "Migrate from rules_nodejs to rules_js/rules_ts (#7923)" (#7927)

This reverts commit 4172c3f0bd.
This commit is contained in:
Derek Bailey
2023-04-28 12:58:49 -07:00
committed by GitHub
parent 4172c3f0bd
commit e7dc252b0e
35 changed files with 1214 additions and 1697 deletions

View File

@@ -2,7 +2,7 @@
Rules for building typescript flatbuffers with Bazel.
"""
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load(":build_defs.bzl", "flatbuffer_library_public")
DEFAULT_FLATC_TS_ARGS = [
@@ -24,7 +24,8 @@ def flatbuffer_ts_library(
flatc_args = DEFAULT_FLATC_TS_ARGS,
visibility = None,
restricted_to = None,
gen_reflections = False):
gen_reflections = False,
package_name = None):
"""Generates a ts_library rule for a given flatbuffer definition.
Args:
@@ -45,6 +46,7 @@ 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]
@@ -62,7 +64,6 @@ 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,
@@ -70,8 +71,6 @@ 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,
@@ -80,6 +79,7 @@ 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),