From 79c97e59db63569300d4891424e0fcf36fd0302d Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Thu, 26 Mar 2020 20:43:37 -0700 Subject: [PATCH] Revert "fix(builtin): fix for nodejs_binary entry point in bazel-out logic (#1739)" This reverts commit a6e29c2add19dd487035b0951f5271053a0a11e2. --- internal/node/launcher.sh | 5 +---- internal/node/node.bzl | 3 +-- internal/node/test/BUILD.bazel | 26 -------------------------- internal/node/test/main.ts | 1 - internal/node/test/tsconfig.json | 3 --- 5 files changed, 2 insertions(+), 36 deletions(-) delete mode 100644 internal/node/test/main.ts delete mode 100644 internal/node/test/tsconfig.json diff --git a/internal/node/launcher.sh b/internal/node/launcher.sh index 3d7bb93435..2a1992c446 100644 --- a/internal/node/launcher.sh +++ b/internal/node/launcher.sh @@ -191,10 +191,7 @@ for ARG in "${ALL_ARGS[@]:-}"; do case "$ARG" in --bazel_node_modules_manifest=*) MODULES_MANIFEST="${ARG#--bazel_node_modules_manifest=}" ;; --nobazel_patch_module_resolver) - declare MAIN=$(rlocation "TEMPLATED_entry_point_manifest_path") - if [[ ! -f "$MAIN" ]]; then - MAIN="TEMPLATED_entry_point_execroot_path" - fi + MAIN="TEMPLATED_script_path" LAUNCHER_NODE_OPTIONS=( "--require" "$node_patches_script" ) # In this case we should always run the linker diff --git a/internal/node/node.bzl b/internal/node/node.bzl index 8a716cdc6b..999db6f872 100644 --- a/internal/node/node.bzl +++ b/internal/node/node.bzl @@ -216,8 +216,6 @@ def _nodejs_binary_impl(ctx): expand_location_into_runfiles(ctx, a, ctx.attr.data) for a in ctx.attr.templated_args ]), - "TEMPLATED_entry_point_execroot_path": _to_execroot_path(ctx, ctx.file.entry_point), - "TEMPLATED_entry_point_manifest_path": _to_manifest_path(ctx, ctx.file.entry_point), "TEMPLATED_env_vars": env_vars, "TEMPLATED_expected_exit_code": str(expected_exit_code), "TEMPLATED_link_modules_script": _to_manifest_path(ctx, ctx.file._link_modules_script), @@ -227,6 +225,7 @@ def _nodejs_binary_impl(ctx): "TEMPLATED_repository_args": _to_manifest_path(ctx, ctx.file._repository_args), "TEMPLATED_require_patch_script": _to_manifest_path(ctx, ctx.outputs.require_patch_script), "TEMPLATED_runfiles_helper_script": _to_manifest_path(ctx, ctx.file._runfiles_helper_script), + "TEMPLATED_script_path": _to_execroot_path(ctx, ctx.file.entry_point), "TEMPLATED_vendored_node": "" if is_builtin else strip_external(ctx.file._node.path), } ctx.actions.expand_template( diff --git a/internal/node/test/BUILD.bazel b/internal/node/test/BUILD.bazel index df5f4efe8e..897a3cbeef 100644 --- a/internal/node/test/BUILD.bazel +++ b/internal/node/test/BUILD.bazel @@ -1,6 +1,5 @@ load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "nodejs_test", "npm_package_bin") load("@build_bazel_rules_nodejs//internal/golden_file_test:golden_file_test.bzl", "golden_file_test") -load("@npm//typescript:index.bzl", "tsc") load("//internal/js_library:js_library.bzl", "js_library") load("//internal/node:node_repositories.bzl", "BUILT_IN_NODE_PLATFORMS") load("//third_party/github.com/bazelbuild/bazel-skylib:rules/copy_file.bzl", "copy_file") @@ -343,28 +342,3 @@ nodejs_test( entry_point = "empty_args_fail.js", expected_exit_code = 0, ) - -tsc( - name = "main_lib", - outs = [ - "main.js", - ], - args = [ - "-p", - "$(execpath tsconfig.json)", - "--outDir", - # $(RULEDIR) is a shorthand for the dist/bin directory where Bazel requires we write outputs - "$(RULEDIR)", - ], - data = [ - "main.ts", - "tsconfig.json", - ], -) - -nodejs_test( - name = "main_test", - data = [":main_lib"], - entry_point = ":main.js", - templated_args = ["--nobazel_patch_module_resolver"], -) diff --git a/internal/node/test/main.ts b/internal/node/test/main.ts deleted file mode 100644 index ee5e348f16..0000000000 --- a/internal/node/test/main.ts +++ /dev/null @@ -1 +0,0 @@ -console.log('hello world' as string); \ No newline at end of file diff --git a/internal/node/test/tsconfig.json b/internal/node/test/tsconfig.json deleted file mode 100644 index 346e6cea95..0000000000 --- a/internal/node/test/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "include": ["main.ts"] -}