Skip to content

Commit

Permalink
WIP: KSP2
Browse files Browse the repository at this point in the history
  • Loading branch information
eygraber committed Jul 11, 2024
1 parent eac8619 commit baa94ce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 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
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
kotlin-inject = "0.7.2-SNAPSHOT"
kotlin = "2.0.0"
ksp = "2.0.0-1.0.22"
ksp = "2.0.0-1.0.23"
kotlinpoet = "1.16.0"
junit5 = "5.9.3"
detekt = "1.23.6"
Expand All @@ -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" }
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 baa94ce

Please sign in to comment.