I'm finally splitting up a big-ol' BUILD file with...
# general
f
I'm finally splitting up a big-ol' BUILD file with lots of recursive targets and overrides. Is there some automated tooling to help with this? Like maybe we could steal some Bazel tools. Or will I need to just need to process this myself?
w
deleting the file and then running
./pants tailor ::
should do 95% of it?
or, at least deleting all of the recursive targets
f
yeah... but I want to move the extensive overrides to the new BUILD files 😕
./pants peek //:
gives me json for everything defined in that file, but it's a bit much
w
yeah... but I want to move the extensive overrides to the new BUILD files
ah.
f
I think i'm just gonna
eval()
the build file with the generators aliased to something that collects the data... then I can process the overrides with pathlib, add those build files first, then do
./pants tailor
to fill in the normal stuff
b
Bazel's
buildozer
might help. I've used it on Pants BUILD files for automated refactoring: https://github.com/bazelbuild/buildtools/blob/master/buildozer/README.md
👀 1
b
f
would Jedi (https://jedi.readthedocs.io/en/latest/#) be useful? It powers some Python LSP servers and other tools.
f
f
This stuff would be interesting but the hard part is merging overrides... evaling the build file is pretty easy, as you can just pass globals for all the target types it uses and replace them with a function that collects the kwargs. I'll post a snippet when I'm done
👍 2