Skip to content

Commit

Permalink
WIP: KSP2
Browse files Browse the repository at this point in the history
  • Loading branch information
eygraber committed May 17, 2024
1 parent 12d4edf commit cf5f95e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ org.gradle.parallel=true
kotlin.mpp.stability.nowarn=true
kotlin.native.ignoreDisabledTargets=true
org.gradle.jvmargs=-Xmx4G
ksp.useKSP2=false
ksp.useKSP2=true
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting",
ksp = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-compile-testing = { module = "dev.zacsweers.kctfork:ksp", version = "0.4.1" }
kotlin-compile-testing = { module = "dev.zacsweers.kctfork:ksp", version = "0.5.0-alpha07" }
kotlin-metadata-jvm = { module = "org.jetbrains.kotlin:kotlin-metadata-jvm", version.ref = "kotlin" }
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.8.0" }
kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version = "0.23.2" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.google.devtools.ksp.processing.SymbolProcessorProvider
import com.tschuchort.compiletesting.CompilationResult
import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import com.tschuchort.compiletesting.kspArgs
import com.tschuchort.compiletesting.kspProcessorOptions
import com.tschuchort.compiletesting.kspWithCompilation
import com.tschuchort.compiletesting.symbolProcessorProviders
import me.tatarka.inject.compiler.Options
Expand Down Expand Up @@ -47,7 +47,7 @@ class ProjectCompiler(
sources = sourceFiles
when (target) {
Target.KSP -> {
options?.toMap()?.let { kspArgs.putAll(it) }
options?.toMap()?.let { kspProcessorOptions.putAll(it) }
symbolProcessorProviders = mutableListOf<SymbolProcessorProvider>().apply {
add(InjectProcessorProvider())
addAll(symbolProcessors)
Expand Down Expand Up @@ -107,5 +107,6 @@ class TestCompilationResult(private val result: CompilationResult) {
val success: Boolean
get() = result.exitCode == KotlinCompilation.ExitCode.OK

@OptIn(ExperimentalCompilerApi::class)
fun output(kind: Diagnostic.Kind): String = result.messages.filterByKind(kind)
}

0 comments on commit cf5f95e

Please sign in to comment.