-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Provide Starlark analogue to "rlocationpath" Make variable for rule authors to use #17259
Comments
@c-parsons I remember this being blocked on the restriction that Starlark struct field implementation functions can't access the |
I think lifting this restriction would introduce a bit more magic to Starlark, so I'm not happy about it. This could be done instead by a helper function. What and where to introduce should be discussed on this ticked or even better in a design doc. |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale. |
This issue still describes an unmet need. |
This will be very simple to do once WORKSPACE is gone, because then it can just be field rather than a method on |
Description of the feature request:
Per discussion in the "rules" channel of the "Bazel" Slack workspace, at present we have the
rlocationpath
"Make" variable available for use in target definitions, but we have no analogous Starlark function available to rule authors. It would be helpful to provide either a Starlark function that accepts aFile
or add a method toFile
that returns the equivalent string value as therlocationpath
"Make" variable, such that one could feed that value into a runfiles library'sRlocation
function to find a particular runfile.What underlying problem are you trying to solve with this feature?
While writing a rule that externalizes command-line flags or arguments supplied to an action created by
ctx.actions.run
orctx.actions.run_shell
, I'd like to supply values that nominate runfiles, such that the program that runs within that action can use a runfiles library to project those command-line flag values to the proper paths, allowing it to read the nominated files.Which operating system are you running Bazel on?
macOS 13.1
What is the output of
bazel info release
?release 6.0.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
I have searched the Web extensively looking for advice on how to use the nascent runfiles libraries. @fmeum's "Runfiles and where to find them" video on YouTube helps understand how to consume these paths. Not addressed commonly, though, is how one creates these paths.
Any other information, logs, or outputs that you want to share?
@fmeum mentioned his
runfile_path
Starlark function in the bazelbuild/rules_fuzzing repository as a potential implementation that emulatesrlocationpath
well enough.The text was updated successfully, but these errors were encountered: