Skip to content

Commit

Permalink
Merge pull request #59 from amzn/rwo/ksp2
Browse files Browse the repository at this point in the history
Disable KSP2
  • Loading branch information
vRallev authored Oct 25, 2024
2 parents 7f050d0 + 37329d8 commit afdfcd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ class Compilation internal constructor(
fun configureKotlinInjectAnvilProcessor(
processorOptions: Map<String, String> = emptyMap(),
symbolProcessorProviders: Set<SymbolProcessorProvider> = emptySet(),
useKsp2: Boolean = true,
): Compilation = apply {
checkNotCompiled()
check(!processorsConfigured) { "Processor should not be configured twice." }

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,
Expand Down Expand Up @@ -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 {
Expand All @@ -158,7 +164,7 @@ fun compile(
addPreviousCompilationResult(previousCompilationResult)
}
}
.configureKotlinInjectAnvilProcessor()
.configureKotlinInjectAnvilProcessor(useKsp2 = useKsp2)
.compile(*sources)
.also {
if (exitCode == KotlinCompilation.ExitCode.OK) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afdfcd1

Please sign in to comment.