11package org.gradlex.javamodule.dependencies.test
22
3+ import org.gradle.util.GradleVersion
34import org.gradlex.javamodule.dependencies.test.fixture.GradleBuild
45import spock.lang.Specification
56
@@ -11,19 +12,20 @@ class ConfigurationCacheTest extends Specification {
1112 def " configurationCacheHit" () {
1213 given :
1314 libModuleInfoFile << ' module abc.lib { }'
15+
1416 appModuleInfoFile << '''
1517 module abc.app {
1618 requires abc.lib;
1719 }
1820 '''
1921
2022
21- def runner = runner(' :app:compileJava' )
23+ def runner = runner(' --configuration-cache ' , ' :app:compileJava' )
2224 when :
2325 def result = runner. build()
2426
2527 then :
26- result. getOutput(). contains(" Calculating task graph as no cached configuration is available for tasks: :app:compileJava " )
28+ result. getOutput(). contains(getNoCacheMessage() )
2729
2830 when :
2931 result = runner. build()
@@ -32,6 +34,23 @@ class ConfigurationCacheTest extends Specification {
3234 result. getOutput(). contains(" Reusing configuration cache." )
3335 }
3436
37+ private String getNoCacheMessage () {
38+ if (getVersionTest() >= GradleVersion . version(" 8.8" )) {
39+ return " Calculating task graph as no cached configuration is available for tasks: :app:compileJava"
40+ } else {
41+ return " Calculating task graph as no configuration cache is available for tasks: :app:compileJava"
42+ }
43+
44+
45+ }
46+
47+ private GradleVersion getVersionTest () {
48+ if (gradleVersionUnderTest == null ) {
49+ return GradleVersion . current()
50+ }
51+ return GradleVersion . version(gradleVersionUnderTest)
52+ }
53+
3554 def " configurationCacheHitIrrelevantChange" () {
3655 libModuleInfoFile << ' module abc.lib { }'
3756 appModuleInfoFile << '''
@@ -40,12 +59,12 @@ class ConfigurationCacheTest extends Specification {
4059 }
4160 '''
4261
43- def runner = runner(' :app:compileJava' )
62+ def runner = runner(' --configuration-cache ' , ' :app:compileJava' )
4463 when :
4564 def result = runner. build()
4665
4766 then :
48- result. getOutput(). contains(" Calculating task graph as no cached configuration is available for tasks: :app:compileJava " )
67+ result. getOutput(). contains(getNoCacheMessage() )
4968
5069 when :
5170 appModuleInfoFile. write('''
@@ -68,12 +87,12 @@ class ConfigurationCacheTest extends Specification {
6887 }
6988 '''
7089
71- def runner = runner(' :app:compileJava' )
90+ def runner = runner(' --configuration-cache ' , ' :app:compileJava' )
7291 when :
7392 def result = runner. build()
7493
7594 then :
76- result. getOutput(). contains(" Calculating task graph as no cached configuration is available for tasks: :app:compileJava " )
95+ result. getOutput(). contains(getNoCacheMessage() )
7796
7897 when :
7998 appModuleInfoFile. write('''
0 commit comments