...

Text file src/edge-infra.dev/hack/patches/bazel/flatbuffers.patch

Documentation: edge-infra.dev/hack/patches/bazel

     1diff -urN a/BUILD.bazel b/BUILD.bazel
     2--- a/BUILD.bazel	2023-05-17 17:37:21.521745059 +0000
     3+++ b/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
     4@@ -1,112 +0,0 @@
     5-load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
     6-
     7-licenses(["notice"])
     8-
     9-package(
    10-    default_visibility = ["//visibility:public"],
    11-)
    12-
    13-exports_files([
    14-    "LICENSE",
    15-    "tsconfig.json",
    16-])
    17-
    18-config_setting(
    19-    name = "platform_freebsd",
    20-    constraint_values = [
    21-        "@platforms//os:freebsd",
    22-    ],
    23-)
    24-
    25-config_setting(
    26-    name = "platform_openbsd",
    27-    constraint_values = [
    28-        "@platforms//os:openbsd",
    29-    ],
    30-)
    31-
    32-# Public flatc library to compile flatbuffer files at runtime.
    33-cc_library(
    34-    name = "flatbuffers",
    35-    hdrs = ["//:public_headers"],
    36-    linkstatic = 1,
    37-    strip_include_prefix = "/include",
    38-    deps = ["//src:flatbuffers"],
    39-)
    40-
    41-# Public C++ headers for the Flatbuffers library.
    42-filegroup(
    43-    name = "public_headers",
    44-    srcs = [
    45-        "include/flatbuffers/allocator.h",
    46-        "include/flatbuffers/array.h",
    47-        "include/flatbuffers/base.h",
    48-        "include/flatbuffers/bfbs_generator.h",
    49-        "include/flatbuffers/buffer.h",
    50-        "include/flatbuffers/buffer_ref.h",
    51-        "include/flatbuffers/code_generators.h",
    52-        "include/flatbuffers/default_allocator.h",
    53-        "include/flatbuffers/detached_buffer.h",
    54-        "include/flatbuffers/flatbuffer_builder.h",
    55-        "include/flatbuffers/flatbuffers.h",
    56-        "include/flatbuffers/flex_flat_util.h",
    57-        "include/flatbuffers/flexbuffers.h",
    58-        "include/flatbuffers/grpc.h",
    59-        "include/flatbuffers/hash.h",
    60-        "include/flatbuffers/idl.h",
    61-        "include/flatbuffers/minireflect.h",
    62-        "include/flatbuffers/reflection.h",
    63-        "include/flatbuffers/reflection_generated.h",
    64-        "include/flatbuffers/registry.h",
    65-        "include/flatbuffers/stl_emulation.h",
    66-        "include/flatbuffers/string.h",
    67-        "include/flatbuffers/struct.h",
    68-        "include/flatbuffers/table.h",
    69-        "include/flatbuffers/util.h",
    70-        "include/flatbuffers/vector.h",
    71-        "include/flatbuffers/vector_downward.h",
    72-        "include/flatbuffers/verifier.h",
    73-    ],
    74-)
    75-
    76-# Public flatc compiler library.
    77-cc_library(
    78-    name = "flatc_library",
    79-    linkstatic = 1,
    80-    deps = [
    81-        "//src:flatc_library",
    82-    ],
    83-)
    84-
    85-# Public flatc compiler.
    86-cc_binary(
    87-    name = "flatc",
    88-    data = ["//reflection:reflection_fbs_schema"],
    89-    deps = [
    90-        "//src:flatc",
    91-    ],
    92-)
    93-
    94-filegroup(
    95-    name = "flatc_headers",
    96-    srcs = [
    97-        "include/flatbuffers/flatc.h",
    98-    ],
    99-    visibility = ["//:__subpackages__"],
   100-)
   101-
   102-# Library used by flatbuffer_cc_library rules.
   103-cc_library(
   104-    name = "runtime_cc",
   105-    hdrs = [
   106-        "include/flatbuffers/base.h",
   107-        "include/flatbuffers/flatbuffers.h",
   108-        "include/flatbuffers/flexbuffers.h",
   109-        "include/flatbuffers/stl_emulation.h",
   110-        "include/flatbuffers/util.h",
   111-        "include/flatbuffers/vector.h",
   112-        "include/flatbuffers/verifier.h",
   113-    ],
   114-    linkstatic = 1,
   115-    strip_include_prefix = "/include",
   116-)
   117diff -urN a/build_defs.bzl b/build_defs.bzl
   118--- a/build_defs.bzl	2023-05-17 17:37:21.521745059 +0000
   119+++ b/build_defs.bzl	1970-01-01 00:00:00.000000000 +0000
   120@@ -1,255 +0,0 @@
   121-# Description:
   122-#   BUILD rules for generating flatbuffer files in various languages.
   123-
   124-"""
   125-Rules for building C++ flatbuffers with Bazel.
   126-"""
   127-
   128-load("@rules_cc//cc:defs.bzl", "cc_library")
   129-
   130-flatc_path = "@com_github_google_flatbuffers//:flatc"
   131-
   132-DEFAULT_INCLUDE_PATHS = [
   133-    "./",
   134-    "$(GENDIR)",
   135-    "$(BINDIR)",
   136-    "$(execpath @com_github_google_flatbuffers//:flatc).runfiles/com_github_google_flatbuffers",
   137-]
   138-
   139-DEFAULT_FLATC_ARGS = [
   140-    "--gen-object-api",
   141-    "--gen-compare",
   142-    "--no-includes",
   143-    "--gen-mutable",
   144-    "--reflect-names",
   145-    "--cpp-ptr-type flatbuffers::unique_ptr",
   146-]
   147-
   148-def flatbuffer_library_public(
   149-        name,
   150-        srcs,
   151-        outs,
   152-        language_flag,
   153-        out_prefix = "",
   154-        includes = [],
   155-        include_paths = DEFAULT_INCLUDE_PATHS,
   156-        flatc_args = DEFAULT_FLATC_ARGS,
   157-        reflection_name = "",
   158-        reflection_visibility = None,
   159-        compatible_with = None,
   160-        restricted_to = None,
   161-        target_compatible_with = None,
   162-        output_to_bindir = False):
   163-    """Generates code files for reading/writing the given flatbuffers in the requested language using the public compiler.
   164-
   165-    Args:
   166-      name: Rule name.
   167-      srcs: Source .fbs files. Sent in order to the compiler.
   168-      outs: Output files from flatc.
   169-      language_flag: Target language flag. One of [-c, -j, -js].
   170-      out_prefix: Prepend this path to the front of all generated files except on
   171-          single source targets. Usually is a directory name.
   172-      includes: Optional, list of filegroups of schemas that the srcs depend on.
   173-      include_paths: Optional, list of paths the includes files can be found in.
   174-      flatc_args: Optional, list of additional arguments to pass to flatc.
   175-      reflection_name: Optional, if set this will generate the flatbuffer
   176-        reflection binaries for the schemas.
   177-      reflection_visibility: The visibility of the generated reflection Fileset.
   178-      output_to_bindir: Passed to genrule for output to bin directory.
   179-      compatible_with: Optional, The list of environments this rule can be
   180-        built for, in addition to default-supported environments.
   181-      restricted_to: Optional, The list of environments this rule can be built
   182-        for, instead of default-supported environments.
   183-      target_compatible_with: Optional, The list of target platform constraints
   184-        to use.
   185-      output_to_bindir: Passed to genrule for output to bin directory.
   186-
   187-
   188-    This rule creates a filegroup(name) with all generated source files, and
   189-    optionally a Fileset([reflection_name]) with all generated reflection
   190-    binaries.
   191-    """
   192-    include_paths_cmd = ["-I %s" % (s) for s in include_paths]
   193-
   194-    # '$(@D)' when given a single source target will give the appropriate
   195-    # directory. Appending 'out_prefix' is only necessary when given a build
   196-    # target with multiple sources.
   197-    output_directory = (
   198-        ("-o $(@D)/%s" % (out_prefix)) if len(srcs) > 1 else ("-o $(@D)")
   199-    )
   200-    genrule_cmd = " ".join([
   201-        "SRCS=($(SRCS));",
   202-        "for f in $${SRCS[@]:0:%s}; do" % len(srcs),
   203-        "$(location %s)" % (flatc_path),
   204-        " ".join(include_paths_cmd),
   205-        " ".join(flatc_args),
   206-        language_flag,
   207-        output_directory,
   208-        "$$f;",
   209-        "done",
   210-    ])
   211-    native.genrule(
   212-        name = name,
   213-        srcs = srcs + includes,
   214-        outs = outs,
   215-        output_to_bindir = output_to_bindir,
   216-        tools = [flatc_path],
   217-        cmd = genrule_cmd,
   218-        compatible_with = compatible_with,
   219-        target_compatible_with = target_compatible_with,
   220-        restricted_to = restricted_to,
   221-        message = "Generating flatbuffer files for %s:" % (name),
   222-    )
   223-    if reflection_name:
   224-        reflection_genrule_cmd = " ".join([
   225-            "SRCS=($(SRCS));",
   226-            "for f in $${SRCS[@]:0:%s}; do" % len(srcs),
   227-            "$(location %s)" % (flatc_path),
   228-            "-b --schema",
   229-            " ".join(flatc_args),
   230-            " ".join(include_paths_cmd),
   231-            language_flag,
   232-            output_directory,
   233-            "$$f;",
   234-            "done",
   235-        ])
   236-        reflection_outs = [
   237-            (out_prefix + "%s.bfbs") % (s.replace(".fbs", "").split("/")[-1])
   238-            for s in srcs
   239-        ]
   240-        native.genrule(
   241-            name = "%s_srcs" % reflection_name,
   242-            srcs = srcs + includes,
   243-            outs = reflection_outs,
   244-            output_to_bindir = output_to_bindir,
   245-            tools = [flatc_path],
   246-            compatible_with = compatible_with,
   247-            restricted_to = restricted_to,
   248-            target_compatible_with = target_compatible_with,
   249-            cmd = reflection_genrule_cmd,
   250-            message = "Generating flatbuffer reflection binary for %s:" % (name),
   251-            visibility = reflection_visibility,
   252-        )
   253-        native.filegroup(
   254-            name = "%s_out" % reflection_name,
   255-            srcs = reflection_outs,
   256-            visibility = reflection_visibility,
   257-            compatible_with = compatible_with,
   258-            restricted_to = restricted_to,
   259-        )
   260-
   261-def flatbuffer_cc_library(
   262-        name,
   263-        srcs,
   264-        srcs_filegroup_name = "",
   265-        out_prefix = "",
   266-        deps = [],
   267-        includes = [],
   268-        include_paths = DEFAULT_INCLUDE_PATHS,
   269-        cc_include_paths = [],
   270-        flatc_args = DEFAULT_FLATC_ARGS,
   271-        visibility = None,
   272-        compatible_with = None,
   273-        restricted_to = None,
   274-        target_compatible_with = None,
   275-        srcs_filegroup_visibility = None,
   276-        gen_reflections = False):
   277-    """A cc_library with the generated reader/writers for the given flatbuffer definitions.
   278-
   279-    Args:
   280-      name: Rule name.
   281-      srcs: Source .fbs files. Sent in order to the compiler.
   282-      srcs_filegroup_name: Name of the output filegroup that holds srcs. Pass this
   283-          filegroup into the `includes` parameter of any other
   284-          flatbuffer_cc_library that depends on this one's schemas.
   285-      out_prefix: Prepend this path to the front of all generated files. Usually
   286-          is a directory name.
   287-      deps: Optional, list of other flatbuffer_cc_library's to depend on. Cannot be specified
   288-          alongside includes.
   289-      includes: Optional, list of filegroups of schemas that the srcs depend on.
   290-          Use of this is discouraged, and may be deprecated.
   291-      include_paths: Optional, list of paths the includes files can be found in.
   292-      cc_include_paths: Optional, list of paths to add to the cc_library includes attribute.
   293-      flatc_args: Optional list of additional arguments to pass to flatc
   294-          (e.g. --gen-mutable).
   295-      visibility: The visibility of the generated cc_library. By default, use the
   296-          default visibility of the project.
   297-      srcs_filegroup_visibility: The visibility of the generated srcs filegroup.
   298-          By default, use the value of the visibility parameter above.
   299-      gen_reflections: Optional, if true this will generate the flatbuffer
   300-        reflection binaries for the schemas.
   301-      compatible_with: Optional, The list of environments this rule can be built
   302-        for, in addition to default-supported environments.
   303-      restricted_to: Optional, The list of environments this rule can be built
   304-        for, instead of default-supported environments.
   305-      target_compatible_with: Optional, The list of target platform constraints
   306-        to use.
   307-
   308-    This produces:
   309-      filegroup([name]_srcs): all generated .h files.
   310-      filegroup(srcs_filegroup_name if specified, or [name]_includes if not):
   311-          Other flatbuffer_cc_library's can pass this in for their `includes`
   312-          parameter, if they depend on the schemas in this library.
   313-      Fileset([name]_reflection): (Optional) all generated reflection binaries.
   314-      cc_library([name]): library with sources and flatbuffers deps.
   315-    """
   316-    output_headers = [
   317-        (out_prefix + "%s_generated.h") % (s.replace(".fbs", "").split("/")[-1].split(":")[-1])
   318-        for s in srcs
   319-    ]
   320-    if deps and includes:
   321-        # There is no inherent reason we couldn't support both, but this discourages
   322-        # use of includes without good reason.
   323-        fail("Cannot specify both deps and include in flatbuffer_cc_library.")
   324-    if deps:
   325-        includes = [d + "_includes" for d in deps]
   326-    reflection_name = "%s_reflection" % name if gen_reflections else ""
   327-
   328-    srcs_lib = "%s_srcs" % (name)
   329-    flatbuffer_library_public(
   330-        name = srcs_lib,
   331-        srcs = srcs,
   332-        outs = output_headers,
   333-        language_flag = "-c",
   334-        out_prefix = out_prefix,
   335-        includes = includes,
   336-        include_paths = include_paths,
   337-        flatc_args = flatc_args,
   338-        compatible_with = compatible_with,
   339-        restricted_to = restricted_to,
   340-        target_compatible_with = target_compatible_with,
   341-        reflection_name = reflection_name,
   342-        reflection_visibility = visibility,
   343-    )
   344-    cc_library(
   345-        name = name,
   346-        hdrs = [
   347-            ":" + srcs_lib,
   348-        ],
   349-        srcs = [
   350-            ":" + srcs_lib,
   351-        ],
   352-        features = [
   353-            "-parse_headers",
   354-        ],
   355-        deps = [
   356-            "@com_github_google_flatbuffers//:runtime_cc",
   357-            "@com_github_google_flatbuffers//:flatbuffers",
   358-        ] + deps,
   359-        includes = cc_include_paths,
   360-        compatible_with = compatible_with,
   361-        restricted_to = restricted_to,
   362-        target_compatible_with = target_compatible_with,
   363-        linkstatic = 1,
   364-        visibility = visibility,
   365-    )
   366-
   367-    # A filegroup for the `srcs`. That is, all the schema files for this
   368-    # Flatbuffer set.
   369-    native.filegroup(
   370-        name = srcs_filegroup_name if srcs_filegroup_name else "%s_includes" % (name),
   371-        srcs = srcs + includes,
   372-        compatible_with = compatible_with,
   373-        restricted_to = restricted_to,
   374-        visibility = srcs_filegroup_visibility if srcs_filegroup_visibility != None else visibility,
   375-    )
   376diff -urN a/grpc/src/compiler/BUILD.bazel b/grpc/src/compiler/BUILD.bazel
   377--- a/grpc/src/compiler/BUILD.bazel	2023-05-17 17:37:21.529744923 +0000
   378+++ b/grpc/src/compiler/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   379@@ -1,121 +0,0 @@
   380-load("@rules_cc//cc:defs.bzl", "cc_library")
   381-
   382-package(
   383-    default_visibility = ["//visibility:public"],
   384-)
   385-
   386-filegroup(
   387-    name = "common_headers",
   388-    srcs = [
   389-        "schema_interface.h",
   390-    ],
   391-)
   392-
   393-cc_library(
   394-    name = "cpp_generator",
   395-    srcs = [
   396-        "cpp_generator.cc",
   397-    ],
   398-    hdrs = [
   399-        "cpp_generator.h",
   400-        ":common_headers",
   401-    ],
   402-    include_prefix = "src/compiler",
   403-    strip_include_prefix = "/grpc/src/compiler",
   404-    deps = [
   405-        "//:flatbuffers",
   406-    ],
   407-)
   408-
   409-cc_library(
   410-    name = "go_generator",
   411-    srcs = [
   412-        "go_generator.cc",
   413-    ],
   414-    hdrs = [
   415-        "go_generator.h",
   416-        ":common_headers",
   417-    ],
   418-    include_prefix = "src/compiler",
   419-    strip_include_prefix = "/grpc/src/compiler",
   420-    deps = [
   421-        "//:flatbuffers",
   422-    ],
   423-)
   424-
   425-cc_library(
   426-    name = "java_generator",
   427-    srcs = [
   428-        "java_generator.cc",
   429-    ],
   430-    hdrs = [
   431-        "java_generator.h",
   432-        ":common_headers",
   433-    ],
   434-    include_prefix = "src/compiler",
   435-    strip_include_prefix = "/grpc/src/compiler",
   436-    deps = [
   437-        "//:flatbuffers",
   438-    ],
   439-)
   440-
   441-cc_library(
   442-    name = "python_generator",
   443-    hdrs = [
   444-        "python_generator.h",
   445-    ],
   446-    include_prefix = "src/compiler",
   447-    strip_include_prefix = "/grpc/src/compiler",
   448-    deps = [
   449-        ":python_generator_private",
   450-    ],
   451-)
   452-
   453-cc_library(
   454-    name = "python_generator_private",
   455-    srcs = [
   456-        "python_generator.cc",
   457-    ],
   458-    hdrs = [
   459-        "python_generator.h",
   460-        ":common_headers",
   461-    ],
   462-    include_prefix = "src/compiler",
   463-    strip_include_prefix = "/grpc/src/compiler",
   464-    visibility = ["//visibility:private"],
   465-    deps = [
   466-        "//:flatbuffers",
   467-    ],
   468-)
   469-
   470-cc_library(
   471-    name = "swift_generator",
   472-    srcs = [
   473-        "swift_generator.cc",
   474-    ],
   475-    hdrs = [
   476-        "swift_generator.h",
   477-        ":common_headers",
   478-    ],
   479-    include_prefix = "src/compiler",
   480-    strip_include_prefix = "/grpc/src/compiler",
   481-    deps = [
   482-        "//:flatbuffers",
   483-    ],
   484-)
   485-
   486-cc_library(
   487-    name = "ts_generator",
   488-    srcs = [
   489-        "ts_generator.cc",
   490-    ],
   491-    hdrs = [
   492-        "ts_generator.h",
   493-        ":common_headers",
   494-    ],
   495-    include_prefix = "src/compiler",
   496-    strip_include_prefix = "/grpc/src/compiler",
   497-    deps = [
   498-        "//:flatbuffers",
   499-    ],
   500-)
   501diff -urN a/grpc/tests/BUILD b/grpc/tests/BUILD
   502--- a/grpc/tests/BUILD	2023-05-17 17:37:21.529744923 +0000
   503+++ b/grpc/tests/BUILD	1970-01-01 00:00:00.000000000 +0000
   504@@ -1,17 +0,0 @@
   505-cc_test(
   506-    name = "grpc_test",
   507-    srcs = [
   508-        "grpctest.cpp",
   509-        "message_builder_test.cpp",
   510-    ],
   511-    copts = ["-Itests"],
   512-    # This is required.
   513-    linkstatic = 1,
   514-    deps = [
   515-        "//tests:monster_test_cc_fbs",
   516-        "//tests:monster_test_grpc",
   517-        "//tests:test_assert",
   518-        "//tests:test_builder",
   519-        "@com_github_grpc_grpc//:grpc++",
   520-    ],
   521-)
   522diff -urN a/reflection/BUILD.bazel b/reflection/BUILD.bazel
   523--- a/reflection/BUILD.bazel	2023-05-17 17:37:21.521745059 +0000
   524+++ b/reflection/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   525@@ -1,5 +0,0 @@
   526-filegroup(
   527-    name = "reflection_fbs_schema",
   528-    srcs = ["reflection.fbs"],
   529-    visibility = ["//visibility:public"],
   530-)
   531diff -urN a/reflection/ts/BUILD.bazel b/reflection/ts/BUILD.bazel
   532--- a/reflection/ts/BUILD.bazel	2023-05-17 17:37:21.521745059 +0000
   533+++ b/reflection/ts/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   534@@ -1,16 +0,0 @@
   535-load("//:typescript.bzl", "flatbuffer_ts_library")
   536-
   537-genrule(
   538-    name = "copy_schema_to_folder",
   539-    srcs = ["//reflection:reflection_fbs_schema"],
   540-    outs = ["reflection.fbs"],
   541-    cmd = "cp $< $@",
   542-)
   543-
   544-flatbuffer_ts_library(
   545-    name = "reflection_ts_fbs",
   546-    package_name = "flatbuffers_reflection",
   547-    srcs = [":reflection.fbs"],
   548-    include_reflection = False,
   549-    visibility = ["//visibility:public"],
   550-)
   551diff -urN a/src/BUILD.bazel b/src/BUILD.bazel
   552--- a/src/BUILD.bazel	2023-05-17 17:37:21.549744583 +0000
   553+++ b/src/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   554@@ -1,101 +0,0 @@
   555-# @unused
   556-load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
   557-
   558-package(
   559-    default_visibility = ["//visibility:private"],
   560-)
   561-
   562-# Public flatc library to compile flatbuffer files at runtime.
   563-cc_library(
   564-    name = "flatbuffers",
   565-    srcs = [
   566-        "code_generators.cpp",
   567-        "idl_gen_fbs.cpp",
   568-        "idl_gen_text.cpp",
   569-        "idl_parser.cpp",
   570-        "reflection.cpp",
   571-        "util.cpp",
   572-    ],
   573-    hdrs = ["//:public_headers"],
   574-    linkopts = select({
   575-        # TODO: Bazel uses `clang` instead of `clang++` to link
   576-        # C++ code on BSD. Temporarily adding these linker flags while
   577-        # we wait for Bazel to resolve
   578-        # https://github.com/bazelbuild/bazel/issues/12023.
   579-        "//:platform_freebsd": ["-lm"],
   580-        "//:platform_openbsd": ["-lm"],
   581-        "//conditions:default": [],
   582-    }),
   583-    strip_include_prefix = "/include",
   584-    visibility = ["//:__pkg__"],
   585-)
   586-
   587-# Public flatc compiler library.
   588-cc_library(
   589-    name = "flatc_library",
   590-    srcs = [
   591-        "annotated_binary_text_gen.cpp",
   592-        "annotated_binary_text_gen.h",
   593-        "bfbs_gen.h",
   594-        "bfbs_gen_lua.cpp",
   595-        "bfbs_gen_lua.h",
   596-        "bfbs_namer.h",
   597-        "binary_annotator.cpp",
   598-        "binary_annotator.h",
   599-        "flatc.cpp",
   600-        "namer.h",
   601-    ],
   602-    hdrs = [
   603-        "//:flatc_headers",
   604-    ],
   605-    strip_include_prefix = "/include",
   606-    visibility = ["//:__pkg__"],
   607-    deps = [
   608-        ":flatbuffers",
   609-    ],
   610-)
   611-
   612-# Public flatc compiler.
   613-cc_library(
   614-    name = "flatc",
   615-    srcs = [
   616-        "bfbs_gen.h",
   617-        "bfbs_gen_lua.cpp",
   618-        "bfbs_gen_lua.h",
   619-        "bfbs_namer.h",
   620-        "flatc_main.cpp",
   621-        "idl_gen_cpp.cpp",
   622-        "idl_gen_csharp.cpp",
   623-        "idl_gen_dart.cpp",
   624-        "idl_gen_go.cpp",
   625-        "idl_gen_grpc.cpp",
   626-        "idl_gen_java.cpp",
   627-        "idl_gen_json_schema.cpp",
   628-        "idl_gen_kotlin.cpp",
   629-        "idl_gen_lobster.cpp",
   630-        "idl_gen_lua.cpp",
   631-        "idl_gen_php.cpp",
   632-        "idl_gen_python.cpp",
   633-        "idl_gen_rust.cpp",
   634-        "idl_gen_swift.cpp",
   635-        "idl_gen_text.cpp",
   636-        "idl_gen_ts.cpp",
   637-        "idl_namer.h",
   638-        "namer.h",
   639-        "util.cpp",
   640-    ],
   641-    hdrs = [
   642-        "//:flatc_headers",
   643-    ],
   644-    strip_include_prefix = "/include",
   645-    visibility = ["//:__pkg__"],
   646-    deps = [
   647-        ":flatc_library",
   648-        "//grpc/src/compiler:cpp_generator",
   649-        "//grpc/src/compiler:go_generator",
   650-        "//grpc/src/compiler:java_generator",
   651-        "//grpc/src/compiler:python_generator",
   652-        "//grpc/src/compiler:swift_generator",
   653-        "//grpc/src/compiler:ts_generator",
   654-    ],
   655-)
   656diff -urN a/swift/BUILD.bazel b/swift/BUILD.bazel
   657--- a/swift/BUILD.bazel	2023-05-17 17:37:21.549744583 +0000
   658+++ b/swift/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   659@@ -1,8 +0,0 @@
   660-load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
   661-
   662-swift_library(
   663-    name = "swift",
   664-    srcs = glob(["Sources/FlatBuffers/*.swift"]),
   665-    module_name = "FlatBuffers",
   666-    visibility = ["//visibility:public"],
   667-)
   668diff -urN a/tests/BUILD.bazel b/tests/BUILD.bazel
   669--- a/tests/BUILD.bazel	2023-05-17 17:37:21.553744516 +0000
   670+++ b/tests/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   671@@ -1,233 +0,0 @@
   672-load("@io_bazel_rules_go//go:def.bzl", "go_test")
   673-load("@rules_cc//cc:defs.bzl", "cc_test")
   674-load("//:build_defs.bzl", "flatbuffer_cc_library")
   675-load("//:typescript.bzl", "flatbuffer_ts_library")
   676-
   677-package(default_visibility = ["//visibility:private"])
   678-
   679-# Test binary.
   680-cc_test(
   681-    name = "flatbuffers_test",
   682-    testonly = 1,
   683-    srcs = [
   684-        "evolution_test.cpp",
   685-        "evolution_test.h",
   686-        "evolution_test/evolution_v1_generated.h",
   687-        "evolution_test/evolution_v2_generated.h",
   688-        "flexbuffers_test.cpp",
   689-        "flexbuffers_test.h",
   690-        "fuzz_test.cpp",
   691-        "fuzz_test.h",
   692-        "is_quiet_nan.h",
   693-        "json_test.cpp",
   694-        "json_test.h",
   695-        "monster_test.cpp",
   696-        "monster_test.h",
   697-        "monster_test_bfbs_generated.h",
   698-        "namespace_test/namespace_test1_generated.h",
   699-        "namespace_test/namespace_test2_generated.h",
   700-        "native_inline_table_test_generated.h",
   701-        "native_type_test_impl.cpp",
   702-        "native_type_test_impl.h",
   703-        "optional_scalars_generated.h",
   704-        "optional_scalars_test.cpp",
   705-        "optional_scalars_test.h",
   706-        "parser_test.cpp",
   707-        "parser_test.h",
   708-        "proto_test.cpp",
   709-        "proto_test.h",
   710-        "reflection_test.cpp",
   711-        "reflection_test.h",
   712-        "test.cpp",
   713-        "test_assert.cpp",
   714-        "test_assert.h",
   715-        "test_builder.cpp",
   716-        "test_builder.h",
   717-        "union_vector/union_vector_generated.h",
   718-        "util_test.cpp",
   719-        "util_test.h",
   720-    ],
   721-    copts = [
   722-        "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
   723-        "-DBAZEL_TEST_DATA_PATH",
   724-    ],
   725-    data = [
   726-        ":arrays_test.bfbs",
   727-        ":arrays_test.fbs",
   728-        ":arrays_test.golden",
   729-        ":evolution_test/evolution_v1.fbs",
   730-        ":evolution_test/evolution_v1.json",
   731-        ":evolution_test/evolution_v2.fbs",
   732-        ":evolution_test/evolution_v2.json",
   733-        ":include_test/include_test1.fbs",
   734-        ":include_test/sub/include_test2.fbs",
   735-        ":monster_extra.fbs",
   736-        ":monster_test.bfbs",
   737-        ":monster_test.fbs",
   738-        ":monsterdata_extra.json",
   739-        ":monsterdata_test.golden",
   740-        ":monsterdata_test.json",
   741-        ":name_clash_test/invalid_test1.fbs",
   742-        ":name_clash_test/invalid_test2.fbs",
   743-        ":name_clash_test/valid_test1.fbs",
   744-        ":name_clash_test/valid_test2.fbs",
   745-        ":native_type_test.fbs",
   746-        ":optional_scalars.fbs",
   747-        ":optional_scalars.json",
   748-        ":optional_scalars_defaults.json",
   749-        ":prototest/imported.proto",
   750-        ":prototest/test.golden",
   751-        ":prototest/test.proto",
   752-        ":prototest/test_include.golden",
   753-        ":prototest/test_suffix.golden",
   754-        ":prototest/test_union.golden",
   755-        ":prototest/test_union_include.golden",
   756-        ":prototest/test_union_suffix.golden",
   757-        ":unicode_test.json",
   758-        ":union_vector/union_vector.fbs",
   759-        ":union_vector/union_vector.json",
   760-    ],
   761-    includes = [
   762-        "",
   763-        "include/",
   764-    ],
   765-    deps = [
   766-        ":arrays_test_cc_fbs",
   767-        ":monster_extra_cc_fbs",
   768-        ":monster_test_cc_fbs",
   769-        ":native_type_test_cc_fbs",
   770-        "//:flatbuffers",
   771-    ],
   772-)
   773-
   774-# Test bzl rules
   775-
   776-cc_library(
   777-    name = "test_assert",
   778-    srcs = ["test_assert.cpp"],
   779-    hdrs = ["test_assert.h"],
   780-    visibility = ["//grpc/tests:__subpackages__"],
   781-    deps = ["//:flatbuffers"],
   782-)
   783-
   784-cc_library(
   785-    name = "test_builder",
   786-    srcs = ["test_builder.cpp"],
   787-    hdrs = ["test_builder.h"],
   788-    visibility = ["//grpc/tests:__subpackages__"],
   789-    deps = [
   790-        ":monster_test_grpc",
   791-        ":test_assert",
   792-        "//:flatbuffers",
   793-    ],
   794-)
   795-
   796-cc_library(
   797-    name = "monster_test_grpc",
   798-    srcs = [
   799-        "monster_test.grpc.fb.cc",
   800-        "monster_test.grpc.fb.h",
   801-        "monster_test_generated.h",
   802-    ],
   803-    hdrs = [
   804-        "monster_test.grpc.fb.h",
   805-        "monster_test_generated.h",
   806-    ],
   807-    includes = ["."],
   808-    visibility = ["//grpc/tests:__subpackages__"],
   809-    deps = [
   810-        "//:flatbuffers",
   811-        "@com_github_grpc_grpc//:grpc++",
   812-    ],
   813-)
   814-
   815-flatbuffer_cc_library(
   816-    name = "include_test_fbs",
   817-    srcs = [
   818-        "include_test/include_test1.fbs",
   819-        "include_test/sub/include_test2.fbs",
   820-    ],
   821-    include_paths = ["tests/include_test"],
   822-)
   823-
   824-flatbuffer_cc_library(
   825-    name = "monster_test_cc_fbs",
   826-    srcs = ["monster_test.fbs"],
   827-    include_paths = ["tests/include_test"],
   828-    visibility = ["//grpc/tests:__subpackages__"],
   829-    deps = [":include_test_fbs"],
   830-)
   831-
   832-# Test that running without --no-includes works properly (monster_test doesn't
   833-# work cleanly due to the circular dependency in the include_tests/ files).
   834-include_test_args = [
   835-    "--gen-object-api",
   836-    "--gen-compare",
   837-    "--gen-mutable",
   838-    "--reflect-names",
   839-    "--cpp-ptr-type flatbuffers::unique_ptr",
   840-    "--force-empty",
   841-]
   842-
   843-flatbuffer_cc_library(
   844-    name = "included_test_fbs",
   845-    srcs = ["included_test.fbs"],
   846-    flatc_args = include_test_args,
   847-)
   848-
   849-flatbuffer_cc_library(
   850-    name = "includer_test_fbs",
   851-    srcs = ["includer_test.fbs"],
   852-    flatc_args = include_test_args,
   853-    deps = [":included_test_fbs"],
   854-)
   855-
   856-cc_library(
   857-    name = "include_build_test",
   858-    srcs = ["include_build_test.cc"],
   859-    deps = [":includer_test_fbs"],
   860-)
   861-
   862-flatbuffer_cc_library(
   863-    name = "monster_extra_cc_fbs",
   864-    srcs = ["monster_extra.fbs"],
   865-)
   866-
   867-flatbuffer_cc_library(
   868-    name = "arrays_test_cc_fbs",
   869-    srcs = ["arrays_test.fbs"],
   870-    flatc_args = [
   871-        "--gen-object-api",
   872-        "--gen-compare",
   873-        "--no-includes",
   874-        "--gen-mutable",
   875-        "--reflect-names",
   876-        "--cpp-ptr-type flatbuffers::unique_ptr",
   877-        "--scoped-enums",
   878-    ],
   879-)
   880-
   881-flatbuffer_cc_library(
   882-    name = "native_type_test_cc_fbs",
   883-    srcs = ["native_type_test.fbs"],
   884-    flatc_args = [
   885-        "--gen-object-api",
   886-        "--gen-mutable",
   887-        "--cpp-ptr-type flatbuffers::unique_ptr",
   888-    ],
   889-)
   890-
   891-flatbuffer_ts_library(
   892-    name = "typescript_ts_fbs",
   893-    srcs = ["typescript_keywords.fbs"],
   894-    deps = [
   895-        "//tests/test_dir:include_ts_fbs",
   896-        "//tests/test_dir:typescript_transitive_ts_fbs",
   897-    ],
   898-)
   899-
   900-go_test(
   901-    name = "tests_test",
   902-    srcs = ["go_test.go"],
   903-    deps = ["//go"],
   904-)
   905diff -urN a/tests/MyGame/BUILD.bazel b/tests/MyGame/BUILD.bazel
   906--- a/tests/MyGame/BUILD.bazel	2023-05-17 17:37:21.557744447 +0000
   907+++ b/tests/MyGame/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   908@@ -1,15 +0,0 @@
   909-load("@io_bazel_rules_go//go:def.bzl", "go_library")
   910-
   911-go_library(
   912-    name = "MyGame",
   913-    srcs = ["InParentNamespace.go"],
   914-    importpath = "github.com/google/flatbuffers/tests/MyGame",
   915-    visibility = ["//visibility:public"],
   916-    deps = ["//go"],
   917-)
   918-
   919-alias(
   920-    name = "go_default_library",
   921-    actual = ":MyGame",
   922-    visibility = ["//visibility:public"],
   923-)
   924diff -urN a/tests/MyGame/Example/BUILD.bazel b/tests/MyGame/Example/BUILD.bazel
   925--- a/tests/MyGame/Example/BUILD.bazel	2023-05-17 17:37:21.557744447 +0000
   926+++ b/tests/MyGame/Example/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   927@@ -1,38 +0,0 @@
   928-load("@io_bazel_rules_go//go:def.bzl", "go_library")
   929-
   930-go_library(
   931-    name = "Example",
   932-    srcs = [
   933-        "Ability.go",
   934-        "Any.go",
   935-        "AnyAmbiguousAliases.go",
   936-        "AnyUniqueAliases.go",
   937-        "Color.go",
   938-        "LongEnum.go",
   939-        "Monster.go",
   940-        "MonsterStorage_grpc.go",
   941-        "Race.go",
   942-        "Referrable.go",
   943-        "Stat.go",
   944-        "StructOfStructs.go",
   945-        "StructOfStructsOfStructs.go",
   946-        "Test.go",
   947-        "TestSimpleTableWithEnum.go",
   948-        "TypeAliases.go",
   949-        "Vec3.go",
   950-    ],
   951-    importpath = "github.com/google/flatbuffers/tests/MyGame/Example",
   952-    visibility = ["//visibility:public"],
   953-    deps = [
   954-        "//go",
   955-        "@org_golang_google_grpc//:grpc",
   956-        "@org_golang_google_grpc//codes",
   957-        "@org_golang_google_grpc//status",
   958-    ],
   959-)
   960-
   961-alias(
   962-    name = "go_default_library",
   963-    actual = ":Example",
   964-    visibility = ["//visibility:public"],
   965-)
   966diff -urN a/tests/MyGame/Example2/BUILD.bazel b/tests/MyGame/Example2/BUILD.bazel
   967--- a/tests/MyGame/Example2/BUILD.bazel	2023-05-17 17:37:21.557744447 +0000
   968+++ b/tests/MyGame/Example2/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   969@@ -1,15 +0,0 @@
   970-load("@io_bazel_rules_go//go:def.bzl", "go_library")
   971-
   972-go_library(
   973-    name = "Example2",
   974-    srcs = ["Monster.go"],
   975-    importpath = "github.com/google/flatbuffers/tests/MyGame/Example2",
   976-    visibility = ["//visibility:public"],
   977-    deps = ["//go"],
   978-)
   979-
   980-alias(
   981-    name = "go_default_library",
   982-    actual = ":Example2",
   983-    visibility = ["//visibility:public"],
   984-)
   985diff -urN a/tests/namespace_test/NamespaceA/BUILD.bazel b/tests/namespace_test/NamespaceA/BUILD.bazel
   986--- a/tests/namespace_test/NamespaceA/BUILD.bazel	2023-05-17 17:37:21.565744312 +0000
   987+++ b/tests/namespace_test/NamespaceA/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
   988@@ -1,19 +0,0 @@
   989-load("@io_bazel_rules_go//go:def.bzl", "go_library")
   990-
   991-go_library(
   992-    name = "NamespaceA",
   993-    srcs = [
   994-        "SecondTableInA.go",
   995-        "TableInC.go",
   996-        "TableInFirstNS.go",
   997-    ],
   998-    importpath = "github.com/google/flatbuffers/tests/namespace_test/NamespaceA",
   999-    visibility = ["//visibility:public"],
  1000-    deps = ["//go"],
  1001-)
  1002-
  1003-alias(
  1004-    name = "go_default_library",
  1005-    actual = ":NamespaceA",
  1006-    visibility = ["//visibility:public"],
  1007-)
  1008diff -urN a/tests/namespace_test/NamespaceA/NamespaceB/BUILD.bazel b/tests/namespace_test/NamespaceA/NamespaceB/BUILD.bazel
  1009--- a/tests/namespace_test/NamespaceA/NamespaceB/BUILD.bazel	2023-05-17 17:37:21.565744312 +0000
  1010+++ b/tests/namespace_test/NamespaceA/NamespaceB/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
  1011@@ -1,20 +0,0 @@
  1012-load("@io_bazel_rules_go//go:def.bzl", "go_library")
  1013-
  1014-go_library(
  1015-    name = "NamespaceB",
  1016-    srcs = [
  1017-        "EnumInNestedNS.go",
  1018-        "StructInNestedNS.go",
  1019-        "TableInNestedNS.go",
  1020-        "UnionInNestedNS.go",
  1021-    ],
  1022-    importpath = "github.com/google/flatbuffers/tests/namespace_test/NamespaceA/NamespaceB",
  1023-    visibility = ["//visibility:public"],
  1024-    deps = ["//go"],
  1025-)
  1026-
  1027-alias(
  1028-    name = "go_default_library",
  1029-    actual = ":NamespaceB",
  1030-    visibility = ["//visibility:public"],
  1031-)
  1032diff -urN a/tests/namespace_test/NamespaceC/BUILD.bazel b/tests/namespace_test/NamespaceC/BUILD.bazel
  1033--- a/tests/namespace_test/NamespaceC/BUILD.bazel	2023-05-17 17:37:21.565744312 +0000
  1034+++ b/tests/namespace_test/NamespaceC/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
  1035@@ -1,15 +0,0 @@
  1036-load("@io_bazel_rules_go//go:def.bzl", "go_library")
  1037-
  1038-go_library(
  1039-    name = "NamespaceC",
  1040-    srcs = ["TableInC.go"],
  1041-    importpath = "github.com/google/flatbuffers/tests/namespace_test/NamespaceC",
  1042-    visibility = ["//visibility:public"],
  1043-    deps = ["//go"],
  1044-)
  1045-
  1046-alias(
  1047-    name = "go_default_library",
  1048-    actual = ":NamespaceC",
  1049-    visibility = ["//visibility:public"],
  1050-)
  1051diff -urN a/tests/optional_scalars/BUILD.bazel b/tests/optional_scalars/BUILD.bazel
  1052--- a/tests/optional_scalars/BUILD.bazel	2023-05-17 17:37:21.569744244 +0000
  1053+++ b/tests/optional_scalars/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
  1054@@ -1,18 +0,0 @@
  1055-load("@io_bazel_rules_go//go:def.bzl", "go_library")
  1056-
  1057-go_library(
  1058-    name = "optional_scalars",
  1059-    srcs = [
  1060-        "OptionalByte.go",
  1061-        "ScalarStuff.go",
  1062-    ],
  1063-    importpath = "github.com/google/flatbuffers/tests/optional_scalars",
  1064-    visibility = ["//visibility:public"],
  1065-    deps = ["//go"],
  1066-)
  1067-
  1068-alias(
  1069-    name = "go_default_library",
  1070-    actual = ":optional_scalars",
  1071-    visibility = ["//visibility:public"],
  1072-)
  1073diff -urN a/tests/test_dir/BUILD.bazel b/tests/test_dir/BUILD.bazel
  1074--- a/tests/test_dir/BUILD.bazel	2023-05-17 17:37:21.569744244 +0000
  1075+++ b/tests/test_dir/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
  1076@@ -1,14 +0,0 @@
  1077-load("//:typescript.bzl", "flatbuffer_ts_library")
  1078-
  1079-flatbuffer_ts_library(
  1080-    name = "typescript_transitive_ts_fbs",
  1081-    srcs = ["typescript_transitive_include.fbs"],
  1082-    visibility = ["//visibility:public"],
  1083-)
  1084-
  1085-flatbuffer_ts_library(
  1086-    name = "include_ts_fbs",
  1087-    srcs = ["typescript_include.fbs"],
  1088-    visibility = ["//visibility:public"],
  1089-    deps = [":typescript_transitive_ts_fbs"],
  1090-)
  1091diff -urN a/ts/BUILD.bazel b/ts/BUILD.bazel
  1092--- a/ts/BUILD.bazel	2023-05-17 17:37:21.573744176 +0000
  1093+++ b/ts/BUILD.bazel	1970-01-01 00:00:00.000000000 +0000
  1094@@ -1,39 +0,0 @@
  1095-load("@npm//@bazel/typescript:index.bzl", "ts_project")
  1096-load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
  1097-
  1098-ts_project(
  1099-    name = "flatbuffers_ts",
  1100-    srcs = [
  1101-        "builder.ts",
  1102-        "byte-buffer.ts",
  1103-        "constants.ts",
  1104-        "encoding.ts",
  1105-        "index.ts",
  1106-        "types.ts",
  1107-        "utils.ts",
  1108-    ],
  1109-    declaration = True,
  1110-    tsconfig = {
  1111-        "compilerOptions": {
  1112-            "module": "commonjs",
  1113-            "declaration": True,
  1114-            "moduleResolution": "node",
  1115-            "lib": [
  1116-                "ES2015",
  1117-                "ES2020.BigInt",
  1118-                "DOM",
  1119-            ],
  1120-            "types": ["node"],
  1121-            "strict": True,
  1122-        },
  1123-    },
  1124-    visibility = ["//visibility:public"],
  1125-    deps = ["@npm//@types/node"],
  1126-)
  1127-
  1128-js_library(
  1129-    name = "flatbuffers",
  1130-    package_name = "flatbuffers",
  1131-    visibility = ["//visibility:public"],
  1132-    deps = [":flatbuffers_ts"],
  1133-)
  1134diff -urN a/typescript.bzl b/typescript.bzl
  1135--- a/typescript.bzl	2023-05-17 17:37:21.521745059 +0000
  1136+++ b/typescript.bzl	1970-01-01 00:00:00.000000000 +0000
  1137@@ -1,134 +0,0 @@
  1138-"""
  1139-Rules for building typescript flatbuffers with Bazel.
  1140-"""
  1141-
  1142-load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
  1143-load("@npm//@bazel/typescript:index.bzl", "ts_project")
  1144-load(":build_defs.bzl", "DEFAULT_INCLUDE_PATHS", "flatbuffer_library_public")
  1145-
  1146-DEFAULT_FLATC_TS_ARGS = [
  1147-    "--gen-object-api",
  1148-    "--gen-mutable",
  1149-    "--reflect-names",
  1150-    "--gen-name-strings",
  1151-    "--ts-flat-files",
  1152-    "--keep-prefix",
  1153-]
  1154-
  1155-def flatbuffer_ts_library(
  1156-        name,
  1157-        srcs,
  1158-        compatible_with = None,
  1159-        target_compatible_with = None,
  1160-        deps = [],
  1161-        include_paths = DEFAULT_INCLUDE_PATHS,
  1162-        flatc_args = DEFAULT_FLATC_TS_ARGS,
  1163-        visibility = None,
  1164-        restricted_to = None,
  1165-        include_reflection = True,
  1166-        gen_reflections = False,
  1167-        package_name = None):
  1168-    """Generates a ts_library rule for a given flatbuffer definition.
  1169-
  1170-    Args:
  1171-      name: Name of the generated ts_library rule.
  1172-      srcs: Source .fbs file(s).
  1173-      deps: Other flatbuffer_ts_library's to depend on. Note that currently
  1174-            you must specify all your transitive dependencies manually.
  1175-      include_paths: Optional, list of paths the includes files can be found in.
  1176-      flatc_args: Optional list of additional arguments to pass to flatc
  1177-          (e.g. --gen-mutable).
  1178-      visibility: The visibility of the generated cc_library. By default, use the
  1179-          default visibility of the project.
  1180-      compatible_with: Optional, The list of environments this rule can be built
  1181-        for, in addition to default-supported environments.
  1182-      restricted_to: Optional, The list of environments this rule can be built
  1183-        for, instead of default-supported environments.
  1184-      target_compatible_with: Optional, The list of target platform constraints
  1185-        to use.
  1186-      include_reflection: Optional, Whether to depend on the flatbuffer
  1187-        reflection library automatically. Only really relevant for the
  1188-        target that builds the reflection library itself.
  1189-      gen_reflections: Optional, if true this will generate the flatbuffer
  1190-        reflection binaries for the schemas.
  1191-      package_name: Optional, Package name to use for the generated code.
  1192-    """
  1193-    srcs_lib = "%s_srcs" % (name)
  1194-    out_base = [s.replace(".fbs", "").split("/")[-1].split(":")[-1] for s in srcs]
  1195-
  1196-    # Because of how we have to manage the bazel rules for typescript,
  1197-    # reflection has to get special-cased to get imported when
  1198-    # run within bazel. As such, generate the code using the _pregenerate
  1199-    # suffix; then do a find/replace to fix-up all the reflection imports.
  1200-    pre_outs = ["%s_pregenerated.ts" % s for s in out_base]
  1201-    outs = ["%s_generated.ts" % s for s in out_base]
  1202-    includes = [d + "_includes" for d in deps]
  1203-    reflection_name = "%s_reflection" % name if gen_reflections else ""
  1204-    flatbuffer_library_public(
  1205-        name = srcs_lib,
  1206-        srcs = srcs,
  1207-        outs = pre_outs,
  1208-        language_flag = "--ts",
  1209-        includes = includes,
  1210-        include_paths = include_paths,
  1211-        flatc_args = flatc_args + ["--filename-suffix _pregenerated"],
  1212-        compatible_with = compatible_with,
  1213-        restricted_to = restricted_to,
  1214-        reflection_name = reflection_name,
  1215-        reflection_visibility = visibility,
  1216-        target_compatible_with = target_compatible_with,
  1217-    )
  1218-    fix_import_cmd = " ".join([
  1219-        "SRCS=($(SRCS));",
  1220-        "OUTS=($(OUTS));",
  1221-        "for i in $${!SRCS[@]}; do",
  1222-        "sed \"s/'.*reflection\\/reflection_pregenerated/'flatbuffers_reflection\\/reflection_generated/; s/_pregenerated/_generated/\" $${SRCS[i]} > $${OUTS[i]};",
  1223-        "done",
  1224-    ])
  1225-    native.genrule(
  1226-        name = name + "_reimporter",
  1227-        srcs = pre_outs,
  1228-        outs = outs,
  1229-        cmd = fix_import_cmd,
  1230-    )
  1231-    ts_project(
  1232-        name = name + "_ts",
  1233-        srcs = outs,
  1234-        declaration = True,
  1235-        visibility = visibility,
  1236-        compatible_with = compatible_with,
  1237-        restricted_to = restricted_to,
  1238-        target_compatible_with = target_compatible_with,
  1239-        tsconfig = {
  1240-            "compilerOptions": {
  1241-                "declaration": True,
  1242-                "lib": [
  1243-                    "ES2015",
  1244-                    "ES2020.BigInt",
  1245-                    "DOM",
  1246-                ],
  1247-                "module": "commonjs",
  1248-                "moduleResolution": "node",
  1249-                "noUnusedLocals": True,
  1250-                "strict": True,
  1251-                "types": ["node"],
  1252-            },
  1253-        },
  1254-        deps = deps + ["@com_github_google_flatbuffers//ts:flatbuffers"] + (["@com_github_google_flatbuffers//reflection/ts:reflection_ts_fbs"] if include_reflection else []),
  1255-    )
  1256-    js_library(
  1257-        name = name,
  1258-        visibility = visibility,
  1259-        compatible_with = compatible_with,
  1260-        restricted_to = restricted_to,
  1261-        target_compatible_with = target_compatible_with,
  1262-        deps = [name + "_ts"],
  1263-        package_name = package_name,
  1264-    )
  1265-    native.filegroup(
  1266-        name = "%s_includes" % (name),
  1267-        srcs = srcs + includes,
  1268-        compatible_with = compatible_with,
  1269-        restricted_to = restricted_to,
  1270-        visibility = visibility,
  1271-    )
  1272diff -urN a/WORKSPACE b/WORKSPACE
  1273--- a/WORKSPACE	2023-05-17 17:37:21.521745059 +0000
  1274+++ b/WORKSPACE	1970-01-01 00:00:00.000000000 +0000
  1275@@ -1,98 +0,0 @@
  1276-workspace(name = "com_github_google_flatbuffers")
  1277-
  1278-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
  1279-
  1280-http_archive(
  1281-    name = "platforms",
  1282-    sha256 = "379113459b0feaf6bfbb584a91874c065078aa673222846ac765f86661c27407",
  1283-    urls = [
  1284-        "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
  1285-        "https://github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
  1286-    ],
  1287-)
  1288-
  1289-http_archive(
  1290-    name = "build_bazel_rules_swift",
  1291-    sha256 = "a2fd565e527f83fb3f9eb07eb9737240e668c9242d3bc318712efa54a7deda97",
  1292-    url = "https://github.com/bazelbuild/rules_swift/releases/download/0.27.0/rules_swift.0.27.0.tar.gz",
  1293-)
  1294-
  1295-load(
  1296-    "@build_bazel_rules_swift//swift:repositories.bzl",
  1297-    "swift_rules_dependencies",
  1298-)
  1299-
  1300-swift_rules_dependencies()
  1301-
  1302-load(
  1303-    "@build_bazel_rules_swift//swift:extras.bzl",
  1304-    "swift_rules_extra_dependencies",
  1305-)
  1306-
  1307-swift_rules_extra_dependencies()
  1308-
  1309-http_archive(
  1310-    name = "io_bazel_rules_go",
  1311-    sha256 = "16e9fca53ed6bd4ff4ad76facc9b7b651a89db1689a2877d6fd7b82aa824e366",
  1312-    urls = [
  1313-        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip",
  1314-        "https://github.com/bazelbuild/rules_go/releases/download/v0.34.0/rules_go-v0.34.0.zip",
  1315-    ],
  1316-)
  1317-
  1318-load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies")
  1319-
  1320-go_rules_dependencies()
  1321-
  1322-##### Protobuf
  1323-_PROTOBUF_VERSION = "3.15.2"
  1324-
  1325-http_archive(
  1326-    name = "com_google_protobuf",
  1327-    strip_prefix = "protobuf-" + _PROTOBUF_VERSION,
  1328-    urls = [
  1329-        "https://github.com/protocolbuffers/protobuf/archive/v" + _PROTOBUF_VERSION + ".tar.gz",
  1330-    ],
  1331-)
  1332-
  1333-##### GRPC
  1334-_GRPC_VERSION = "1.48.0"  # https://github.com/grpc/grpc/releases/tag/v1.48.0
  1335-
  1336-http_archive(
  1337-    name = "com_github_grpc_grpc",
  1338-    strip_prefix = "grpc-" + _GRPC_VERSION,
  1339-    urls = ["https://github.com/grpc/grpc/archive/refs/tags/v" + _GRPC_VERSION + ".tar.gz"],
  1340-)
  1341-
  1342-load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
  1343-
  1344-grpc_deps()
  1345-
  1346-load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
  1347-
  1348-grpc_extra_deps()
  1349-
  1350-# rules_go from https://github.com/bazelbuild/rules_go/releases/tag/v0.34.0
  1351-http_archive(
  1352-    name = "build_bazel_rules_nodejs",
  1353-    sha256 = "965ee2492a2b087cf9e0f2ca472aeaf1be2eb650e0cfbddf514b9a7d3ea4b02a",
  1354-    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.2.0/rules_nodejs-5.2.0.tar.gz"],
  1355-)
  1356-
  1357-load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies")
  1358-
  1359-build_bazel_rules_nodejs_dependencies()
  1360-
  1361-load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install")
  1362-
  1363-node_repositories()
  1364-
  1365-yarn_install(
  1366-    name = "npm",
  1367-    exports_directories_only = False,
  1368-    # Unfreeze to add/remove packages.
  1369-    frozen_lockfile = True,
  1370-    package_json = "//:package.json",
  1371-    symlink_node_modules = False,
  1372-    yarn_lock = "//:yarn.lock",
  1373-)

View as plain text