11package io.github.cdsap.kotlinprocess
22
33import junit.framework.TestCase.assertTrue
4+ import org.gradle.internal.impldep.org.junit.Assume.assumeTrue
45import org.gradle.testkit.runner.GradleRunner
56import org.junit.Rule
67import org.junit.Test
@@ -40,7 +41,7 @@ class InfoKotlinProcessPluginTest {
4041 }
4142
4243 @Test
43- fun testPluginIsCompatibleWithConfigurationCache () {
44+ fun testPluginIsCompatibleWithConfigurationCacheWithoutGradleEnterprise () {
4445 testProjectDir.newFile(" build.gradle" ).appendText(
4546 """
4647 plugins {
@@ -57,13 +58,68 @@ class InfoKotlinProcessPluginTest {
5758 listOf (" 7.5.1" , " 7.6" ).forEach {
5859 val firstBuild = GradleRunner .create()
5960 .withProjectDir(testProjectDir.root)
60- .withArguments(" compileKotlin" , " --configuration-cache" , " --configuration-cache-problems=warn " )
61+ .withArguments(" compileKotlin" , " --configuration-cache" )
6162 .withPluginClasspath()
6263 .withGradleVersion(it)
6364 .build()
6465 val secondBuild = GradleRunner .create()
6566 .withProjectDir(testProjectDir.root)
66- .withArguments(" compileKotlin" , " --configuration-cache" , " --configuration-cache-problems=warn" )
67+ .withArguments(" compileKotlin" , " --configuration-cache" )
68+ .withPluginClasspath()
69+ .withGradleVersion(it)
70+ .build()
71+ assertTrue(firstBuild.output.contains(" Configuration cache entry stored" ))
72+ assertTrue(secondBuild.output.contains(" Configuration cache entry reused." ))
73+ }
74+ }
75+
76+
77+ @Test
78+ fun testPluginIsCompatibleWithConfigurationCacheWithGradleEnterprise () {
79+ assumeTrue(
80+ " Gradle Enterprise URL and Access Key are set" ,
81+ System .getenv(" GE_URL" ) != null && System .getenv(" GE_API_KEY" ) != null
82+ )
83+
84+ testProjectDir.newFile(" settings.gradle" ).appendText(
85+ """
86+ plugins {
87+ id 'com.gradle.enterprise' version '3.12.2'
88+ }
89+ gradleEnterprise {
90+ server = "${System .getenv(" GE_URL" )} "
91+ accessKey="${System .getenv(" GE_API_KEY" )} "
92+ buildScan {
93+ capture { taskInputFiles = true }
94+ publishAlways()
95+
96+ }
97+ }
98+ """ .trimIndent()
99+ )
100+ testProjectDir.newFile(" build.gradle" ).appendText(
101+ """
102+ plugins {
103+ id 'org.jetbrains.kotlin.jvm' version '1.7.21'
104+ id 'application'
105+ id 'io.github.cdsap.kotlinprocess'
106+ }
107+ repositories {
108+ mavenCentral()
109+ }
110+
111+ """ .trimIndent()
112+ )
113+ listOf (" 7.5.1" , " 7.6" ).forEach {
114+ val firstBuild = GradleRunner .create()
115+ .withProjectDir(testProjectDir.root)
116+ .withArguments(" compileKotlin" , " --configuration-cache" )
117+ .withPluginClasspath()
118+ .withGradleVersion(it)
119+ .build()
120+ val secondBuild = GradleRunner .create()
121+ .withProjectDir(testProjectDir.root)
122+ .withArguments(" compileKotlin" , " --configuration-cache" )
67123 .withPluginClasspath()
68124 .withGradleVersion(it)
69125 .build()
0 commit comments