perhaps a quick question to be sure that I don't g...
# general
b
perhaps a quick question to be sure that I don't go in a wall. Somebody told me on this chanel that code gen needs to be run before compile. This statement is only valid for one target, right ? If a code gen target
a
depends on java_library target
b
, code gen of
a
is run after compilation of
b
?
e
False. Today all codegen is done in a single pass. Compiles then come after, they cannot interleave.
a
(this is only if you're asking about pants task(s) you are developing -- the dilemma john described is one of the things that the v2 engine's declarative model makes easier in some ways. but if you need to, for example, run a task that generates code, then run another task that generates code off of that, you can override the
product_types()
and
prepare()
classmethods on your tasks in order to enforce an ordering between the two code generating tasks -- you have probably seen this page already: https://www.pantsbuild.org/dev_tasks.html)
we should update that page with an example of using a
type
as the product instead of a string, i might make a small PR
h
To clarify, currently all tasks registered in the “codegen” goal are done in a single pass. But you can register yours in a “myspecialcodegen” goal and set up the product dependencies as needed.
☝️ 1
a
thanks benjy that is a crucial point i completely missed
b
thank you for the anwers !
actually it seems I completely missed the
annotation_processor
target which furiously looks like what I'm trying to achieve