Maybe a bit of tangent for this channel but I'm using kotlinpoet to generate source code for a library I'm building. The library communicates with a service and the protocol is defined in a json file which I use to generate sources (request types, event types, enums, etc). However, I run into a circular dependency problem where the generated sources depends on the regular sources (e.g. implementing interfaces), but the regular sources would also benefit from depending on the generated sources (e.g. access to error codes enum, access to event types for deserialization).
How can this typically be resolved? I don't have much past experience with generating sources like this. Atm, I'm relying on reflection in some few cases to deal with this problem but it's not particularly nice. Another approach would be to, instead of genering sources at compile time, generate sources on-demand and store them together with the regular source files. Would also mean that I'd have to check those into git.