Skip to content

Commit 5a8b45f

Browse files
authored
Add: Support for Android Gradle Plugin 9.0.0 (#122)
Fixes: #121
1 parent ac0fe76 commit 5a8b45f

File tree

25 files changed

+114
-164
lines changed

25 files changed

+114
-164
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
build:
7-
timeout-minutes: 40
7+
timeout-minutes: 60
88
runs-on: ubuntu-latest
99
steps:
1010
# See: https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/

README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ for specific modules:
150150
generateHtml = true
151151
generateXml = false
152152

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

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

159159
// Since 1.2: When true include results from instrumented Android tests into the coverage report
@@ -173,7 +173,7 @@ for specific modules:
173173
// Since 1.7 (experimental): The name of the Gradle Managed device to run instrumented tests on.
174174
// This is only used if `runOnGradleManagedDevices` is set to true. If not given tests will be
175175
// run on all available Gradle Managed Devices
176-
gradleManagedDeviceName = "nexusoneapi30"
176+
gradleManagedDeviceName = "smallphoneapi32"
177177
}
178178
```
179179
</details>
@@ -195,11 +195,11 @@ for specific modules:
195195
generateCsv false
196196
generateHtml true
197197
generateXml false
198-
199-
// Since 1.2: Same as executeTests except that this only affects the instrumented Android tests
198+
199+
// Since 1.2: When true this plugin will run the necessary Gradle tasks to execute instrumented Android tests
200200
executeAndroidTests true
201-
202-
// Since 1.2: Same as executeTests except that this only affects the unit tests
201+
202+
// Since 1.2: When true this plugin will run the necessary Gradle tasks to execute unit tests
203203
executeUnitTests true
204204
205205
// Since 1.2: When true include results from instrumented Android tests into the coverage report
@@ -219,29 +219,30 @@ for specific modules:
219219
// Since 1.7 (experimental): The name of the Gradle Managed device to run instrumented tests on.
220220
// This is only used if `runOnGradleManagedDevices` is set to true. If not given tests will be
221221
// run on all available Gradle Managed Devices
222-
gradleManagedDeviceName "nexusoneapi30"
222+
gradleManagedDeviceName "smallphoneapi32"
223223
}
224224
```
225225
</details>
226226

227227
# 4. Compatibility
228-
| Version | [Android Gradle plugin version](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle) | Gradle version |
229-
|------------|--------------------------------------------------------------------------------------------------------------|------------------------|
230-
| **1.11.0** | 8.11+ | 8.13+ |
231-
| **1.10.0** | 8.8+ | 8.10.2+ |
232-
| **1.9.0** | 8.6+ | 8.7+ |
233-
| **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+ |
234-
| **Note 1** | 8.0 - 8.3.0-alpha04 | n.a. |
235-
| **1.7.1** | 7.4 | 7.5+ |
236-
| **1.6.0** | 7.3 | 7.4+ |
237-
| **1.5.3** | 7.2 | 7.3+ |
238-
| **Note 2** | 7.0 - 7.2.0-alpha05 | n.a. |
239-
| **1.4.0** | 4.2<br/>4.1 | 6.7.1+<br/>6.5+ |
240-
| **1.3.1** | 4.0<br/>3.6 | 6.1.1+<br/>5.6.4+ |
241-
| **1.2.1** | 3.5 | 5.4.1+ |
242-
| **1.1.2** | 3.4 | 5.1.1+ |
243-
| **1.1.1** | 3.3 | 4.10.1+ |
244-
| **1.0.2** | 3.2 | 4.6+ |
228+
| Version | [Android Gradle plugin version](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle) | Gradle version |
229+
|---------------------|--------------------------------------------------------------------------------------------------------------|------------------------|
230+
| **1.12.0-SNAPSHOT** | 9.0+ | 9.1+ |
231+
| **1.11.0** | 8.11+ | 8.13+ |
232+
| **1.10.0** | 8.8+ | 8.10.2+ |
233+
| **1.9.0** | 8.6+ | 8.7+ |
234+
| **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+ |
235+
| **Note 1** | 8.0 - 8.3.0-alpha04 | n.a. |
236+
| **1.7.1** | 7.4 | 7.5+ |
237+
| **1.6.0** | 7.3 | 7.4+ |
238+
| **1.5.3** | 7.2 | 7.3+ |
239+
| **Note 2** | 7.0 - 7.2.0-alpha05 | n.a. |
240+
| **1.4.0** | 4.2<br/>4.1 | 6.7.1+<br/>6.5+ |
241+
| **1.3.1** | 4.0<br/>3.6 | 6.1.1+<br/>5.6.4+ |
242+
| **1.2.1** | 3.5 | 5.4.1+ |
243+
| **1.1.2** | 3.4 | 5.1.1+ |
244+
| **1.1.1** | 3.3 | 4.10.1+ |
245+
| **1.0.2** | 3.2 | 4.6+ |
245246

246247
<details>
247248
<summary><b>Note 1: AGP 8.0-8.3.0-alpha04</b></summary>

gradle/libs.versions.toml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[versions]
2-
androidMinSdk = "21"
3-
androidTargetSdk = "35"
2+
androidMinSdk = "24"
3+
androidTargetSdk = "36"
44
androidCompileSdk = "36"
5-
kotlin = "2.2.0"
6-
androidGradlePlugin = "8.11.1"
5+
kotlin = "2.3.10"
6+
androidGradlePlugin = "9.0.0"
77

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

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

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

3232
[plugins]
3333
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
34-
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
3534
kotlinDokka = { id = "org.jetbrains.dokka", version = "2.0.0" }
3635
pluginPortalPublish = { id = "com.gradle.plugin-publish", version = "1.3.1" }
3736
mavenPublish = { id = "com.vanniktech.maven.publish", version = "0.34.0" }

gradle/wrapper/gradle-wrapper.jar

181 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pluginManager.withPlugin("jacoco") {
102102
// Extracts the JaCoCo runtime jar from the configured JaCoCo Agent
103103
def extractJacocoRuntimeTask = tasks.register("extractJacocoTestKitRuntime", Copy) {
104104
from {
105-
zipTree(project.configurations.getByName(JacocoPlugin.AGENT_CONFIGURATION_NAME).asPath).matching { include 'jacocoagent.jar' }.singleFile
105+
zipTree(project.configurations.named(JacocoPlugin.AGENT_CONFIGURATION_NAME).map {it.asPath }).matching { include 'jacocoagent.jar' }.singleFile
106106
}
107107
into project.layout.buildDirectory.dir("testkit")
108108
}
@@ -118,12 +118,12 @@ pluginManager.withPlugin("jacoco") {
118118
it.group = "reporting"
119119
it.description = "Generates testkit-gradle.properties file which can be read and added to a TestKit build as gradle.properties"
120120
it.dependsOn(extractJacocoRuntimeTask)
121-
it.outputFile = new File(buildDir, "testkit/${javaTestTask.name}/gradle.properties")
122-
it.property("org.gradle.jvmargs", "\"-javaagent:${buildDir}/testkit/jacocoagent.jar=destfile=${destinationFileProvider.get()}\"")
121+
it.destinationFile.set(project.layout.buildDirectory.file("testkit/${javaTestTask.name}/gradle.properties"))
122+
it.property("org.gradle.jvmargs", "\"-javaagent:${project.layout.buildDirectory.get()}/testkit/jacocoagent.jar=destfile=${destinationFileProvider.get()}\"")
123123
}
124124

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

128128
// "Fixes": https://github.com/gradle/gradle/issues/16603
129129
def jacocoTestReport = tasks.named("jacocoTestReport")

plugin/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
POM_ARTIFACT_ID=android-root-coverage-plugin
2-
VERSION_NAME=1.11.0
2+
VERSION_NAME=1.12.0-SNAPSHOT
33
POM_NAME=Android Root Coverage Plugin
44
POM_DESCRIPTION=A Gradle plugin for easy generation of combined code coverage reports for Android projects with multiple modules.

plugin/src/main/kotlin/org/neotech/plugin/rootcoverage/CustomJacocoReportTask.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.neotech.plugin.rootcoverage
22

3-
import org.gradle.api.file.ConfigurableFileTree
43
import org.gradle.api.file.Directory
54
import org.gradle.api.file.FileTree
65
import org.gradle.api.file.RegularFile
@@ -10,7 +9,6 @@ import org.gradle.api.tasks.Input
109
import org.gradle.api.tasks.InputFiles
1110
import org.gradle.api.tasks.util.PatternSet
1211
import org.gradle.testing.jacoco.tasks.JacocoReport
13-
import org.neotech.plugin.rootcoverage.utilities.fileTree
1412

1513
abstract class CustomJacocoReportTask : JacocoReport() {
1614

0 commit comments

Comments
 (0)