Incremental Builds with unsupported annotation processors


I’m trying to figure out a way to get incremental builds at least partially working with an unsupported annotation processor.

On the project I’m working on we are using querydsl to generate “Q” classes from our model objects. The issue is that the apt processor does not support incremental builds and it doesn’t look like it will be supported in the near future. I took a quick look at what it would take to make it incremental and it looks like a fair chunk of work so I’m looking for an alternative strategy.

One strategy I found would be to create a function that detects if any of the source files with the annotations have changed and if they have add the annotation processor to the dependency section. Not optimal but should do the trick for quicker rebuilds during development / unit testing.
See -

I’m having troubles figuring out if the source files have changed. It should be pretty easy given they are all in the same package. Is there a built in way to do this in gradle that I can access?

I’m also open to other solutions if there are any. Perhaps a custom task with inputs/ output?