mirror of
https://github.com/fankes/moshi.git
synced 2025-10-20 00:19:21 +08:00
Parameterize kotlin test infra on CI (#1407)
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Build_gradle.TestMode.KAPT
|
||||
import Build_gradle.TestMode.KSP
|
||||
import Build_gradle.TestMode.REFLECT
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
@@ -22,11 +25,24 @@ plugins {
|
||||
id("com.google.devtools.ksp") apply false
|
||||
}
|
||||
|
||||
val useKsp = hasProperty("useKsp")
|
||||
if (useKsp) {
|
||||
apply(plugin = "com.google.devtools.ksp")
|
||||
} else {
|
||||
apply(plugin = "org.jetbrains.kotlin.kapt")
|
||||
enum class TestMode {
|
||||
REFLECT, KAPT, KSP
|
||||
}
|
||||
|
||||
val testMode = findProperty("kotlinTestMode")?.toString()
|
||||
?.let(TestMode::valueOf)
|
||||
?: REFLECT
|
||||
|
||||
when (testMode) {
|
||||
REFLECT -> {
|
||||
// Do nothing!
|
||||
}
|
||||
KAPT -> {
|
||||
apply(plugin = "org.jetbrains.kotlin.kapt")
|
||||
}
|
||||
KSP -> {
|
||||
apply(plugin = "com.google.devtools.ksp")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
@@ -48,10 +64,16 @@ tasks.withType<KotlinCompile>().configureEach {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
if (useKsp) {
|
||||
"kspTest"(project(":kotlin:codegen"))
|
||||
} else {
|
||||
"kaptTest"(project(":kotlin:codegen"))
|
||||
when (testMode) {
|
||||
REFLECT -> {
|
||||
// Do nothing
|
||||
}
|
||||
KAPT -> {
|
||||
"kaptTest"(project(":kotlin:codegen"))
|
||||
}
|
||||
KSP -> {
|
||||
"kspTest"(project(":kotlin:codegen"))
|
||||
}
|
||||
}
|
||||
testImplementation(project(":moshi"))
|
||||
testImplementation(project(":kotlin:reflect"))
|
||||
|
Reference in New Issue
Block a user