Hi, I recently came across a problem in Bazel wher...
# general
Hi, I recently came across a problem in Bazel where you have a rule that outputs a directory of randomly named files instead of a few known files. This means you can't add it to the build graph because that only deals in files, not directories. The currently recommended workaround is to zip/unzip the directory before/after running the rule. Not idea. I was wondering if Pants handles this any better?
Mmmm you'd have to be more specific on the problem at hand to get a complete answer. Pants certainly can handle various things at the directory (and file) level, but depending on the situation your ability to cache results of operations may diminish
Well in Bazel when you define a rule you'd like to say something like this:
Copy code
        outputs = [work_dir],
is a directory that gets a load of randomly named files written to it. But it doesn't really work because the build graph operates on files with names that are all known at analysis time.
It doesn't have the concept of "this rule generates a directory of stuff, and this other rule needs access to that directory as input".
So Pants defintely supports directory-as-a-unit both at the BUILD-level (
comes to mind) and at the Plugin level (using a
). Depending on where/how the directory is captured is the razor for caching. So in that regard YMMV
Ah ok cool that's good to know!