Skip to content

Commit 199fbdd

Browse files
authored
refactor: don't add js proto aspect on js_binary/test data (#2768)
Belated code review comment
1 parent 8c7dfcd commit 199fbdd

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

examples/proto/BUILD.bazel

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@aspect_rules_js//js:defs.bzl", "js_test")
1+
load("@aspect_rules_js//js:defs.bzl", "js_library", "js_test")
22
load("@npm//:defs.bzl", "npm_link_all_packages")
33
load("@protobuf//bazel:proto_library.bzl", "proto_library")
44

@@ -13,8 +13,14 @@ proto_library(
1313
deps = ["@protobuf//:timestamp_proto"],
1414
)
1515

16+
js_library(
17+
name = "foo_js_lib",
18+
# This edge runs an aspect to produce a JsInfo provider with protobuf .js/.d.ts files.
19+
deps = [":foo_proto"],
20+
)
21+
1622
js_test(
1723
name = "test",
18-
data = [":foo_proto"],
24+
data = [":foo_js_lib"],
1925
entry_point = "test_proto.js",
2026
)

js/private/js_binary.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ load("@bazel_lib//lib:expand_make_vars.bzl", "expand_locations", "expand_variabl
2121
load("@bazel_lib//lib:windows_utils.bzl", "create_windows_native_launcher_script")
2222
load(":bash.bzl", "BASH_INITIALIZE_RUNFILES")
2323
load(":js_helpers.bzl", "LOG_LEVELS", "envs_for_log_level", "gather_files_from_js_infos", "gather_runfiles")
24-
load(":proto.bzl", "js_proto_aspect")
2524

2625
_DOC = """Execute a program in the Node.js runtime.
2726
@@ -100,7 +99,6 @@ _ATTRS = {
10099
NB: `data` files are copied to the Bazel output tree before being passed
101100
as inputs to runfiles. See `copy_data_to_bin` docstring for more info.
102101
""",
103-
aspects = [js_proto_aspect],
104102
),
105103
"entry_point": attr.label(
106104
allow_files = True,

0 commit comments

Comments
 (0)