You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(builtin): entry point from sources used when used as tool (#3605)
Consider a `nodejs_binary` with a definition like the followed:
```bzl
js_library(
name = "lib",
srcs = ["entrypoint.js", "constants.js"],
)
nodejs_binary(
name = "bin",
entry_point = "entrypoint.js",
data = [":lib"],
)
```
This seems very standanrd and also works perfectly when the
binary is invoked with `bazel run`. Via Bazel run, the Node
Bash launcher resolves the entrypoint via the actual runfiles
using `rlocation`.
If this binary is used as a tool, e.g. in `npm_package_bin`- then
the entry point is resolved from the execroot, landing ultimately
on the *actual source file*. This is wrong and breaks resolution
in RBE (where only necessary sources are in the execroot).
This happens because the source entrypoint file. i.e. not the
`entrypoint.js` from `bazel-bin` is also ending up being included
in the runfiles of `run_node` via `NodeRuntimeDepsInfo`.
This mismatch breaks resolution, and also results in an incorrect/
unnecessary file being added to the action inputs. The entry point
used in `NodeRuntimeDepsInfo` should be the one derived from the
`data` sources of the rule, ensuring the entry-point can access
its other files of the `js_library`.
i.e. entry-point should come from the `data` preferred, and if it's
not found- then the source, or `File` can be directly used.
This fixes RBE for angular.io which started unveiling some issues
when we attmepted to enable RBE via: angular/angular#48316
0 commit comments