-
Notifications
You must be signed in to change notification settings - Fork 81
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 a library for looking up runfiles. #302
Conversation
Relevant Bazel issue: bazelbuild/bazel#4460. I followed the approach documented here: https://docs.google.com/document/d/e/2PACX-1vSDIrFnFvEYhKsCMdGdD40wZRBX3m3aZ5HhVj4CtHPmiXKDCxioTUbYsDydjKtFDAzER5eg7OjJWs3V/pub Other than not bothing yet with `RUNFILES_MANIFEST`, which is only needed on WINDOWS.
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.
Nice! I think this indeed belongs in rules_haskell. I was about to write this myself.
We like using the handle pattern. Would you find it acceptable to use it here? This would mean:
Bazel.Runfiles
module always imported qualified.Runfiles
renamed toHandle
.runfilesEnv
->env
(though I'm not sure whether this one should be exported).getRunfiles
->create
, which would bring the library closer in line with the Runfiles design document you link to, which says languages should define acreate()
method.
tools/runfiles/Bazel/Runfiles.hs
Outdated
-- | ||
-- Note that Bazel will set these automatically when it runs tests | ||
-- (@bazel test@). | ||
runfilesEnv :: Runfiles -> [(String, String)] |
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.
What's the use case for this function? Should users set RUNFILES_DIR
when it's not set? It was my understanding that RUNFILES_DIR
is set iff the target is a data dependency of another. I don't know about tests.
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.
Added clarification in the comment; it's for non-test binaries to set manually, since from my testing it's only set automatically in "bazel test".
I switched the module to qualified names and renamed I avoided renaming 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.
Agreed. But in that case, create
for Runfiles
could even be moved out of IO
entirely, in which case we could have a plain rlocation
with no Runfiles
argument. Reasoning being: runfiles are both global and immutable.
In any case, I'm also fine with the current state of affairs.
Relevant Bazel issue: bazelbuild/bazel#4460.
I followed the approach documented here:
https://docs.google.com/document/d/e/2PACX-1vSDIrFnFvEYhKsCMdGdD40wZRBX3m3aZ5HhVj4CtHPmiXKDCxioTUbYsDydjKtFDAzER5eg7OjJWs3V/pub
Other than not bothing yet with
RUNFILES_MANIFEST
, which is only needed onWINDOWS.
The functionality seemed general and simple enough to be worth upstreaming into rules_haskell itself; let me know what you think and/or if there's a better place to put this.