Have a question on kotlinpoet or source code gener...
# squarelibraries
p
Have a question on kotlinpoet or source code generation in general. I have a library project which generates sources. The code that generates sources depends on the regular sources. This can be solved by requiring the code generation to run after
compileKotlin
. However, this means that after first compilation of the project there aren't any compiled classes for the generated sources. I have a circular dependency where I can't run source code generation until classes are compiled but I also want the compile phase to include the generated sources. How to best deal with this? To me it would make sense if I could first compile specified classes needed to run the code generation, then run source code generation and lastly run the "regular"
compileKotlin
.
Maybe I need to split it up in sub projects. a) the core part with all static source b) code to generate sources c) umbrella project which depends on both a and b Now I should be able to compile a), then generated source in b), then compile b) and lastly compile c). Any usage of the library would depend on c).
c
perhaps a custom task (perhaps via a plugin) to generate the code.