-
Notifications
You must be signed in to change notification settings - Fork 522
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
Add support for $(location) in nodejs_binary#entry_point #42
Conversation
edf8117
to
e1b50ef
Compare
@vladmos I would appreciate an opinion from the Bazel team: I'm using |
6f10738
to
cdb2a1b
Compare
@rzhw any comments? I'm still a bit unsure if users should be exposed to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, assuming we're happy with how $(location)
is currently overloaded (because of the path munging).
I hadn't thought of that being a concern previously, so echoing interest in comment from the Bazel team.
examples/program/BUILD.bazel
Outdated
py_test( | ||
name = "bin_test", | ||
srcs = ["bin_test.py"], | ||
deps = ["@build_bazel_rules_nodejs//internal:runfiles"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Does using just //internal:runfiles
work, since this is just an example that lives in this workspace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, didn't realise this example was a separate workspace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah having two workspaces in this repo is useful for learning about things like this, and also catches some bugs where the wrong context is used to create a path.
bazelbuild/bazel#2475 looks relevant, particularly this proposal. |
Awesome job tracking down that feature request. It looks like Ulf is close to introducing the |
Looks like Tests here, doesn't appear to test for e.g. |
What's currently blocking this from landing? I've tried rebasing once but looks like I'm hitting some conflicts again 😢 |
Nothing blocking this other than prioritization. I haven't had time, would appreciate some help! (Also I'm switching to Windows to force myself to make all the Bazel + Angular builds work on Windows so it's going to be slow going for a while....) |
Gotcha, what's needed after resolving the merge conflicts if any? Verifying it works on Windows, design input from someone else from Bazel? |
Sorry @rzhw just never prioritized this one. Dusting it off now... |
BREAKING CHANGE: This forces us to use workspace-relative paths since the rootpath helper returns this format. Users are now exposed to the external path segment to reference other workspaces. See discussion: bazel-contrib#84 Fixes bazel-contrib#32
@alexeagle Any reason this can't be merged? I could help out if it's a time thing. It is confusing for others in my team who don't know the details of the rules_nodejs implementation to understand what this field should be. Using a build target instead hides the implementation details better. |
@nimerrit This has been collecting some dust. I've been looking at related code recently with #240. I'll discuss this PR with @alexeagle when he's back from vacation next week and to see what else needs to be done so that it can get in. It would be a good one to land for users like yourself. |
return path | ||
return expand_path_into_runfiles(ctx, path) | ||
|
||
def expand_path_into_runfiles(ctx, path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expand_path_into_runfiles is used in rules_typescript so likely need to keep it around as deprecated
// or just path/to/thing with the implied local workspace | ||
// This matches Bazel semantics for cwd of toolchain processes | ||
// and helpers like ctx.expand_location("$(rootpath foo)") | ||
resolveRunfiles('TEMPLATED_user_workspace_name', request), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems make sense. It should also continue to work with #240.
@alexeagle @gregmagolan Any updates on this? I'm trying to calculate the entry_point in a macro and can't figure out how to do it currently. The discussion in #32 would have me believe that I can use |
Given a discussion here: bazelbuild/bazel#6001 (and updated docs: bazelbuild/bazel@22a4994) it seems that entry_point should not be a string and not use the |
Will go with a label, thanks @Globegitter |
Fixes bazel-contrib#41 Closes bazel-contrib#42 PiperOrigin-RevId: 169476478
Fixes bazel-contrib#41 Closes bazel-contrib#42 PiperOrigin-RevId: 169476478
No description provided.