-
-
Notifications
You must be signed in to change notification settings - Fork 667
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
Getting a runfiles directory with runfiles.Rlocation instead of bazel.Runfile #3830
Comments
Instead of Bazel's runfiles layout doesn't guarantee that the files under the logical runfiles directory The proper way to make your use case work would be to add an implementation of In the meantime, you can use a helper function that accepts both a runfiles path to a directory and the relative path of a file inside it and returns the actual path of the directory. This is what I'm currently using myself. |
I'm happy to contribute something here, though I don't understand what it means to add an impl of
That's odd, but I guess it doesn't matter as long as there are at least links in the right location. My use case here seems like a pretty standard happy path. I have a |
Yep, that's exactly the problem: A fully featured
No, there isn't, but it's not a simple omission. Since Bazel supports both directory-based and manifest-based runfiles and the latter are not realized on disk, there may not be a single filesystem path that contains all those files. The |
What version of rules_go are you using?
v0.45.0
What version of gazelle are you using?
v0.35.0
What version of Bazel are you using?
6.1.2
Does this issue reproduce with the latest releases of all the above?
rules_go and gazelle are at the latest, Bazel isn't but I don't think it should affect this
What operating system and processor architecture are you using?
Linux, x86-64
What did you do?
I noticed that
bazel.Runfile
was deprecated and recommended therunfiles
package as a replacement.The problem I have is that
runfiles.Rlocation
, which I believe is the replacement, doesn't work for directories as far as I can tell.What did you expect to see?
I expected
bazel.Runfile("some/directory")
andrunfiles.Rlocation("some/directory")
to return the same result.What did you see instead?
Instead, I get the error
runfile some/directory: file does not exist
.I'm able to work around this with:
I'm not sure if I'm just using the wrong helper/missing something, but this workaround isn't great, as
a_file_I_know_exists
is a pretty hacky and specific construct, and I also am not sure where__main__
comes from (was a shot in the dark based on printing arunfiles.Runfiles
)The text was updated successfully, but these errors were encountered: