Skip to content

Commit

Permalink
fix(builtin): nodejs_binary collects module_mappings for linker
Browse files Browse the repository at this point in the history
Module name cannot be equal to the workspace name with the linker so this change removes the regression test for 834. This was a corner case and was already broken with the 1.0 for npm_package_bin so this fix makes nodejs_binary consistent with npm_package_bin and the new desired behavior for 1.0.
  • Loading branch information
gregmagolan committed Jan 14, 2020
1 parent 9f6babd commit 4419f95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/node/node.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ load("//internal/common:expand_into_runfiles.bzl", "expand_location_into_runfile
load("//internal/common:module_mappings.bzl", "module_mappings_runtime_aspect")
load("//internal/common:path_utils.bzl", "strip_external")
load("//internal/common:windows_utils.bzl", "create_windows_native_launcher_script", "is_windows")
load("//internal/linker:link_node_modules.bzl", "write_node_modules_manifest")
load("//internal/linker:link_node_modules.bzl", "module_mappings_aspect", "write_node_modules_manifest")
load("//internal/node:node_repositories.bzl", "BUILT_IN_NODE_PLATFORMS")

def _trim_package_node_modules(package_name):
Expand Down Expand Up @@ -282,7 +282,7 @@ _NODEJS_EXECUTABLE_ATTRS = {
"data": attr.label_list(
doc = """Runtime dependencies which may be loaded during execution.""",
allow_files = True,
aspects = [node_modules_aspect, module_mappings_runtime_aspect],
aspects = [node_modules_aspect, module_mappings_aspect, module_mappings_runtime_aspect],
),
"default_env_vars": attr.string_list(
doc = """Default environment variables that are added to `configuration_env_vars`.
Expand Down
4 changes: 1 addition & 3 deletions internal/node/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ nodejs_binary(
entry_point = ":entry_file",
)

# Coverage for issue https://github.com/bazelbuild/rules_nodejs/issues/834
# where module_name is equal to the workspace naem
js_library(
name = "module_name_lib",
srcs = ["module-name.js"],
module_name = "build_bazel_rules_nodejs",
module_name = "build_bazel_rules_nodejs/internal/node/test",
)

nodejs_binary(
Expand Down

0 comments on commit 4419f95

Please sign in to comment.