Skip to content

Commit

Permalink
Replace kotlin compile testing with a fork
Browse files Browse the repository at this point in the history
That follows Kotlin updates more frequently. This addresses `incompatible version of Kotlin` error.

Specify `-language-version` to `1.9` as higher version seems to influence which KSP is executed. Inspired by: https://github.com/square/moshi/blob/d88d91d8394f418fd47b182c841b9a3e3a3e0a0b/moshi-kotlin-codegen/src/test/java/com/squareup/moshi/kotlin/codegen/ksp/JsonClassSymbolProcessorTest.kt#L856
  • Loading branch information
wzieba committed Dec 11, 2024
1 parent cc33adc commit 631549d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jna = '5.15.0@aar'
json-path = '2.9.0'
jsoup = '1.18.3'
junit = '4.13.2'
kotlin-compile-testing = '1.6.0'
kotlin-compile-testing = '0.7.0'
kotlin-main = '2.1.0'
kotlinx-coroutines = '1.8.1'
kotlinx-kover = '0.7.6'
Expand Down Expand Up @@ -232,8 +232,8 @@ jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
json-path = { group = "com.jayway.jsonpath", name = "json-path", version.ref = "json-path" }
jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
kotlin-compile-testing-ksp = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing-ksp", version.ref = "kotlin-compile-testing" }
kotlin-compile-testing-main = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing", version.ref = "kotlin-compile-testing" }
kotlin-compile-testing-ksp = { group = "dev.zacsweers.kctfork", name = "ksp", version.ref = "kotlin-compile-testing" }
kotlin-compile-testing-main = { group = "dev.zacsweers.kctfork", name = "core", version.ref = "kotlin-compile-testing" }
kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin-main" }
kotlin-test-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin-main" }
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ package org.wordpress.android.processor

import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import com.tschuchort.compiletesting.kspWithCompilation
import com.tschuchort.compiletesting.symbolProcessorProviders
import com.tschuchort.compiletesting.configureKsp
import org.assertj.core.api.Assertions.assertThat
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.jetbrains.kotlin.utils.addToStdlib.UnsafeCastFunction
Expand Down Expand Up @@ -119,10 +118,14 @@ class RemoteConfigProcessorTest {

private fun compile(src: List<SourceFile>) = KotlinCompilation().apply {
sources = src + fakeAppConfig
symbolProcessorProviders = listOf(RemoteConfigProcessorProvider())
kspWithCompilation = true
inheritClassPath = true
verbose = true
messageOutputStream = System.out
configureKsp(useKsp2 = false) {
symbolProcessorProviders += RemoteConfigProcessorProvider()
withCompilation = true
languageVersion = "1.9"
}
}.compile()

// Fake AppConfig is needed, as it's a class that is expected to be present in the classpath. Originally, this class
Expand Down

0 comments on commit 631549d

Please sign in to comment.