Skip to content

Commit b8f332b

Browse files
committed
switched to dev.zacsweers.kctfork for k2 kotlin-compile-testing
1 parent 5d92e20 commit b8f332b

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ plugin-publish = "1.3.0"
5353
shadow = "8.3.5"
5454
android-gradle-api = "7.3.1" # need to revise our tests to update
5555
ktor = "3.0.1" # needs jupyter compatibility with Kotlin 2.1 to update
56-
kotlin-compile-testing = "1.6.0"
56+
kotlin-compile-testing = "0.7.1"
5757
duckdb = "1.1.3"
5858
buildconfig = "5.6.7"
5959
benchmark = "0.4.12"
@@ -152,8 +152,8 @@ android-gradle = { group = "com.android.tools.build", name = "gradle", version.r
152152
kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin" }
153153
kotlin-gradle-plugin-api = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin-api" }
154154
ktor-server-netty = { group = "io.ktor", name = "ktor-server-netty", version.ref = "ktor" }
155-
kotlin-compile-testing = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing", version.ref = "kotlin-compile-testing" }
156-
kotlin-compile-testing-ksp = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing-ksp", version.ref = "kotlin-compile-testing" }
155+
kotlin-compile-testing = { group = "dev.zacsweers.kctfork", name = "core", version.ref = "kotlin-compile-testing" }
156+
kotlin-compile-testing-ksp = { group = "dev.zacsweers.kctfork", name = "ksp", version.ref = "kotlin-compile-testing" }
157157
kotlin-compiler = { group = "org.jetbrains.kotlin", name = "kotlin-compiler", version.ref = "kotlin" }
158158
kotlin-compiler-embeddable = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-embeddable", version.ref = "kotlin" }
159159
kotlin-compiler-internal-test-framework = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-internal-test-framework", version.ref = "kotlin" }

plugins/symbol-processor/src/test/kotlin/org/jetbrains/dataframe/ksp/DataFrameSymbolProcessorTest.kt

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,11 +1218,6 @@ class DataFrameSymbolProcessorTest {
12181218
12191219
fun resolved() {
12201220
JetBrains
1221-
JetBrains1
1222-
JetBrains2
1223-
JetBrains3
1224-
JetBrains4
1225-
JetBrains5
12261221
}
12271222
""".trimIndent(),
12281223
),
@@ -1268,11 +1263,11 @@ class DataFrameSymbolProcessorTest {
12681263
)
12691264
println(result.kspGeneratedFiles)
12701265
result.inspectLines("MetricsNoKeyValue.Generated.kt") {
1271-
// (('1'..'5') + "").forEach { nr ->
1272-
// it.forAtLeastOne {
1273-
// it shouldContain "JetBrains$nr"
1274-
// }
1275-
// }
1266+
(('1'..'3') + "").forEach { nr ->
1267+
it.forAtLeastOne {
1268+
it shouldContain "MetricsNoKeyValue$nr"
1269+
}
1270+
}
12761271
}
12771272
}
12781273

plugins/symbol-processor/src/test/kotlin/org/jetbrains/dataframe/ksp/runner/KspCompilationTestRunner.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
package org.jetbrains.dataframe.ksp.runner
44

5+
import com.tschuchort.compiletesting.JvmCompilationResult
56
import com.tschuchort.compiletesting.KotlinCompilation
67
import com.tschuchort.compiletesting.SourceFile
7-
import com.tschuchort.compiletesting.kspArgs
8+
import com.tschuchort.compiletesting.kspProcessorOptions
89
import com.tschuchort.compiletesting.kspSourcesDir
910
import com.tschuchort.compiletesting.symbolProcessorProviders
11+
import com.tschuchort.compiletesting.useKsp2
1012
import org.jetbrains.dataframe.ksp.DataFrameSymbolProcessorProvider
1113
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
1214
import java.io.ByteArrayOutputStream
@@ -15,7 +17,7 @@ import java.nio.file.Paths
1517

1618
@Suppress("unused")
1719
internal class KotlinCompileTestingCompilationResult(
18-
val delegate: KotlinCompilation.Result,
20+
val delegate: JvmCompilationResult,
1921
val successfulCompilation: Boolean,
2022
val kspGeneratedFiles: List<File>,
2123
val outputSourceDirs: List<File>,
@@ -43,8 +45,14 @@ internal object KspCompilationTestRunner {
4345
classpaths = params.classpath,
4446
tempDir = compilationDir,
4547
)
46-
kspCompilation.kspArgs.putAll(params.options)
47-
kspCompilation.symbolProcessorProviders = listOf(DataFrameSymbolProcessorProvider())
48+
kspCompilation.kspProcessorOptions.putAll(params.options)
49+
50+
// We don't support KSP2, but because we target Kotlin 2.2 the tests only work if I set them up like this.
51+
kspCompilation.useKsp2()
52+
kspCompilation.kspProcessorOptions["ksp.useKSP2"] = "false"
53+
kspCompilation.kspProcessorOptions["useKSP2"] = "false"
54+
55+
kspCompilation.symbolProcessorProviders = mutableListOf(DataFrameSymbolProcessorProvider())
4856
kspCompilation.compile().also {
4957
println(it.messages)
5058
if (it.exitCode == KotlinCompilation.ExitCode.COMPILATION_ERROR) {

0 commit comments

Comments
 (0)