gradle-jacoco-coverage
gradle-jacoco-coverage copied to clipboard
Android modules not being included in reports
Hi, first thanks a lot for the plugin. It is great for our project that is structured with a lot of separate modules. I am having an issue when integrating this with our Android project. As you may know, an Android project includes always an app module. We have this app module and then separate modules for our different features / components. The problem is that the report does not include at all our app module, while it does include the rest of our modules.
My current jacoco configuration is as follows:
root gradle:
dependencies { classpath 'com.palantir:jacoco-coverage:0.4.0' }
apply plugin: 'com.palantir.jacoco-full-report'
app module and all the other module's gradle files:
apply plugin: jacoco
This is working perfectly for all the modules except for app module.
Am I missing something? Let me know if you need any other information.
Thanks!
Hmmm, I don't know, sadly. Is there something idiosyncratic about the definition of the app module? Generally, we'd like to deprecate this plugin in favour of Gradle 3.4's built-in support for coverage enforcement.
On Tue, Apr 11, 2017 at 5:17 PM danielocampo2 [email protected] wrote:
Hi, first thanks a lot for the plugin. It is great for our project that is structured with a lot of separate modules. I am having an issue when integrating this with our Android project. As you may know, an Android project includes always an app module. We have this app module and then separate modules for our different features / components. The problem is that the report does not include at all our app module, while it does include the rest of our modules.
My current jacoco configuration is as follows: root gradle: dependencies { classpath 'com.palantir:jacoco-coverage:0.4.0' } apply plugin: 'com.palantir.jacoco-full-report'
app module and all the other module's gradle files: apply plugin: jacoco
This is working perfectly for all the modules except for app module.
Am I missing something? Let me know if you need any other information.
Thanks!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/palantir/gradle-jacoco-coverage/issues/30, or mute the thread https://github.com/notifications/unsubscribe-auth/AGOdwSdwDym6x8utBAR4lvoEeGZbisEfks5rvBgHgaJpZM4M6zS8 .
Yeah, we are not using Gradle 3.4 just yet. Though I am not sure how it would work this new feature regarding merging the reports for all the different modules. As far as I see is just for coverage enforcement, but nothing in regards of that. Anyway, that's off topic (but I am interested in).
The main difference I can think of is that it uses the 'com.android.application' plugin, and is the one that contains all the different dependencies -modules and libraries- for the app. Cannot see something particular to it that is not present in some other android.library module.
Could it be something related to the Build Variants? Currently, app is the only module that has different build variants (e.g.: productionDebug), while the rest of the modules only have release.
Thanks!
I don't know anything about Android building, I'm afraid.
On Tue, Apr 11, 2017 at 6:14 PM danielocampo2 [email protected] wrote:
Yeah, we are not using Gradle 3.4 just yet. Though I am not sure how it would work this new feature regarding merging the reports for all the different modules. As far as I see is just for coverage enforcement, but nothing in regards of that. Anyway, that's off topic (but I am interested in).
The main difference I can think of is that it uses the 'com.android.application' plugin, and is the one that contains all the different dependencies -modules and libraries- for the app. Cannot see something particular to it that is not present in some other android.library module.
Thanks
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/palantir/gradle-jacoco-coverage/issues/30#issuecomment-293444374, or mute the thread https://github.com/notifications/unsubscribe-auth/AGOdwVfy9XcYn9NlotLnQzghMej1HEQVks5rvCVsgaJpZM4M6zS8 .
I understand. Is there any way I can debug this and see if app is actually part of the projects included when building the reports? I see that in the plugins some modules might be excluded, so it would be helpful to check if app modules meets one of the conditions.
Thanks.
I discovered that actually the issue goes beyond app module, and affects every module that is an android module (either application or library). I assume the plugin needs some customisation in order to work with Android.
OK. I'm afraid I won't have time to tackle this in the near future. If you want to put a PR up, I'd be happy to review.
On Tue, Apr 11, 2017 at 8:40 PM danielocampo2 [email protected] wrote:
I discovered that actually the issue goes beyond app module, and affects every module that is an android module (either application or library). I assume the plugin needs some customisation in order to work with Android.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/palantir/gradle-jacoco-coverage/issues/30#issuecomment-293465119, or mute the thread https://github.com/notifications/unsubscribe-auth/AGOdwRbjfRqAWOs9Ri-CumZH9E4WvB1Wks5rvEewgaJpZM4M6zS8 .
Not exactly sure how to integrate this into the lib, but will try to figure it out at some point (or someone else can do too), but I have been able to fix this issue as follows:
- Created a jacoco_android.gradle file, based on this: jacoco.gradle The only changes I had to do to that file is to filter the flavours and buildTypes and just create the tasks for production flavour and debug build (currently we have production/develop and debug/release). Otherwise JaCoCo will fail when finding 2 classes of the same name (but different package).
- apply from: 'jacoco_android.gradle' file, for each android module, instead of using the 'jacoco' plugin.
Thanks.