-
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
py_binary target inside another Starlark rule's runfiles doesn't get built fully #378
Comments
AFAICT, your rule doesn't add the runfiles for 'under' (eg. 'env') to the runfiles of _run_under_impl. |
http://bazel.io/docs/skylark/rules.html -> "Rules" |
What's the right way to access the 'under''s runfiles? I tried
But got the error: /usr/local/home/mzhao/g/trunk/tools/build_rules/run_under.bzl:42:26: target (rule class of 'py_binary') doesn't have provider 'transitive_runtime_files'. |
I made a change my run_under and it works with an older version of bazel: But it didn't work with the latest bazel which has sandbox enabled: examples/run_under/hello_test: line 3: /usr/local/home/_bazel_mzhao/7f4ef1d4b60d94ba335123843e5cccc0/trunk/bazel-out/local_linux-fastbuild/bin/examples/run_under/env: No such file or director It looks like I might miss putting some file into certain dependency so the sandbox doesn't mount it properly. @philwo could you suggest a solution? Thanks! |
I will have a detailed look tomorrow, but here some thoughts: I don't think the path manipulation, where you process ctx.configuration.bin_dir into "build_directory" and then add the short_name of your "exe" and "under" artifacts gives you the correct path to the files in the runfiles. You may be able to see the paths where the files are actually to be found if you pass --verbose_failures to "bazel run" when you run your example. The sandbox should then print a lot of debugging output, including a list of mounts. I think you can find your "env" binary in there and maybe with that, you can deduce a better way to get the path in your Skylark script. I will try to run your example on my workstation tomorrow and see if I can find a solution that works. :) |
@philwo ping? Is that really a bug? |
Runfiles, meh. There's a good chance that there's a bug here, or two. |
Actions API cleanup |
It's unclear if this is still an issue, and if so, whether it's caused by the use of the API or because there's a bug in |
related: #11997 |
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so. |
I have a skylark "run_under" rule that essentially does:
bazel run --script_path "name" --run_under "under" "command"
Then run the script
The code is here:
https://github.com/mzhaom/trunk/blob/master/tools/build_rules/run_under.bzl
The behavior I would expect is:
The issue I got is, if the "under" target is a py_binary, only the
wrapper script for the py_binary is produced, but not the runfiles
symlink tree, as a result, the py_binary can't be run.
I have a reproducible case here:
https://github.com/mzhaom/trunk/blob/master/examples/run_under/BUILD
If I do bazel clean then just run
$ bazel test examples/run_under:hello_test
I got error:
The text was updated successfully, but these errors were encountered: