-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Implement proper, language-agnostic handling of runfiles trees #2339
Comments
We had to roll back the change. Why isn't that commit linked here? |
So, after some consultation with @ulfjack , I realized that we can't solve this in a principled way without figuring out how runfiles trees should work in general. Therefore, I'm changing this bug to "we should really figure out how runfiles trees should work" in general. |
@lberki is this a P2? |
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 2+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
The recommended way to access runfiles is now to use the runfiles libraries (among others |
Will it suffice to use paths relative to a repo's root directory? When would these runfiles libraries be necessary? |
@cnsgsz If you only ever reference files in your main repository, exclusively target a Unix variant and don't run your targets as part of build actions, then you don't need runfiles libraries. In all other cases you are likely better off with them. |
I have a python test named foo whose main is foo.py that depends on cpp binary. I have it set up as recommended in #703. It works when it is run in bazel test.
However, I sometimes want to run the python test manually by invoking foo (the executable python script that's generated by bazel that sits in the same bazel-bin directory as foo.runfiles). However it complains that the cpp binary cannot be found.
I tried something like #231, but sys.argv[0] points to foo.py and it does not seem straightforward to get the cpp binary path from there?
It is not just for python test. Sometime I have a python binary that depends on cpp binary too. But I assume they are similar.
Since bazel generates foo and put the specified data in foo.runfiles already, it seems natural that I should be able to just specify some relative path as in #703, call foo from any cwd, and foo does the work to make sure the cpp binary can be found based on the relative path? Or is it possible for foo to pass foo.py some environment variable RUNFILES_DIR that foo.py can use like os.path.join(RUNFILES_DIR, "relative/path/to/cpp/binary")?
The text was updated successfully, but these errors were encountered: