From 37329d80ddb63434ef8f2916144e66c92131de75 Mon Sep 17 00:00:00 2001 From: Ralf Wondratschek Date: Fri, 25 Oct 2024 12:37:40 -0700 Subject: [PATCH] Disable KSP2 Disable KSP2 again as there are still subtle bugs such as: https://github.com/evant/kotlin-inject/issues/447 --- .../amazon/lastmile/kotlin/inject/anvil/Compilation.kt | 10 ++++++++-- gradle.properties | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/src/test/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt b/compiler/src/test/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt index d8f19f1..1e61e7d 100644 --- a/compiler/src/test/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt +++ b/compiler/src/test/kotlin/software/amazon/lastmile/kotlin/inject/anvil/Compilation.kt @@ -34,6 +34,7 @@ class Compilation internal constructor( fun configureKotlinInjectAnvilProcessor( processorOptions: Map = emptyMap(), symbolProcessorProviders: Set = emptySet(), + useKsp2: Boolean = true, ): Compilation = apply { checkNotCompiled() check(!processorsConfigured) { "Processor should not be configured twice." } @@ -41,7 +42,11 @@ class Compilation internal constructor( processorsConfigured = true with(kotlinCompilation) { - configureKsp(useKsp2 = true) { + if (!useKsp2) { + languageVersion = "1.9" + } + + configureKsp(useKsp2 = useKsp2) { this.symbolProcessorProviders += ServiceLoader.load( SymbolProcessorProvider::class.java, SymbolProcessorProvider::class.java.classLoader, @@ -138,6 +143,7 @@ fun compile( workingDir: File? = null, previousCompilationResult: JvmCompilationResult? = null, moduleName: String? = null, + useKsp2: Boolean = true, exitCode: KotlinCompilation.ExitCode = KotlinCompilation.ExitCode.OK, block: JvmCompilationResult.() -> Unit = { }, ): JvmCompilationResult { @@ -158,7 +164,7 @@ fun compile( addPreviousCompilationResult(previousCompilationResult) } } - .configureKotlinInjectAnvilProcessor() + .configureKotlinInjectAnvilProcessor(useKsp2 = useKsp2) .compile(*sources) .also { if (exitCode == KotlinCompilation.ExitCode.OK) { diff --git a/gradle.properties b/gradle.properties index e71a8f8..43a63eb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.caching=true kotlin.code.style=official kotlin.mpp.stability.nowarn=true -ksp.useKSP2=true +ksp.useKSP2=false # This property does not work when setting up publishing through the DSL as we do. # SONATYPE_AUTOMATIC_RELEASE=true