Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove runfiles. #798

Merged
merged 2 commits into from
Jun 4, 2019
Merged

Conversation

Globegitter
Copy link
Contributor

@Globegitter Globegitter commented May 28, 2019

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

What is the current behavior?

Every nodejs_binary gets the _node_runfiles filegroup added, which adds the real node binary as well as npm, yarn and some other libraries. Further the implicit node binary dependency is a wrapper script which adds the bazel managed node to the PATH.

What is the new behavior?

For nodejs_binary the wrapper script target was exchanged with the real node binary and the functionality of the wrapper script, setting the PATH was added to the node_loader.js. The runfiles are entirely removed as an implicit dependency as binaries can run fine without these now.

These means we only depend on one single file to execute our nodejs_binary, that should make things a little faster as less things will need to be symlinked but also reduce size of docker containers for most and it will simplify things for the toolchain PR as now it only has to worry about providing one single file target.

Does this PR introduce a breaking change?

  • Yes
  • No

People that depended on the fact that yarn or node was included as an implicit dependency would now have to add @nodejs//:node_runfiles explicitely to their data dependencies.

@Globegitter Globegitter marked this pull request as ready for review May 28, 2019 13:49
Copy link
Collaborator

@gregmagolan gregmagolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Really nice simplification. Thanks Markus.

My two concerns were:

  1. @nodejs//:yarn, @nodejs//:npm, @nodejs//:bin/yarn, @nodejs//:bin/npm still need to use the /bin/node & /bin/node.cmd entry points which still sets the PATH since those code paths don't use the launcher

  2. RBE still works for nodejs_binary which looks like it will since the node binary is still in runfiles

From the looks of it both are good

Is it safe to remove

filegroup(
  name = "node_runfiles",
  srcs = [
    ${nodejsSrcFiles.map(f => `"${NODE_DIR}/${f}",`).join('\n    ')}
    ${yarnSrcFiles.map(f => `"${YARN_DIR}/${f}",`).join('\n    ')}
  ],
)

with this or is there still someone downstream who would use it besides nodejs_binary?

@Globegitter
Copy link
Contributor Author

@gregmagolan
About 1, yeah I left the original script there on purpose as the same target for that. For 2 yes RBE still works and it is actually being tested in buildkite CI. I did have a failure about that to start off with.

Yeah I was not sure why anyone would depend on the runfiles downstream - but that is why I left them, because I don't know. But I would be very happy to remove them and we can always bring it back if someone needs them for some reason.

@Globegitter
Copy link
Contributor Author

Done - I kept it in 2 commits. One to address the comment. The other to remove the runfiles.

@Globegitter
Copy link
Contributor Author

@alexeagle squashed.

@alexeagle
Copy link
Collaborator

I rebased around the merge conflict and force-pushed to your branch, FYI. will merge now if green

@Globegitter
Copy link
Contributor Author

@alexeagle anything blocking this now from getting merged?

@alexeagle alexeagle merged commit 8f8558c into bazel-contrib:master Jun 4, 2019
aherrmann added a commit to aherrmann/rules_elm that referenced this pull request Apr 10, 2020
These were removed in [#798][798] which is part of `rules_nodejs` from
version 0.31.0 onward.

798: bazel-contrib/rules_nodejs#798
aherrmann added a commit to aherrmann/rules_elm that referenced this pull request Apr 10, 2020
These were removed in [#798][#798] which is part of `rules_nodejs` from
version 0.31.0 onward.

[#798]: bazel-contrib/rules_nodejs#798
EdSchouten pushed a commit to kczulko/rules_elm that referenced this pull request Apr 10, 2020
These were removed in [#798][#798] which is part of `rules_nodejs` from
version 0.31.0 onward.

[#798]: bazel-contrib/rules_nodejs#798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants