Skip to content

Commit 10fd563

Browse files
committed
Add: Support for Android Gradle Plugin 9.0.0 [WIP]
1 parent ac0fe76 commit 10fd563

File tree

16 files changed

+58
-43
lines changed

16 files changed

+58
-43
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
@@ -219,7 +219,7 @@ 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>

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
androidMinSdk = "21"
3-
androidTargetSdk = "35"
3+
androidTargetSdk = "36"
44
androidCompileSdk = "36"
55
kotlin = "2.2.0"
66
androidGradlePlugin = "8.11.1"
@@ -19,7 +19,7 @@ espressoCore = { module = "androidx.test.espresso:espresso-core",
1919
androidJUnit = { module = "androidx.test.ext:junit", version = "1.2.1" }
2020
commonsCsv = { module = "org.apache.commons:commons-csv", version = "1.14.0" }
2121
kotlinTest = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
22-
robolectric = { module = "org.robolectric:robolectric", version = "4.15.1" }
22+
robolectric = { module = "org.robolectric:robolectric", version = "4.16.1" }
2323
mockk = { module = "io.mockk:mockk", version = "1.14.5" }
2424
jacksonYaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version = "2.19.2"}
2525
jacksonKotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version = "2.19.2"}

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/src/test/kotlin/org/neotech/plugin/rootcoverage/IntegrationTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ class IntegrationTest(
5353
"""
5454
managedDevices {
5555
devices {
56-
nexusoneapi30 (com.android.build.api.dsl.ManagedVirtualDevice) {
57-
device = "Nexus One"
58-
apiLevel = 30
59-
systemImageSource = "aosp-atd"
56+
smallphoneapi32 (com.android.build.api.dsl.ManagedVirtualDevice) {
57+
device = "Small Phone"
58+
apiLevel = 32
59+
systemImageSource = "aosp"
6060
}
6161
}
6262
}
@@ -99,7 +99,7 @@ class IntegrationTest(
9999
if (!runOnGradleManagedDevices) {
100100
executeGradleTasks(listOf("clean", "connectedDebugAndroidTest", "connectedDemoDebugAndroidTest"))
101101
} else {
102-
executeGradleTasks(listOf("clean", "nexusoneapi30DebugAndroidTest", "nexusoneapi30DemoDebugAndroidTest"))
102+
executeGradleTasks(listOf("clean", "smallphoneapi32DebugAndroidTest", "smallphoneapi32DemoDebugAndroidTest"))
103103
}
104104

105105
listOf("coverageReport", "rootCodeCoverageReport", "--stacktrace")
@@ -232,7 +232,7 @@ class IntegrationTest(
232232

233233
val fixture = File("src/test/test-fixtures/multi-module")
234234

235-
val gradleVersions = arrayOf("8.13", "8.14.3")
235+
val gradleVersions = arrayOf("9.1.0", "9.2.1", "9.3.1")
236236

237237
val configurations = File(fixture, "configurations").listFiles() ?: error("Configurations folder not found in $fixture")
238238
return configurations.flatMap { configuration ->

plugin/src/test/test-fixtures/multi-module/app/build.gradle.tmp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
13
plugins {
24
id "com.android.application"
35
alias(libs.plugins.kotlinAndroid)
@@ -53,9 +55,11 @@ android {
5355

5456
{{managedDevices}}
5557
}
58+
}
5659

57-
kotlinOptions {
58-
jvmTarget = "21"
60+
kotlin {
61+
compilerOptions {
62+
jvmTarget.set(JvmTarget.JVM_21)
5963
}
6064
}
6165

plugin/src/test/test-fixtures/multi-module/configurations/gradle-managed-device-clear-package-data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ pluginConfiguration:
3030
- name: runOnGradleManagedDevices
3131
value: true
3232
- name: gradleManagedDeviceName
33-
value: nexusoneapi30
33+
value: smallphoneapi32

0 commit comments

Comments
 (0)