Skip to content

Commit b10de93

Browse files
authored
Maintenance work (#369)
* Gradle 8.13 for instrumentation * Update all dependencies except for Kotlin 2.x * Clean unused utility functions * Dokka 2 * Revert AGP 8.10 Alpha 8 (it's broken) * Bump snapshots * compileSdk=35 and fix debug variant of internal testutil
1 parent 06aff8c commit b10de93

File tree

12 files changed

+65
-93
lines changed

12 files changed

+65
-93
lines changed

Diff for: build-logic/src/main/kotlin/Dependencies.kt

+9-7
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,31 @@
22

33
object libs {
44
object versions {
5-
const val kotlin = "1.9.25"
5+
const val kotlin = "1.9.25" // Can only once minimum supported AGP is >= 8.2
66
const val junitJupiter = "5.12.0"
77
const val junitVintage = "5.12.0"
88
const val junitPlatform = "1.12.0"
99

10-
const val composeBom = "2024.09.00"
10+
const val composeBom = "2025.03.00"
11+
const val androidXMultidex = "2.0.1"
1112
const val androidXTestAnnotation = "1.0.1"
1213
const val androidXTestCore = "1.6.1"
1314
const val androidXTestMonitor = "1.7.2"
1415
const val androidXTestRunner = "1.6.2"
1516
const val composeCompiler = "1.5.15"
1617

17-
const val activityCompose = "1.9.0"
18+
const val activityCompose = "1.10.1"
1819
const val apiGuardian = "1.1.2"
19-
const val coroutines = "1.8.1"
20-
const val dokka = "1.9.20"
20+
const val coroutines = "1.8.1" // Can only update once minimum supported AGP is >= 8.2
21+
const val dokka = "2.0.0"
2122
const val espresso = "3.6.1"
2223
const val javaSemver = "0.10.2"
2324
const val junit4 = "4.13.2"
2425
const val konfToml = "1.1.2"
2526
const val korte = "2.4.12"
26-
const val mockitoCore = "5.12.0"
27+
const val mockitoCore = "5.16.0"
2728
const val mockitoKotlin = "5.4.0"
28-
const val robolectric = "4.13"
29+
const val robolectric = "4.14.1"
2930
const val shadow = "8.1.1"
3031
const val truth = "1.4.4"
3132
}
@@ -76,6 +77,7 @@ object libs {
7677
const val truthJava8Extensions = "com.google.truth.extensions:truth-java8-extension:${versions.truth}"
7778
const val robolectric = "org.robolectric:robolectric:${versions.robolectric}"
7879

80+
const val androidXMultidex = "androidx.multidex:multidex:${versions.androidXMultidex}"
7981
const val androidXTestAnnotation = "androidx.test:annotation:${versions.androidXTestAnnotation}"
8082
const val androidXTestCore = "androidx.test:core:${versions.androidXTestCore}"
8183
const val androidXTestMonitor = "androidx.test:monitor:${versions.androidXTestMonitor}"

Diff for: build-logic/src/main/kotlin/Deployment.kt

+10-6
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import org.gradle.api.publish.PublishingExtension
1111
import org.gradle.api.publish.maven.MavenPublication
1212
import org.gradle.api.tasks.SourceSet
1313
import org.gradle.api.tasks.SourceSetContainer
14-
import org.gradle.configurationcache.extensions.capitalized
14+
import org.gradle.api.tasks.TaskProvider
1515
import org.gradle.jvm.tasks.Jar
16+
import org.gradle.kotlin.dsl.register
1617
import org.gradle.kotlin.dsl.support.uppercaseFirstChar
1718
import org.gradle.kotlin.dsl.withGroovyBuilder
1819
import org.gradle.plugins.signing.Sign
@@ -43,7 +44,7 @@ fun Project.configureDeployment(deployConfig: Deployed) {
4344
}
4445

4546
// Create artifact tasks
46-
val androidSourcesJar = tasks.create("androidSourcesJar", Jar::class.java) {
47+
val androidSourcesJar = tasks.register<Jar>("androidSourcesJar") {
4748
archiveClassifier.set("sources")
4849

4950
if (isAndroid) {
@@ -55,9 +56,12 @@ fun Project.configureDeployment(deployConfig: Deployed) {
5556
}
5657
}
5758

58-
val javadocJar = tasks.create("javadocJar", Jar::class.java) {
59-
from(tasks.getByName("dokkaHtml"))
59+
val javadocJar = tasks.register<Jar>("javadocJar") {
6060
archiveClassifier.set("javadoc")
61+
62+
// Connect to Dokka for generation of docs
63+
from(layout.buildDirectory.dir("dokka/html"))
64+
dependsOn("dokkaGenerate")
6165
}
6266

6367
artifacts {
@@ -158,8 +162,8 @@ private fun MavenPublication.applyPublicationDetails(
158162
project: Project,
159163
deployConfig: Deployed,
160164
isAndroid: Boolean,
161-
androidSourcesJar: Jar,
162-
javadocJar: Jar
165+
androidSourcesJar: TaskProvider<Jar>,
166+
javadocJar: TaskProvider<Jar>
163167
) = also {
164168
groupId = deployConfig.groupId
165169
artifactId = deployConfig.artifactId

Diff for: build-logic/src/main/kotlin/Environment.kt

+5-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ enum class SupportedAgp(
1818
AGP_8_7("8.7.3", gradle = "8.9"),
1919
AGP_8_8("8.8.2", gradle = "8.10.2"),
2020
AGP_8_9("8.9.0", gradle = "8.11.1"),
21-
AGP_8_10("8.10.0-alpha08", gradle = "8.11.1"),
21+
AGP_8_10("8.10.0-alpha07", gradle = "8.11.1"),
2222
;
2323

2424
companion object {
@@ -40,15 +40,14 @@ enum class SupportedAgp(
4040
}
4141

4242
object Android {
43-
const val compileSdkVersion = 34
44-
const val targetSdkVersion = 34
43+
const val compileSdkVersion = 35
44+
const val targetSdkVersion = 35
4545
const val sampleMinSdkVersion = 21
4646
val testRunnerMinSdkVersion = (Artifacts.Instrumentation.Runner.platform as Android).minSdk
4747
val testCoreMinSdkVersion = (Artifacts.Instrumentation.Core.platform as Android).minSdk
4848
val testComposeMinSdkVersion = (Artifacts.Instrumentation.Compose.platform as Android).minSdk
4949
}
5050

51-
5251
sealed class Platform(val name: String) {
5352
object Java : Platform("java")
5453
class Android(val minSdk: Int) : Platform("android")
@@ -91,7 +90,7 @@ object Artifacts {
9190
platform = Java,
9291
groupId = "de.mannodermaus.gradle.plugins",
9392
artifactId = "android-junit5",
94-
currentVersion = "1.12.0.1-SNAPSHOT",
93+
currentVersion = "1.12.1.0-SNAPSHOT",
9594
latestStableVersion = "1.12.0.0",
9695
description = "Unit Testing with JUnit 5 for Android."
9796
)
@@ -101,7 +100,7 @@ object Artifacts {
101100
*/
102101
object Instrumentation {
103102
const val groupId = "de.mannodermaus.junit5"
104-
private const val currentVersion = "1.7.1-SNAPSHOT"
103+
private const val currentVersion = "1.8.0-SNAPSHOT"
105104
private const val latestStableVersion = "1.7.0"
106105

107106
val Core = Deployed(

Diff for: build-logic/src/main/kotlin/Utilities.kt

+23-60
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import org.gradle.api.Action
21
import org.gradle.api.Project
32
import org.gradle.api.artifacts.dsl.RepositoryHandler
4-
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
53
import org.gradle.api.file.DirectoryProperty
64
import org.gradle.api.tasks.compile.AbstractCompile
75
import org.gradle.kotlin.dsl.withGroovyBuilder
@@ -12,32 +10,26 @@ import java.time.format.DateTimeFormatter
1210

1311
/* RepositoryHandler */
1412

15-
fun RepositoryHandler.jitpack() =
16-
this.maven(object: Action<MavenArtifactRepository> {
17-
override fun execute(repo: MavenArtifactRepository) {
18-
repo.setUrl("https://jitpack.io")
19-
}
20-
})
13+
fun RepositoryHandler.jitpack() = maven {
14+
setUrl("https://jitpack.io")
15+
}
2116

22-
fun RepositoryHandler.sonatypeSnapshots() =
23-
this.maven(object: Action<MavenArtifactRepository> {
24-
override fun execute(repo: MavenArtifactRepository) {
25-
repo.setUrl("https://oss.sonatype.org/content/repositories/snapshots")
26-
}
27-
})
17+
fun RepositoryHandler.sonatypeSnapshots() = maven {
18+
setUrl("https://oss.sonatype.org/content/repositories/snapshots")
19+
}
2820

2921
/* Project */
3022

3123
fun Project.fixCompileTaskChain() {
32-
setupCompileChain(
33-
sourceCompileName = "compileKotlin",
34-
targetCompileName = "compileGroovy"
35-
)
36-
37-
setupCompileChain(
38-
sourceCompileName = "compileTestKotlin",
39-
targetCompileName = "compileTestGroovy"
40-
)
24+
setupCompileChain(
25+
sourceCompileName = "compileKotlin",
26+
targetCompileName = "compileGroovy"
27+
)
28+
29+
setupCompileChain(
30+
sourceCompileName = "compileTestKotlin",
31+
targetCompileName = "compileTestGroovy"
32+
)
4133
}
4234

4335
/**
@@ -48,41 +40,12 @@ private fun Project.setupCompileChain(
4840
sourceCompileName: String,
4941
targetCompileName: String
5042
) {
51-
val targetCompile = tasks.getByName(targetCompileName) as AbstractCompile
52-
val sourceCompile = tasks.getByName(sourceCompileName)
53-
54-
// Allow calling the source language's classes from the target language.
55-
// In this case, we allow calling Kotlin from Groovy - it has to be noted however,
56-
// that the other way does not work!
57-
val sourceDir = sourceCompile.withGroovyBuilder { getProperty("destinationDirectory") } as DirectoryProperty
58-
targetCompile.classpath += project.files(sourceDir.get().asFile)
59-
}
60-
61-
/**
62-
* Provides a dependency object to the JUnit 5 plugin, if any can be found.
63-
* This will look in the build folder of the sibling project to try and find
64-
* a previously built "fat JAR", and return it in a format
65-
* compatible to the Gradle dependency mechanism. If no file can be found,
66-
* this method returns null instead.
67-
*/
68-
fun Project.findLocalPluginJar(): File? {
69-
val localLibsFolder = rootDir.parentFile.toPath()
70-
.resolve("plugin/android-junit5/build/libs")
71-
.toFile()
72-
73-
val localPluginJar = (localLibsFolder.listFiles() ?: emptyArray<File>())
74-
.sortedByDescending(File::lastModified)
75-
.firstOrNull { "fat" in it.name && "javadoc" !in it.name && "sources" !in it.name }
76-
77-
return localPluginJar
43+
val targetCompile = tasks.getByName(targetCompileName) as AbstractCompile
44+
val sourceCompile = tasks.getByName(sourceCompileName)
45+
46+
// Allow calling the source language's classes from the target language.
47+
// In this case, we allow calling Kotlin from Groovy - it has to be noted however,
48+
// that the other way does not work!
49+
val sourceDir = sourceCompile.withGroovyBuilder { getProperty("destinationDirectory") } as DirectoryProperty
50+
targetCompile.classpath += project.files(sourceDir.get().asFile)
7851
}
79-
80-
/* File */
81-
82-
/**
83-
* Format the "last modified" timestamp of a file into a human readable string.
84-
*/
85-
fun File.lastModifiedDate(): String =
86-
Instant.ofEpochMilli(lastModified())
87-
.atZone(ZoneId.systemDefault())
88-
.format(DateTimeFormatter.ISO_DATE_TIME)

Diff for: instrumentation/gradle.properties

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
android.useAndroidX = true
2-
org.gradle.jvmargs = -XX:MaxMetaspaceSize=512m
2+
org.gradle.jvmargs = -XX:MetaspaceSize=1g -XX:MaxMetaspaceSize=1g
3+
4+
# Dokka V2 (https://kotlinlang.org/docs/dokka-migration.html)
5+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
6+
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

Diff for: instrumentation/gradle/wrapper/gradle-wrapper.jar

122 Bytes
Binary file not shown.

Diff for: instrumentation/gradle/wrapper/gradle-wrapper.properties

+1-1
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.10.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

Diff for: instrumentation/gradlew

+2-3
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum
@@ -206,7 +205,7 @@ fi
206205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207206

208207
# Collect all arguments for the java command:
209-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210209
# and any embedded shellness will be escaped.
211210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212211
# treated as '${Hostname}' itself on the command line.

Diff for: instrumentation/testutil/build.gradle.kts

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ android {
1414
compileSdk = Android.compileSdkVersion
1515

1616
defaultConfig {
17-
minSdk = 4
17+
minSdk = 19
18+
multiDexEnabled = true
1819
}
1920

2021
compileOptions {
@@ -58,6 +59,7 @@ tasks.withType<Test> {
5859

5960
dependencies {
6061
implementation(project(":testutil-reflect"))
62+
implementation(libs.androidXMultidex)
6163

6264
api(libs.androidXTestMonitor)
6365
api(libs.truth)

Diff for: plugin/android-junit5/build.gradle.kts

+1-5
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ sourceSets {
8787
kotlin.srcDir(genFolder)
8888
}
8989
}
90-
tasks.withType<DokkaTask> {
91-
// Connect additional source folder to Dokka generation task
92-
dependsOn(versionClassTask)
93-
}
9490

9591
// ------------------------------------------------------------------------------------------------
9692
// Dependency Definitions
@@ -120,7 +116,7 @@ dependencies {
120116
project.configureDeployment(Artifacts.Plugin)
121117

122118
// Register source-processing tasks as dependants of the custom source generation task
123-
listOf("compileKotlin", "androidSourcesJar", "dokkaJavadoc").forEach { taskName ->
119+
listOf("compileKotlin", "androidSourcesJar", "dokkaGeneratePublicationHtml").forEach { taskName ->
124120
tasks.named(taskName).configure {
125121
dependsOn(versionClassTask)
126122
}

Diff for: plugin/android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/internal/utils/Functions.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ internal fun requireGradle(version: String, message: () -> String) {
1616
}
1717

1818
internal fun requireVersion(actual: String, required: String, message: () -> String) {
19-
val actualVersion = Version.valueOf(actual)
20-
val requiredVersion = Version.valueOf(required)
21-
require(actualVersion.greaterThanOrEqualTo(requiredVersion)) {
19+
val actualVersion = Version.parse(actual)
20+
val requiredVersion = Version.parse(required)
21+
require(actualVersion.isHigherThanOrEquivalentTo(requiredVersion)) {
2222
throw GradleException(message())
2323
}
2424
}

Diff for: plugin/gradle.properties

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Dokka V2 (https://kotlinlang.org/docs/dokka-migration.html)
2+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
3+
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

0 commit comments

Comments
 (0)