cincheo/jsweet

Add beforeCompilationFinished to PrinterAdapter

jgfrm opened this issue · 2 comments

jgfrm commented

It is useful to have a beforeCompilationFinished hook that is called just before the targer generated file is closed, e.g. the add additional code at the end of the generated file.

Hello @jgfrm
Thanks for your suggestion.

I guess PrinterAdapter.onTranspilationFinished() does not fit your needs?

Please feel free to send a PR and we will merge it.

Bye

To complete Louis' answer...
Inserting code at the end of transpilation is not that straightforward because the end of transpiling depends on how you choose to generate the code (with or without bundling for instance). I would advise to also look at the PrinterAdapter's afterType(TypeElement type) to insert code after a transpiled class has been generated.

IMO, all the required hooks should be available but might require some big dive into the inside transpiler's components. Please, read the doc and the code (interfaces) carefully before considering any serious changes ;)