This page describes how to make Gradle's eclipse task populate the annotation processing factory path in Eclipse, so that IDE users can take advantage of annotation processing without having to switch context to Gradle. Are there any plans to make annotation processing a more first-class part of the Java project model in Gradle, and extend IDE support? Concretely, it would be cool if I could simply say
dependencies {
annotationProcessor 'com.google.auto.value:auto-value:1.0'
}... and have ./gradlew build, ./gradlew eclipse and ./gradlew idea work without further configuration.
I'd be happy to help with this if someone familiar with the code can provide a little guidance.
--
You received this message because you are subscribed to the Google Groups "gradle-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gradle-dev+...@googlegroups.com.
To post to this group, send email to gradl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gradle-dev/8e2e3daa-b0d3-4825-be78-bba19f023c0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
So, it took me a bit of time (I had to learn nebula-test, Spock, and a bit more of Groovy, and I tried many many options) but I finally have something I'm happy with as a first step: https://github.com/tbroyer/gradle-apt-plugin/(I cleaned up my history so you won't see the myriad of things I tried out)Compared to what I was doing in my build scripts, I changed the compileOnly configurations to extend from 'compile' and assigned them as the sourceSets' compileClasspath (instead of only configuring the JavaCompile tasks' classpath).I think I could easily add a processorpath, processors and processorArgs properties to JavaCompile's CompileOptions (similar to how I already added sourcepath), defaulting to an empty processorpath (possible breaking change, just assign processorpath=classpath to revert to previous/current behavior, just like we did with sourcepath).
If processors is the empty list, then no -processor argument is passed to javac and the default discovery process is used.processorArgs is a Map<String,?> and each entry is passed as -A<key>=<value>
There’s a couple of interim steps here:1. Add a `processorpath` property to CompileOptions (like the existing ‘sourcepath’)2. Add a `processorpath` property to SourceSet (like existing ‘compileClasspath’)3. Update the Java plugin to wire #2 to #14. Create default/conventional dependency configurations that are wired to #35. (more stuff I haven’t thought of)We might want to do some strong modelling of the other annotation processor relevant options too.Having the IDEs support this is really dependent on #2. Getting to something like your example means #4.That’s all reasonably straightforward stuff, if we could agree on #2 (i.e. the exact API changes).If you’re interested in progressing this, the best thing to do would be to submit what we call a “design spec” with a proposal for these changes.