@@ -4,6 +4,8 @@ import com.google.devtools.ksp.processing.CodeGenerator
4
4
import com.google.devtools.ksp.processing.KSPLogger
5
5
import com.google.devtools.ksp.processing.Resolver
6
6
import com.google.devtools.ksp.processing.SymbolProcessor
7
+ import org.jetbrains.kotlin.cli.common.KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY
8
+ import org.junit.Before
7
9
import org.junit.ClassRule
8
10
import org.junit.Rule
9
11
import org.junit.Test
@@ -30,13 +32,20 @@ class ProfilingTest(
30
32
}
31
33
}
32
34
35
+ @Before
36
+ fun setCompilerCache () {
37
+ val existingValue: String? = System .getProperty(KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY )
38
+ System .setProperty(
39
+ KOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY ,
40
+ if (testConfiguration.useCachedCompilerEnv) " true" else " false"
41
+ )
42
+ }
43
+
33
44
private fun newKotlinCompilation () = KotlinCompilation ().apply {
34
45
when (testConfiguration.processorType) {
35
46
ProcessorType .KAPT -> annotationProcessors = listOf (DoNothingKapt ())
36
47
ProcessorType .KSP -> symbolProcessors = listOf (DonothingKsp ())
37
48
}
38
- useCachedHostClasspath = testConfiguration.enableClasspathCache
39
- useMyClasspath = testConfiguration.useGoogleCompileTestingClasspath
40
49
verbose = false
41
50
}
42
51
@@ -109,24 +118,9 @@ class ProfilingTest(
109
118
110
119
data class TestConfiguration (
111
120
val processorType : ProcessorType ,
112
- val enableClasspathCache : Boolean ,
113
- val useGoogleCompileTestingClasspath : Boolean ,
121
+ val useCachedCompilerEnv : Boolean
114
122
) {
115
- companion object {
116
- fun buildVariations (): List <TestConfiguration > {
117
- return ProcessorType .values().flatMap { processorType ->
118
- arrayOf(true , false ).flatMap { enableClasspathCache ->
119
- arrayOf(true , false ).map { useGoogleCompileTestingClasspath ->
120
- TestConfiguration (
121
- processorType = processorType,
122
- enableClasspathCache = enableClasspathCache,
123
- useGoogleCompileTestingClasspath = useGoogleCompileTestingClasspath
124
- )
125
- }
126
- }
127
- }
128
- }
129
- }
123
+
130
124
}
131
125
132
126
companion object {
@@ -136,20 +130,11 @@ class ProfilingTest(
136
130
listOf (
137
131
TestConfiguration (
138
132
processorType = ProcessorType .KAPT ,
139
- enableClasspathCache = true ,
140
- useGoogleCompileTestingClasspath = false
141
- ),
142
- TestConfiguration (
143
- processorType = ProcessorType .KAPT ,
144
- enableClasspathCache = false ,
145
- useGoogleCompileTestingClasspath = false
146
- ),
147
- TestConfiguration (
148
- processorType = ProcessorType .KAPT ,
149
- enableClasspathCache = false ,
150
- useGoogleCompileTestingClasspath = true
133
+ useCachedCompilerEnv = false
151
134
)
152
135
)
136
+ }.flatMap {
137
+ listOf (it, it.copy(useCachedCompilerEnv = true ))
153
138
}
154
139
155
140
@get:ClassRule
0 commit comments