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

Update to support annotationProcessor configuration #142

Closed
ivangonzalez88 opened this issue Mar 21, 2017 · 10 comments
Closed

Update to support annotationProcessor configuration #142

ivangonzalez88 opened this issue Mar 21, 2017 · 10 comments
Assignees
Milestone

Comments

@ivangonzalez88
Copy link

Hi,

I am using the groovy plugin in order to use Spock framework. Recently we added a library for runtime permissions in android
https://github.com/hotchemi/PermissionsDispatcher which uses annotation processors, the library is generating the class files, i am able to see them, but when the task compileDebugGroovyWithGroovyc runs, it always fails with the below message /Users/ionzalez/Documents/twc/flagship_phone/app/src/main/java/com/weather/commons/ups/ui/AbstractLoginActivity.java:206: error: cannot find symbol AbstractLoginActivityPermissionsDispatcher.loginWithGooglePlusWithCheck(AbstractLoginActivity.this); ^ symbol: variable AbstractLoginActivityPermissionsDispatcher location: class AbstractLoginActivity.GoogleLoginWithGooglePlusWithCheck
This happen for all the generated classes by the processor, but somehow groovy compiler does not pick them. If i remove the plugin everything works fine apply plugin: 'groovyx.android'
We were able to run spock test before, and it worked well with the permissions library. I started noticing this problem after removing android-apt plugin, which is deprecated.

this is my configuration
classpath 'org.codehaus.groovy:groovy-android-gradle-plugin:1.1.0'
apply plugin: 'groovyx.android'
//groovy and spock dependency
testCompile 'org.codehaus.groovy:groovy-all:2.4.7:grooid'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
//Permissions dependency
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.3.2
compile 'com.github.hotchemi:permissionsdispatcher:2.3.0'

Thanks & Regards

@AndrewReitz
Copy link
Collaborator

Have you followed the steps in the README.md about annotation processing with the plugin?

@ivangonzalez88
Copy link
Author

Yes i try it.

androidGroovy { options { configure(groovyOptions) { javaAnnotationProcessing = true } } }
The android-apt plugin is deprecated http://www.littlerobots.nl/blog/Whats-next-for-android-apt/, as soon as i got rid of it, it started failing.

@AndrewReitz
Copy link
Collaborator

AndrewReitz commented Mar 22, 2017

Have you tried skipping javac and only haveing groovyc run as well?

If you could please provide a failing test for this it would be helpful for debugging.
Similar to https://github.com/groovy/groovy-android-gradle-plugin/blob/master/groovy-android-gradle-plugin/src/test/groovy/groovyx/functional/SkipJavaCSpec.groovy

@AndrewReitz
Copy link
Collaborator

@ivangonzalez88 any update on this?

@ivangonzalez88
Copy link
Author

Hi, i could not work around on this, not skipping java c or using joint compilation worked. We disable it for now since we are using 2.4-dev version from gradle, maybe this 2.4-dev version of the gradle plugin is somehow affecting.

@rdietrichberlin
Copy link

Running into the same issue within android plugin 2.3.1 which includes annotation processing [1] :
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'org.codehaus.groovy:groovy-android-gradle-plugin:1.1.0'
}
As mentioned in the README.md:

"Important android-apt must be applied after the groovy android plugin."

This could not be satisfied, because of the annotation processing is included in com.android.tools.build:gradle!

[1] https://bitbucket.org/hvisser/android-apt/wiki/Migration

@AndrewReitz AndrewReitz changed the title compileDebugGroovyWithGroovyc task fails because it cannot find generated classes Update to support annotationProcessor configuration Apr 19, 2017
@AndrewReitz
Copy link
Collaborator

On my project updating to use the annotationProcessor configuration instead of apt does not cause this error, but also appears to not run that annotation processor.

@sgara
Copy link

sgara commented Apr 27, 2017

Same problem here :( Using annotationProcessor does not run. Using groovy for unit test with Spock only. Dagger and Databinding generated classes end up "not existing"
Any update/idea on this?

@AndrewReitz AndrewReitz self-assigned this May 30, 2017
@AndrewReitz AndrewReitz added this to the 1.2.0 milestone May 31, 2017
AndrewReitz added a commit to AndrewReitz/groovy-android-gradle-plugin that referenced this issue Jun 1, 2017
Annotation is now supported by default. Can
use android gradle plugin's `annotationProcessor` configurations.

Fixes: groovy#142
AndrewReitz added a commit to AndrewReitz/groovy-android-gradle-plugin that referenced this issue Jun 1, 2017
Annotation is now supported by default. Can
use android gradle plugin's `annotationProcessor` configurations.

Fixes: groovy#142
@AndrewReitz
Copy link
Collaborator

Fixed in #149 which should be deployed in the snapshot if you want to try it out.

@AndrewReitz
Copy link
Collaborator

Merged into 1.2.0 branch

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