mirror of
https://github.com/fankes/moshi.git
synced 2025-10-18 23:49:21 +08:00
* Kotlin 2.1 and friends * fix kotlin 2.1 aliases nullability (#1982) --------- Co-authored-by: Florian LE FICHER <florian.leficher@gmail.com>
62 lines
1.4 KiB
Plaintext
62 lines
1.4 KiB
Plaintext
import Build_gradle.TestMode.KSP
|
|
import Build_gradle.TestMode.REFLECT
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
plugins {
|
|
kotlin("jvm")
|
|
id("com.google.devtools.ksp") apply false
|
|
}
|
|
|
|
enum class TestMode {
|
|
REFLECT,
|
|
KSP,
|
|
}
|
|
|
|
val testMode =
|
|
findProperty("kotlinTestMode")
|
|
?.toString()
|
|
?.let(TestMode::valueOf)
|
|
?: REFLECT
|
|
|
|
when (testMode) {
|
|
REFLECT -> {
|
|
// Do nothing!
|
|
}
|
|
KSP -> {
|
|
apply(plugin = "com.google.devtools.ksp")
|
|
}
|
|
}
|
|
|
|
tasks.withType<Test>().configureEach {
|
|
// ExtendsPlatformClassWithProtectedField tests a case where we set a protected ByteArrayOutputStream.buf field
|
|
jvmArgs("--add-opens=java.base/java.io=ALL-UNNAMED")
|
|
}
|
|
|
|
tasks.withType<KotlinCompile>().configureEach {
|
|
compilerOptions {
|
|
allWarningsAsErrors.set(true)
|
|
freeCompilerArgs.addAll(
|
|
"-opt-in=kotlin.ExperimentalStdlibApi",
|
|
"-Xannotation-default-target=param-property",
|
|
)
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
when (testMode) {
|
|
REFLECT -> {
|
|
// Do nothing
|
|
}
|
|
KSP -> {
|
|
"kspTest"(project(":moshi-kotlin-codegen"))
|
|
}
|
|
}
|
|
testImplementation(project(":moshi"))
|
|
testImplementation(project(":moshi-kotlin"))
|
|
testImplementation(project(":moshi-kotlin-tests:extra-moshi-test-module"))
|
|
testImplementation(kotlin("reflect"))
|
|
testImplementation(libs.junit)
|
|
testImplementation(libs.assertj)
|
|
testImplementation(libs.truth)
|
|
}
|