Skip to content

Commit 674114f

Browse files
committed
Add junit-platform-launcher to runtime classpath
1 parent 6f2da7a commit 674114f

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

build-logic/src/main/kotlin/Tasks.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ fun Copy.configureCreateVersionClassTask(
166166
// Find an appropriate version of the instrumentation library,
167167
// depending on the version of how the plugin is configured
168168
"INSTRUMENTATION_VERSION" to instrumentationVersion,
169+
170+
// JUnit 5.12+ requires the platform launcher on the runtime classpath;
171+
// to prevent issues with version mismatching, the plugin applies this for users
172+
"JUNIT_PLATFORM_LAUNCHER" to libs.junitPlatformLauncher
169173
)
170174
), ReplaceTokens::class.java
171175
)

plugin/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Change Log
33

44
## Unreleased
55
- JUnit 5.12.0
6+
- Add dependency on JUnit Platform Launcher to runtime classpath, accommodating an upstream change
67

78
## 1.11.3.0 (2024-12-23)
89
- JUnit 5.11.3

plugin/android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/internal/configureJUnit5.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,15 @@ private fun AndroidJUnitPlatformExtension.attachDependencies(
148148
includeRunner: Boolean,
149149
) {
150150
if (project.usesJUnitJupiterIn(configurationName)) {
151+
val runtimeOnlyConfigurationName = configurationName.replace("Implementation", "RuntimeOnly")
151152
val version = instrumentationTests.version.get()
152153

154+
project.dependencies.add(runtimeOnlyConfigurationName, Libraries.junitPlatformLauncher)
153155
project.dependencies.add(configurationName, "${Libraries.instrumentationCore}:$version")
154156

155157
if (includeRunner) {
156158
project.dependencies.add(
157-
configurationName.replace("Implementation", "RuntimeOnly"),
159+
runtimeOnlyConfigurationName,
158160
"${Libraries.instrumentationRunner}:$version",
159161
)
160162
}

plugin/android-junit5/src/main/templates/Libraries.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ internal object Libraries {
66
const val instrumentationCore = "@INSTRUMENTATION_GROUP@:@INSTRUMENTATION_CORE@"
77
const val instrumentationExtensions = "@INSTRUMENTATION_GROUP@:@INSTRUMENTATION_EXTENSIONS@"
88
const val instrumentationRunner = "@INSTRUMENTATION_GROUP@:@INSTRUMENTATION_RUNNER@"
9+
10+
const val junitPlatformLauncher = "@JUNIT_PLATFORM_LAUNCHER@"
911
}

0 commit comments

Comments
 (0)