--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/a89255e1-9929-4217-a3ce-3c2c211daca6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Artifact:[[/home/.../.cache/bazel/_bazel_.../.../server]bazel-out/local_linux-fastbuild/genfiles]pip/six.pip.zip,
Artifact:[/home/.../src/server[source]]build_tools/vpip/import_check.py,Â
What I need to be able to do is unzip six.pip.zip from genfiles into the runfile of my target.Â
I can find the runfiles directory like this:
bin_runfiles = ctx.configuration.bin_dir.path + '/' + ctx.outpute.executable.short_path + '.runfiles'
Unfortunately, even if my rule populates the runfiles directory, it does not work deterministically. I suspect this is down to the fact that the outputs I specify for the action are partial (I can't easily inform bazel of the total zip manifest).
Basically, I want the target to be fully constructed with a complete instance of the runfiles directory before my final of the rule gets called.
-Mike
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/60470846-39b9-4979-9836-74b4b418e720%40googlegroups.com.
On Mon, Jan 11, 2016 at 3:01 AM, <ms...@dropbox.com> wrote:
> I've defined a set of skylark rules that create python binaries (the default
> py_* rules aren't hermetic enough for my use cases).
interesting; in what way?
Is the part you're missing how to set the runfiles of your custom rule? Returning struct(runfiles = ctx.runfiles(...)) from the implementation function does that. Not doing that will definitely cause problems with determinism.
However, you can't put all the files from a zip file in the runfiles if you don't know all the names at rule evaluation time. Bazel doesn't really support that... Could you write a rule to extract the runfiles and create a tarball to pass to the pkg_* rules directly? I'm pretty sure the pkg_* rules ignore actual runfiles anyways.
Bazel only constructs runfiles trees before running targets, which means there's no good way to force it to construct the tree so something else can operate on it.
If you want, constructing a fake runfiles tree in a temporary directory isn't very hard. file.short_path gives you the path a file will be copied to under the runfiles directory, so you can just copy all the files to their corresponding short_path under another directory.
On Mon, Jan 11, 2016 at 12:21 AM, Brian Silverman <bsilve...@gmail.com> wrote:Is the part you're missing how to set the runfiles of your custom rule? Returning struct(runfiles = ctx.runfiles(...)) from the implementation function does that. Not doing that will definitely cause problems with determinism.I have that part working correctly.ÂHowever, you can't put all the files from a zip file in the runfiles if you don't know all the names at rule evaluation time. Bazel doesn't really support that... Could you write a rule to extract the runfiles and create a tarball to pass to the pkg_* rules directly? I'm pretty sure the pkg_* rules ignore actual runfiles anyways.This is the crux of the problem. I could probably do as you suggest, but then the issue is that I have two workflows to maintain and debug. One is a pkg_* release and the other is the use case where someone is working incrementally and wants to rely on the symlinking of runfiles.
Bazel only constructs runfiles trees before running targets, which means there's no good way to force it to construct the tree so something else can operate on it.I don't quite understand this part. When I type "bazel build //my_bin" does that "run the target"? What about the target is referenced as a direct depenency? Does build //my_bin then also run //my_runfiles? If so, shouldn't there be a before-after relationship here I can leverage?
 Is there a bad way to force this?
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAP01z6KH-LwkvUv77HbbXxf2-PwL3vOysPULb755nGtKxEzyTw%40mail.gmail.com.