-
Notifications
You must be signed in to change notification settings - Fork 12
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
Provide testing helper to verify actual incremental processor type #2
Comments
I think the best way is to actually run the processor in Gradle (see the tests in this project; and you can use the Gradle Tooling API to do that in non-Gradle projects, as the Gradle TestKit is not available as a library on its own). The problem with doing that in an annotation processor, or Error-prone check, is that this will only work if the processor being compiled uses Things could be done in a unit-test, but because There could be some kind of test artifact to help run Gradle projects and check for incrementality, but there'd still be some work needed in each project to "expose" their artifacts to the Gradle builds… For Maven, maybe a "gradle-invoker-maven-plugin" à la "maven-invoker-plugin" would be better… |
Looking at the Tooling API more closely, I see it provides even more information about annotation processors than TestKit (see https://docs.gradle.org/5.6.4/javadoc/org/gradle/tooling/events/task/java/JavaCompileTaskOperationResult.html), so I think it deserves a test artifact! Not sure when I'll have time to work on this though… |
Fwiw, former Gradle employees (now running Nokee.dev) are redistributing Gradle API and Gradle TestKit JARs to the Central Repository. They can be used from non-Gradle builds to drive Gradle builds and check the build logs for whether the processor under test is actually incremental. |
I'm not sure the best way to do this. If the processor is using
@SupportedAnnotationTypes
you could validate in your processor. Otherwise, there are a lot of options. Error-prone check, but that only covers Java and not Kotlin. Some kind of test artifact that checks the values returned bygetSupportedAnnotationTypes()
?The text was updated successfully, but these errors were encountered: