Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Gradle Apt Plugin #134

Open
JakePi3 opened this issue Jul 17, 2017 · 4 comments
Open

Add support for Gradle Apt Plugin #134

JakePi3 opened this issue Jul 17, 2017 · 4 comments

Comments

@JakePi3
Copy link

JakePi3 commented Jul 17, 2017

I already have another package that uses annotation processing (immutables), and it doesn't play nicely with the documented Gradle solution for adding annotation processing.

immutables plugs in directly to the Gradle Apt Plugin (https://github.com/tbroyer/gradle-apt-plugin)

It would be nice if the CodeGen worked similarly for vertx.. I have it working with Warnings only via:

dependencies {
  compileOnly "org.immutables:value:2.4.4:annotations"
  apt group: 'org.immutables', name: 'value', version: '2.4.4'

  compileOnly group: 'io.vertx', name: 'vertx-codegen', version: vertxVersion
  apt group: 'io.vertx', name: 'vertx-codegen', version: vertxVersion
  apt group: 'io.vertx', name: 'vertx-docgen', version: vertxVersion
  apt group: 'io.vertx', name:'vertx-service-proxy', version:vertxVersion, classifier: 'processor'
}

This generates both sets of classes but my gradle output is littered with warnings:

warning: No SupportedSourceVersion annotation found on io.vertx.serviceproxy.ServiceProxyProcessor, returning RELEASE_6.
warning: Supported source version 'RELEASE_6' from annotation processor 'io.vertx.serviceproxy.ServiceProxyProcessor' less than -source '1.8'

I have java code and source compatibility set to 1.8 but can't figure out how to feed this in to avoid the warning. Hopefully this is just a documentation issue, would be helpful to add this as an option to the documentation for anyone else using the apt plugin.

@jponge
Copy link
Member

jponge commented Jul 17, 2017

There is also a processor classifier for vertx-codegen, just like vertx-service-proxy.

What if you add:

dependencies {
  apt "io.vertx:vertx-codegen:$vertxVersion:processor"
  // (...)
}

(or even just as a compileOnly configuration, the immutables library generation also works if you add it without the apt plugin).

@JakePi3
Copy link
Author

JakePi3 commented Jul 18, 2017

That didn't make any difference, but I do have a suggested fix that I cribbed from antlr:

@Override public SourceVersion getSupportedSourceVersion() {
    return SourceVersion.latestSupported();
  }

Add above to ServiceProxyProcessor (or better yet the parent, CodeGenProcessor)..

The issue stems from this annotation being present on the parent class CodeGenProcessor:

@javax.annotation.processing.SupportedSourceVersion(javax.lang.model.SourceVersion.RELEASE_8)

But annotations are not inherited, so default RELEASE_6 is assigned.

@thiagogcm
Copy link

Gradle 4.6 has a new annotationProcessor configuration that also emits this warning.

@vorburger
Copy link

Gradle 4.6 has a new annotationProcessor configuration that also emits this warning.

@JakePi3 @jponge @thiagogcm @vietj @pmlopes see #181 re. annotationProcessor. When that (#181) is sorted, I guess this issue can be closed, as the Gradle Apt Plugin is superceded by annotationProcessor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants