Skip to content

Commit

Permalink
Update tests to work with Gradle 7.4 and newer versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jjohannes committed Jun 4, 2024
1 parent 55958e6 commit 891df94
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class CustomizationTest extends Specification {
javaModuleTesting.whitebox(testing.suites.getByName<JvmTestSuite>("test") {
targets.all {
testTask {
usesService(gradle.sharedServices.registerIfAbsent(TaskLockService.NAME, TaskLockService::class) { maxParallelUsages = 1 })
usesService(gradle.sharedServices.registerIfAbsent(TaskLockService.NAME, TaskLockService::class) { maxParallelUsages.set(1) })
}
}
}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class GradleBuild {
this.libBuildFile = file("lib/build.gradle.kts")
this.libModuleInfoFile = file("lib/src/main/java/module-info.java")

def launcherDependency = gradleVersionUnderTest == '7.4' ?
'testRuntimeOnly("org.junit.platform:junit-platform-launcher")' : ''

settingsFile << '''
pluginManagement {
plugins { id("org.gradlex.java-module-dependencies") version "1.5.2" }
Expand All @@ -39,20 +42,21 @@ class GradleBuild {
rootProject.name = "test-project"
include("app", "lib")
'''
appBuildFile << '''
appBuildFile << """
plugins {
id("org.gradlex.java-module-testing")
id("application")
}
group = "org.example"
dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.0"))
$launcherDependency
}
application {
mainModule.set("org.example.app")
mainClass.set("org.example.app.Main")
}
'''
"""
file("app/src/main/java/org/example/app/Main.java") << '''
package org.example.app;
Expand Down

0 comments on commit 891df94

Please sign in to comment.