Managing generated code

What’s the best way to manage generated code.

I can script it to compile, but then the IDE plugins won’t pick it up very easily. Several threads address how to work with it, but is there a concensus on best practice?

For IntelliJ and Eclipse, a common pattern is to generate the code in Gradle, and add the generator’s output directory as an additional source directory to the appropriate source set (say ‘sourceSets.main’). Then IDEs should pick up the sources as well.