Let's say I have a simple java program including 2 classes:
Example, Example2
and another class that uses both classes:
ExamplesUsage
and I have corresponding bazel build targets of kind java_library:
example, example2, examples_usage
so example and example2 need to be compiled before examples_usage is built.
I want to accumulate information from all three targets using bazel aspects propagation technique, how do I go about doing that?
Here's an example for accumulating the number of source files in this build chain:
if we run it on the hypothetical java program we get the following output:
As you can see the 'dependencies' targets' aspects were run first, and only then the 'dependant' target aspect was run.
Of course in order to actually utilize the information some
ctx.actionorctx.file_actionneeds to be called in order to persist the gathered data