-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Allow native.package_relative_label
in initializers
#21740
Conversation
FYI @Wyverald |
0670b11
to
fcb0f24
Compare
I’d feel more comfortable accepting just package_relative_label, because it seems this function doesn’t lead into parsing and concatenating the labels and is covered by a clear usecase. Other functions seem more risky. |
I have made the change to only allow this function, but I don't quite follow your reasoning: With |
@comius Friendly ping |
The problem is that once you have Also I see |
src/test/java/com/google/devtools/build/lib/starlark/StarlarkRuleClassFunctionsTest.java
Outdated
Show resolved
Hide resolved
@@ -68,6 +68,8 @@ public class BazelStarlarkContext implements StarlarkThread.UncheckedExceptionCo | |||
public enum Phase { | |||
WORKSPACE, | |||
LOADING, | |||
/** Evaluation for a rule initializer, which does not allow all loading phase operations. */ | |||
INITIALIZER, |
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.
Introducing a new phase was avoided before and introducing it now for a single function looks like an overkill.
This also potentially interacts with other locations that use phases. And potentially also with symbolic macros.
a47d462
to
c08bd90
Compare
I see your point, just want to remark that this is not possible: |
native
functions in initializersnative.package_relative_label
in initializers
@comius I special cased the setup for |
@comius Friendly ping |
@bazel-io fork 7.2.0 |
@comius @iancha1992 Friendly ping, is this still on track for merging? |
@fmeum Yes. We are currently working on this :) |
@fmeum can you please resolve the conflicts from |
RELNOTES: The following functions on `native` can now be used in rule initializers: `repo_name`, `package_name`, `package_relative_label`, `module_name`, `module_version`.
@iancha1992 Done |
Work towards bazelbuild#21622 RELNOTES: `native.package_relative_label` can now be used in rule initializers. Closes bazelbuild#21740. PiperOrigin-RevId: 631546734 Change-Id: Id6eb237f0f79195b678bb954deaef071e1c45ab1
Work towards bazelbuild#21622 RELNOTES: `native.package_relative_label` can now be used in rule initializers. Closes bazelbuild#21740. PiperOrigin-RevId: 631546734 Change-Id: Id6eb237f0f79195b678bb954deaef071e1c45ab1
Work towards #21622
RELNOTES:
native.package_relative_label
can now be used in rule initializers.