-
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
inconsistent handling of DefaultInfo runfiles in multiple rules (sh_*, java_binary,...) #12348
Comments
Also noticed comment reporting same thing in 2018 #1147 (comment) |
So fixing sh_binary/sh_test to promote data to runfiles should be fine per https://docs.bazel.build/versions/master/be/common-definitions.html#common.data
cc_binary and py_binary don't include "data" attribute into runfiles too, didn't check cc_library/py_library yet |
cc_library & py_library unlike sh_library do not add "data" to runfiles (when it is DefaultInfo without runfiles) There may be a use-case for data-dependency that has runfiles != files though. https://docs.bazel.build/versions/master/skylark/lib/DefaultInfo.html#parameters
Few notable things that would be nice to have here
Here it doesn't look like that it applies to a case where a rule generates a "data" file output, "data" file isn't a tool or runnable Unclear part with "data" is
What is a "target" here? For a target with single file output and no other providers, looks quite logical that this file should be in runfiles. Probably all target outputs as well as runfiles should be used, and for deps/tools case it may be different. And another thing is that filegroup promotes srcs (aka outputs) as data runfiles So, should any rules taking data parameter put all files from data to runfiles? |
java_binary also doesn't add data= to runfiles |
Can we rename this issue to reflect the fact it applies to a lot of different rules? Also #15052 looks like it resolves this, can anyone who had the original issue confirm? |
Yes, this is fixed by the PR you linked. |
Looks like it gets resolved for me too, #15052 is included in 6.0.0 release |
@dmivankov I will close this as it is fixed by 6f6d4cc, which is in Bazel 6. Please let me know if this is still an issue in some cases. |
Description of the problem / feature request:
Setting data attribute of sh_binary adds file to runfiles if it is a filegroup but not if it is a simple DefaultInfo output (files=[..], but no runfiles=).
For sh_library file is added to runfiles in both cases and then it can be propagated to sh_binary using that sh_library.
I'd expect sh_binary to collect runfiles from it's own and its sh_library targets consistently, either collect all with simple DefaultInfo, or collect none with simple DefaultInfo
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
script.sh
find -name "data.txt*"
data.txt
rule.bzl
BUILD
Testing
The text was updated successfully, but these errors were encountered: