Skip to content

Commit 891df94

Browse files
committed
Update tests to work with Gradle 7.4 and newer versions
1 parent 55958e6 commit 891df94

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/test/groovy/org/gradlex/javamodule/testing/test/CustomizationTest.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class CustomizationTest extends Specification {
8484
javaModuleTesting.whitebox(testing.suites.getByName<JvmTestSuite>("test") {
8585
targets.all {
8686
testTask {
87-
usesService(gradle.sharedServices.registerIfAbsent(TaskLockService.NAME, TaskLockService::class) { maxParallelUsages = 1 })
87+
usesService(gradle.sharedServices.registerIfAbsent(TaskLockService.NAME, TaskLockService::class) { maxParallelUsages.set(1) })
8888
}
8989
}
9090
}) {

src/test/groovy/org/gradlex/javamodule/testing/test/fixture/GradleBuild.groovy

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ class GradleBuild {
3030
this.libBuildFile = file("lib/build.gradle.kts")
3131
this.libModuleInfoFile = file("lib/src/main/java/module-info.java")
3232

33+
def launcherDependency = gradleVersionUnderTest == '7.4' ?
34+
'testRuntimeOnly("org.junit.platform:junit-platform-launcher")' : ''
35+
3336
settingsFile << '''
3437
pluginManagement {
3538
plugins { id("org.gradlex.java-module-dependencies") version "1.5.2" }
@@ -39,20 +42,21 @@ class GradleBuild {
3942
rootProject.name = "test-project"
4043
include("app", "lib")
4144
'''
42-
appBuildFile << '''
45+
appBuildFile << """
4346
plugins {
4447
id("org.gradlex.java-module-testing")
4548
id("application")
4649
}
4750
group = "org.example"
4851
dependencies {
4952
testImplementation(platform("org.junit:junit-bom:5.9.0"))
53+
$launcherDependency
5054
}
5155
application {
5256
mainModule.set("org.example.app")
5357
mainClass.set("org.example.app.Main")
5458
}
55-
'''
59+
"""
5660
file("app/src/main/java/org/example/app/Main.java") << '''
5761
package org.example.app;
5862

0 commit comments

Comments
 (0)