Hi,
I'm working on a migrating tool from maven to bazel which is aimed at building fine grain targets (package if possible, and if cycles exist then aggregate the packages).
For the first phase I'm migrating a codebase with ~100 maven modules to bazel and I was able to output 470 packages (includes packages for 3rdParty), ~770 targets and ~1800 actions.
The problem is that my build currently fails since I was too strict and I'm missing on some 3rd party compile dependencies.
I'd like to see if I can use the bazel query language to find the longest (or even better most comprehensive) successful build chain in the repo.
This will help me show the value of bazel for the part of the graph that works while continue to solve the problems in the part that doesn't.
This
thread resembles what I need but I think I need something much more complex.
One thought I had was to do the following:
val allTargets = "bazel query //..."
val rdepsOfTargets = for each target => (target, "bazel query rdeps(//..., $target)") // for each target create a pair of the target and the transitive reverse dependencies of it
then go over the map and try to run the build for every target which has itself and all of it's deps in the "successful targets" set.
This means that at first i'll try to run only those without dependencies.
Afterwards only those which depend only on the successful ones (after success i add the target to the set). I think this can give me after a few dozen rounds a good view but:
1. I might be totally off here.
2. Sounds like it will take a long time.
Would really appreciate input,
Ittai