diff --git a/README.md b/README.md
index b9e8306..b25847c 100644
--- a/README.md
+++ b/README.md
@@ -24,19 +24,33 @@ Apply the plugin to your top-level (root project) `build.gradle` file using one
following methods:
- Plugin block:
+ Plugin block (Kotlin):
+
+ ```kotlin
+ plugins {
+ // Add the plugin to the plugin block
+ id("nl.neotech.plugin.rootcoverage") version "1.9.0"
+ }
+ ```
+
+
+
+ Plugin block (Groovy):
```groovy
- // Below buildscript {}
plugins {
- id "nl.neotech.plugin.rootcoverage" version "1.9.0"
+ // Add the plugin to the plugin block
+ id "nl.neotech.plugin.rootcoverage" version "1.9.0"
}
```
+
+
- classpath + apply:
+ Still using classpath & apply?
+ **Groovy**
```groovy
apply plugin: 'nl.neotech.plugin.rootcoverage'
@@ -47,7 +61,7 @@ following methods:
}
```
-
+
# 2. How to use
@@ -56,6 +70,28 @@ following methods:
modules that have at least one of these properties enabled in the final report (or individual
reports)
+
+ Kotlin (.gradle.kts)
+
+ ```kotlin
+ android {
+ buildTypes {
+ debug {
+ // AGP 7.3+ (at least one should be true for this module to be included in the reporting)
+ enableUnitTestCoverage = true
+ enableAndroidTestCoverage = true
+
+ // AGP before 7.3
+ testCoverageEnabled = true
+ }
+ }
+ }
+ ```
+
+
+
+ Groovy (.gradle)
+
```groovy
android {
buildTypes {
@@ -70,6 +106,7 @@ following methods:
}
}
```
+
> Only Android modules (`com.android.application` or `com.android.library`) are supported, this plugin will not execute
tests and generate coverage reports for non-android modules. Also keep in mind that by default
@@ -93,59 +130,110 @@ module. However in some cases different build variants per module might be requi
there is no `debug` build variant available. In those cases you can configure custom build variants
for specific modules:
-```groovy
-rootCoverage {
- // The default build variant for every module
- buildVariant "debug"
- // Overrides the default build variant for specific modules.
- buildVariantOverrides ":moduleA" : "debugFlavourA", ":moduleB": "debugFlavourA"
-
- // Class & package exclude patterns
- excludes = ["**/some.package/**"]
-
- // Since 1.1 generateHtml is by default true
- generateCsv false
- generateHtml true
- generateXml false
+>**Place this in the project root build.gradle file!**
- // Since 1.2: Same as executeTests except that this only affects the instrumented Android tests
- executeAndroidTests true
-
- // Since 1.2: Same as executeTests except that this only affects the unit tests
- executeUnitTests true
+
+ Kotlin (.gradle.kts)
+
+ ```kotlin
+ rootCoverage {
+ // The default build variant for every module
+ buildVariant = "debug"
+ // Overrides the default build variant for specific modules.
+ buildVariantOverrides = mapOf(":moduleA" to "debugFlavourA", ":moduleB" to "debugFlavourA")
+
+ // Class & package exclude patterns
+ excludes = ["**/some.package/**"]
+
+ // Since 1.1 generateHtml is by default true
+ generateCsv = false
+ generateHtml = true
+ generateXml = false
+
+ // Since 1.2: Same as executeTests except that this only affects the instrumented Android tests
+ executeAndroidTests = true
+
+ // Since 1.2: Same as executeTests except that this only affects the unit tests
+ executeUnitTests = true
+
+ // Since 1.2: When true include results from instrumented Android tests into the coverage report
+ includeAndroidTestResults = true
+
+ // Since 1.2: When true include results from unit tests into the coverage report
+ includeUnitTestResults = true
+
+ // Since 1.4: Sets jacoco.includeNoLocationClasses, so you don't have to. Helpful when using Robolectric
+ // which usually requires this attribute to be true
+ includeNoLocationClasses = false
+
+ // Since 1.7 (experimental): If set to true instrumented tests will be attempt to run on
+ // Gradle Managed Devices before trying devices connected through other means (ADB).
+ runOnGradleManagedDevices = false
+
+ // Since 1.7 (experimental): The name of the Gradle Managed device to run instrumented tests on.
+ // This is only used if `runOnGradleManagedDevices` is set to true. If not given tests will be
+ // run on all available Gradle Managed Devices
+ gradleManagedDeviceName = "nexusoneapi30"
+ }
+ ```
+
- // Since 1.2: When true include results from instrumented Android tests into the coverage report
- includeAndroidTestResults true
+
+ Groovy (.gradle)
- // Since 1.2: When true include results from unit tests into the coverage report
- includeUnitTestResults true
+ ```groovy
+ rootCoverage {
+ // The default build variant for every module
+ buildVariant "debug"
+ // Overrides the default build variant for specific modules.
+ buildVariantOverrides ":moduleA" : "debugFlavourA", ":moduleB": "debugFlavourA"
- // Since 1.4: Sets jacoco.includeNoLocationClasses, so you don't have to. Helpful when using Robolectric
- // which usually requires this attribute to be true
- includeNoLocationClasses false
-
- // Since 1.7 (experimental): If set to true instrumented tests will be attempt to run on
- // Gradle Managed Devices before trying devices connected through other means (ADB).
- runOnGradleManagedDevices false
+ // Class & package exclude patterns
+ excludes = ["**/some.package/**"]
- // Since 1.7 (experimental): The name of the Gradle Managed device to run instrumented tests on.
- // This is only used if `runOnGradleManagedDevices` is set to true. If not given tests will be
- // run on all available Gradle Managed Devices
- gradleManagedDeviceName "nexusoneapi30"
-}
-```
-
+ // Since 1.1 generateHtml is by default true
+ generateCsv false
+ generateHtml true
+ generateXml false
+
+ // Since 1.2: Same as executeTests except that this only affects the instrumented Android tests
+ executeAndroidTests true
+
+ // Since 1.2: Same as executeTests except that this only affects the unit tests
+ executeUnitTests true
+
+ // Since 1.2: When true include results from instrumented Android tests into the coverage report
+ includeAndroidTestResults true
+
+ // Since 1.2: When true include results from unit tests into the coverage report
+ includeUnitTestResults true
+
+ // Since 1.4: Sets jacoco.includeNoLocationClasses, so you don't have to. Helpful when using Robolectric
+ // which usually requires this attribute to be true
+ includeNoLocationClasses false
+
+ // Since 1.7 (experimental): If set to true instrumented tests will be attempt to run on
+ // Gradle Managed Devices before trying devices connected through other means (ADB).
+ runOnGradleManagedDevices false
+
+ // Since 1.7 (experimental): The name of the Gradle Managed device to run instrumented tests on.
+ // This is only used if `runOnGradleManagedDevices` is set to true. If not given tests will be
+ // run on all available Gradle Managed Devices
+ gradleManagedDeviceName "nexusoneapi30"
+ }
+ ```
+
# 4. Compatibility
| Version | [Android Gradle plugin version](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle) | Gradle version |
|------------|--------------------------------------------------------------------------------------------------------------|------------------------|
-| **1.9.0** | 8.6.0 | 8.7+ |
+| **1.9.0** | 8.6.0+ | 8.7+ |
| **1.8.0** | 8.5.2
8.4.2
8.3.0-alpha05 - 8.3.2 | 8.6+
8.5+
8.4+ |
-| **Note 2** | 8.0 - 8.3.0-alpha04 | n.a. |
+| **Note 1** | 8.0 - 8.3.0-alpha04 | n.a. |
| **1.7.1** | 7.4 | 7.5+ |
| **1.6.0** | 7.3 | 7.4+ |
| **1.5.3** | 7.2 | 7.3+ |
-| **Note 3** | 7.0 - 7.2.0-alpha05 | n.a. |
+| **Note 2** | 7.0 - 7.2.0-alpha05 | n.a. |
| **1.4.0** | 4.2
4.1 | 6.7.1+
6.5+ |
| **1.3.1** | 4.0
3.6 | 6.1.1+
5.6.4+ |
| **1.2.1** | 3.5 | 5.4.1+ |
@@ -153,26 +241,26 @@ rootCoverage {
| **1.1.1** | 3.3 | 4.10.1+ |
| **1.0.2** | 3.2 | 4.6+ |
-
- Note 2: AGP 8.0-8.3.0-alpha04
+
+ Note 1: AGP 8.0-8.3.0-alpha04
*Android Gradle Plugin version 8.0 till 8.3.0-alpha04 suffered from a [bug](https://issuetracker.google.com/u/0/issues/281266702) that made it impossible (by normal means) to get access to non-instrumented class files, this bug lasted for a long time and was only fixed in 8.3.0-alpha05. This means there is no stable working plugin version available for these AGP versions.*
- Note 3: AGP 7.0-7.2.0-alpha05
+ Note 2: AGP 7.0-7.2.0-alpha05
*Android Gradle Plugin version 7 till 7.2.0-alpha05 suffered from a [bug](https://issuetracker.google.com/issues/195860510) that caused instrumented coverage in Android library modules to fail, this has only been [fixed](https://github.com/NeoTech-Software/Android-Root-Coverage-Plugin/issues/36#issuecomment-977241070) in Android Gradle Plugin 7.2.0-alpha06. This means there is no stable working plugin version available for these AGP versions.*
- Note 4: group ID change & Maven Central
+ Note 3: Versions 1.0.2 to 1.3.0
- *Plugin versions below 1.3.1, such as 1.3.0, are only available on the Gradle Plugin Portal (`maven { url "https://plugins.gradle.org/m2/"}`) and not on Maven Central. These versions use the group ID `org.neotech.plugin` and plugin ID `org.neotech.plugin.rootcoverage`!*
+ *Plugin versions below 1.3.1, such as 1.3.0, are only available on the Gradle Plugin Portal and not on Maven Central. These versions use the group ID `org.neotech.plugin` and plugin ID `org.neotech.plugin.rootcoverage`! For more info see: [Bintray/JCenter shutdown](#4-bintrayjcenter-shutdown).*
- Note 5: AGP versions before 3.4.0-alpha05
+ Note 4: AGP versions before 3.4.0-alpha05
*Android Gradle Plugin versions before `3.4.0-alpha05` are affected by a bug that in certain conditions can cause Jacoco instrumentation to fail in combination with inline kotlin methods shared across modules. For more information see: [issue #109771903](https://issuetracker.google.com/issues/109771903) and [issue #110763361](https://issuetracker.google.com/issues/110763361). If your project is affected by this upgrade to an Android Gradle Plugin version of at least `3.4.0-alpha05`.*
@@ -184,18 +272,25 @@ the Android-Root-Coverage-Plugin has been migrated to Sonatype's Maven Central r
meant that the group ID used by the Android-Root-Coverage-Plugin had to be changed from `org.neotech.plugin` to
`nl.neotech.plugin`. The plugin ID has also changed from `org.neotech.plugin.rootcoverage` to `nl.neotech.plugin.rootcoverage`.
- JCenter is supposed to stay available as read-only repository, however it is probably better to migrate to
- the Gradle Plugin Portal, since all version of this plugin are also available there:
-```groovy
-pluginManagement {
- repositories {
- gradlePluginPortal()
+
+ More info
+
+ JCenter is supposed to stay available as read-only repository, however it is probably better to
+ migrate to the Gradle Plugin Portal, as it is the official Gradle repository for plugins, and all
+ versions of this plugin are available there:
+ ```groovy
+ pluginManagement {
+ repositories {
+ // Add this repository to your build script for plugin resolution, above mavenCentral() or jcenter()
+ gradlePluginPortal()
+ }
}
-}
-```
-Version 1.3.0 has been re-released (as 1.3.1) with the new group ID and plugin ID to Maven Central and the
-Gradle Plugin Portal. Upcoming versions will also be released to Maven Central and the Gradle Plugin Portal.
-Check the [setup](#1-setup) section on how to use this plugin with the updated group ID and plugin ID.
+ ```
+ Version 1.3.0 has been re-released (as 1.3.1) with the new group ID and plugin ID to Maven Central and the
+ Gradle Plugin Portal. Upcoming versions will also be released to Maven Central and the Gradle Plugin Portal.
+ Check the [setup](#1-setup) section on how to use this plugin with the updated group ID and plugin ID.
+
+
# 5. Development