Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

jobs:
build:
timeout-minutes: 40
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
# See: https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/
Expand Down
51 changes: 26 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ for specific modules:
generateHtml = true
generateXml = false

// Since 1.2: Same as executeTests except that this only affects the instrumented Android tests
// Since 1.2: When true this plugin will run the necessary Gradle tasks to execute instrumented Android tests
executeAndroidTests = true

// Since 1.2: Same as executeTests except that this only affects the unit tests
// Since 1.2: When true this plugin will run the necessary Gradle tasks to execute unit tests
executeUnitTests = true

// Since 1.2: When true include results from instrumented Android tests into the coverage report
Expand All @@ -173,7 +173,7 @@ for specific modules:
// 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"
gradleManagedDeviceName = "smallphoneapi32"
}
```
</details>
Expand All @@ -195,11 +195,11 @@ for specific modules:
generateCsv false
generateHtml true
generateXml false
// Since 1.2: Same as executeTests except that this only affects the instrumented Android tests

// Since 1.2: When true this plugin will run the necessary Gradle tasks to execute instrumented Android tests
executeAndroidTests true
// Since 1.2: Same as executeTests except that this only affects the unit tests

// Since 1.2: When true this plugin will run the necessary Gradle tasks to execute unit tests
executeUnitTests true

// Since 1.2: When true include results from instrumented Android tests into the coverage report
Expand All @@ -219,29 +219,30 @@ for specific modules:
// 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"
gradleManagedDeviceName "smallphoneapi32"
}
```
</details>

# 4. Compatibility
| Version | [Android Gradle plugin version](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle) | Gradle version |
|------------|--------------------------------------------------------------------------------------------------------------|------------------------|
| **1.11.0** | 8.11+ | 8.13+ |
| **1.10.0** | 8.8+ | 8.10.2+ |
| **1.9.0** | 8.6+ | 8.7+ |
| **1.8.0** | 8.5.2<br/>8.4.2<br/>8.3.0-alpha05 - 8.3.2 | 8.6+<br/>8.5+<br/>8.4+ |
| **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 2** | 7.0 - 7.2.0-alpha05 | n.a. |
| **1.4.0** | 4.2<br/>4.1 | 6.7.1+<br/>6.5+ |
| **1.3.1** | 4.0<br/>3.6 | 6.1.1+<br/>5.6.4+ |
| **1.2.1** | 3.5 | 5.4.1+ |
| **1.1.2** | 3.4 | 5.1.1+ |
| **1.1.1** | 3.3 | 4.10.1+ |
| **1.0.2** | 3.2 | 4.6+ |
| Version | [Android Gradle plugin version](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle) | Gradle version |
|---------------------|--------------------------------------------------------------------------------------------------------------|------------------------|
| **1.12.0-SNAPSHOT** | 9.0+ | 9.1+ |
| **1.11.0** | 8.11+ | 8.13+ |
| **1.10.0** | 8.8+ | 8.10.2+ |
| **1.9.0** | 8.6+ | 8.7+ |
| **1.8.0** | 8.5.2<br/>8.4.2<br/>8.3.0-alpha05 - 8.3.2 | 8.6+<br/>8.5+<br/>8.4+ |
| **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 2** | 7.0 - 7.2.0-alpha05 | n.a. |
| **1.4.0** | 4.2<br/>4.1 | 6.7.1+<br/>6.5+ |
| **1.3.1** | 4.0<br/>3.6 | 6.1.1+<br/>5.6.4+ |
| **1.2.1** | 3.5 | 5.4.1+ |
| **1.1.2** | 3.4 | 5.1.1+ |
| **1.1.1** | 3.3 | 4.10.1+ |
| **1.0.2** | 3.2 | 4.6+ |

<details>
<summary><b>Note 1: AGP 8.0-8.3.0-alpha04</b></summary>
Expand Down
25 changes: 12 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
androidMinSdk = "21"
androidTargetSdk = "35"
androidMinSdk = "24"
androidTargetSdk = "36"
androidCompileSdk = "36"
kotlin = "2.2.0"
androidGradlePlugin = "8.11.1"
kotlin = "2.3.10"
androidGradlePlugin = "9.0.0"

[libraries]
appCompat = { module = "androidx.appcompat:appcompat", version = "1.7.1" }
Expand All @@ -12,17 +12,17 @@ androidGradlePluginApi = { module = "com.android.tools.build:gradle-api", vers

# Test dependencies
junit = { module = "junit:junit", version = "4.13.2" }
testOrchestrator = { module = "androidx.test:orchestrator", version = "1.5.1" }
testOrchestrator = { module = "androidx.test:orchestrator", version = "1.6.1" }
truth = { module = "com.google.truth:truth", version = "1.4.4" }
supportTestRunner = { module = "androidx.test:runner", version = "1.6.2" }
espressoCore = { module = "androidx.test.espresso:espresso-core", version = "3.6.1" }
androidJUnit = { module = "androidx.test.ext:junit", version = "1.2.1" }
commonsCsv = { module = "org.apache.commons:commons-csv", version = "1.14.0" }
espressoCore = { module = "androidx.test.espresso:espresso-core", version = "3.7.0" }
androidJUnit = { module = "androidx.test.ext:junit", version = "1.3.0" }
commonsCsv = { module = "org.apache.commons:commons-csv", version = "1.14.1" }
kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
robolectric = { module = "org.robolectric:robolectric", version = "4.15.1" }
mockk = { module = "io.mockk:mockk", version = "1.14.5" }
jacksonYaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version = "2.19.2"}
jacksonKotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version = "2.19.2"}
robolectric = { module = "org.robolectric:robolectric", version = "4.16.1" }
mockk = { module = "io.mockk:mockk", version = "1.14.9" }
jacksonYaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version = "2.21.0"}
jacksonKotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version = "2.21.0"}

[bundles]
androidInstrumentedTest = ["supportTestRunner", "espressoCore", "androidJUnit"]
Expand All @@ -31,7 +31,6 @@ jvmTest = ["kotlinTest", "junit", "truth", "commonsCsv"]

[plugins]
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinDokka = { id = "org.jetbrains.dokka", version = "2.0.0" }
pluginPortalPublish = { id = "com.gradle.plugin-publish", version = "1.3.1" }
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.34.0" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
9 changes: 4 additions & 5 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pluginManager.withPlugin("jacoco") {
// Extracts the JaCoCo runtime jar from the configured JaCoCo Agent
def extractJacocoRuntimeTask = tasks.register("extractJacocoTestKitRuntime", Copy) {
from {
zipTree(project.configurations.getByName(JacocoPlugin.AGENT_CONFIGURATION_NAME).asPath).matching { include 'jacocoagent.jar' }.singleFile
zipTree(project.configurations.named(JacocoPlugin.AGENT_CONFIGURATION_NAME).map {it.asPath }).matching { include 'jacocoagent.jar' }.singleFile
}
into project.layout.buildDirectory.dir("testkit")
}
Expand All @@ -118,12 +118,12 @@ pluginManager.withPlugin("jacoco") {
it.group = "reporting"
it.description = "Generates testkit-gradle.properties file which can be read and added to a TestKit build as gradle.properties"
it.dependsOn(extractJacocoRuntimeTask)
it.outputFile = new File(buildDir, "testkit/${javaTestTask.name}/gradle.properties")
it.property("org.gradle.jvmargs", "\"-javaagent:${buildDir}/testkit/jacocoagent.jar=destfile=${destinationFileProvider.get()}\"")
it.destinationFile.set(project.layout.buildDirectory.file("testkit/${javaTestTask.name}/gradle.properties"))
it.property("org.gradle.jvmargs", "\"-javaagent:${project.layout.buildDirectory.get()}/testkit/jacocoagent.jar=destfile=${destinationFileProvider.get()}\"")
}

// Make the generated gradle.properties file available on the test classpath as resource
dependencies.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, files(new File(buildDir, "testkit/${javaTestTask.name}")))
dependencies.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, files(project.layout.buildDirectory.file("testkit/${javaTestTask.name}")))

// "Fixes": https://github.com/gradle/gradle/issues/16603
def jacocoTestReport = tasks.named("jacocoTestReport")
Expand Down
2 changes: 1 addition & 1 deletion plugin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
POM_ARTIFACT_ID=android-root-coverage-plugin
VERSION_NAME=1.11.0
VERSION_NAME=1.12.0-SNAPSHOT
POM_NAME=Android Root Coverage Plugin
POM_DESCRIPTION=A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.neotech.plugin.rootcoverage

import org.gradle.api.file.ConfigurableFileTree
import org.gradle.api.file.Directory
import org.gradle.api.file.FileTree
import org.gradle.api.file.RegularFile
Expand All @@ -10,7 +9,6 @@ import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.util.PatternSet
import org.gradle.testing.jacoco.tasks.JacocoReport
import org.neotech.plugin.rootcoverage.utilities.fileTree

abstract class CustomJacocoReportTask : JacocoReport() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package org.neotech.plugin.rootcoverage
import com.android.build.api.AndroidPluginVersion
import com.android.build.api.artifact.ScopedArtifact
import com.android.build.api.dsl.BuildType
import com.android.build.api.dsl.CommonExtension
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.api.variant.LibraryAndroidComponentsExtension
import com.android.build.api.variant.ScopedArtifacts
import com.android.build.api.variant.Variant
import com.android.build.gradle.BaseExtension
import org.gradle.api.GradleException
import org.gradle.api.NamedDomainObjectContainer
import org.gradle.api.Plugin
Expand All @@ -24,7 +24,7 @@ import java.io.File

class RootCoveragePlugin : Plugin<Project> {

private val minimumRequiredAgpVersion = AndroidPluginVersion(8, 8, 0)
private val minimumRequiredAgpVersion = AndroidPluginVersion(9, 0, 0)

private lateinit var rootProjectExtension: RootCoveragePluginExtension

Expand Down Expand Up @@ -201,7 +201,7 @@ class RootCoveragePlugin : Plugin<Project> {
// - A user provided Gradle Managed Device.
// - All Gradle Managed Devices if any is available.
// - All through ADB connected devices.
val gradleManagedDevices = subProject.extensions.getByType(BaseExtension::class.java).testOptions.managedDevices.devices
val gradleManagedDevices = subProject.extensions.getByType(CommonExtension::class.java).testOptions.managedDevices.allDevices

if (rootProjectExtension.runOnGradleManagedDevices && !rootProjectExtension.gradleManagedDeviceName.isNullOrEmpty()) {
return AndroidTestTask(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ open class RootCoveragePluginExtension {
* Same as executeUnitTests except that this only disables/enables the instrumented Android tests.
*
* Default: true
*
* @see executeTests
*/
var executeAndroidTests: Boolean = true

Expand All @@ -47,18 +45,9 @@ open class RootCoveragePluginExtension {
* Same as executeUnitTests except that this only disables/enables the instrumented Android tests.
*
* Default: true
*
* @see executeTests
*/
var executeUnitTests: Boolean = true

/**
* @see executeAndroidTests
* @see executeUnitTests
*/
@Deprecated("Instead use executeAndroidTests and/or executeUnitTests")
var executeTests: Boolean = true

/**
* Whether to include results from instrumented Android tests into the final coverage report. If disabled this also causes the plugin to
* not automatically execute instrumented Android tests (if not already disabled by `executeAndroidTests`).
Expand Down Expand Up @@ -91,7 +80,7 @@ open class RootCoveragePluginExtension {
*/
var runOnGradleManagedDevices: Boolean = false

internal fun shouldExecuteAndroidTests() = executeTests && executeAndroidTests && includeAndroidTestResults
internal fun shouldExecuteAndroidTests() = executeAndroidTests && includeAndroidTestResults

internal fun shouldExecuteUnitTests() = executeTests && executeUnitTests && includeUnitTestResults
internal fun shouldExecuteUnitTests() = executeUnitTests && includeUnitTestResults
}
Loading