i guess my question is what's the right way to hav...
# general
p
i guess my question is what's the right way to have a GEN task happen before your build or compiles?
all v1 tasks have "product dependencies" that enforce an ordering
but tasks are additionally installed in goals
you can look at
./pants --explain $somegoal
to see what order things will be run in
p
hmmm cool thanks
if my gen task generates some code
that goes into .pants.d/gen/blah, how do i copy that somewhere in my compile task?
in this example from two separate plugins
w
the node tasks would consume a product
and your task would provide that product, in the format it was expecting
p
are there any examples of this i could look at?
w
the page i linked to has one
(it's inlined directly from real tasks in the pants codebase)
but... actually, codegen is a different situation.
@polite-vase-75369: codegen tasks "create targets"
p
hmmm
w
are you extending SimpleCodegenTask?
p
thats more what im thinking about
no im not 😞
w
there are a bunch of examples of SimpleCodegenTask implementations upstream, so worth looking at some of those.
p
so with SimpleCodegenTask i can first generate code, it goes somewhere (.pants.d/...) and then i can reference it?
w
SimpleCodegenTask also creates the target for the code
in this case, that would be a
node_module
probably
p
the node plugin is also kinda atypical, not sure if uve looked at it a bunch, it creates symlinks
w
it then injects that target "next to" the original thrift target
p
oh
actually we are using simplecodegen
what do you mean by "next to"
w
If a target was directly depending on the thrift target, after simplecodegentask runs it will also be directly depending on the generated ("synthetic") target
p
so i should just be able to add that as a dependency in my build?
i wonder if node just does weird stuff and it isn't working as it should
w
are you creating the right target type in your SimpleCodegenTask?
and is it running?
ordering matters more for codegen... you need to make sure your task is installed "before" the consuming task
p
code gen def runs, just feels like it's out of order
OH the target type seems wrong
a
@polite-vase-75369 yes,
NodeModule
would be the correct thing to return from
synthetic_target_type()