Files
moshi/moshi-kotlin-tests/build.gradle.kts
renovate[bot] c11f0e168c Update kotlin monorepo (#1614)
* Update kotlin monorepo

* Update ksp to v1.8.0-1.0.9

* Lower metadata to 0.5.0

* Update KCT

* Update to compilerOptions

* Suppress deprecation

* Add missing java target too

* Raise it again because it's broken on all

* Kotlin 1.8.20 + updated kotlinpoet

* Update kotlinpoet

* Update kotlin

* Fix KSP equality check for KotlinPoet 1.13.x

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <github@jakewharton.com>
Co-authored-by: Zac Sweers <pandanomic@gmail.com>
2023-05-05 18:04:57 -04:00

66 lines
1.5 KiB
Plaintext

import Build_gradle.TestMode.KAPT
import Build_gradle.TestMode.KSP
import Build_gradle.TestMode.REFLECT
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
kotlin("kapt") apply false
id("com.google.devtools.ksp") apply false
}
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 {
// 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.add(
"-opt-in=kotlin.ExperimentalStdlibApi",
)
}
}
dependencies {
when (testMode) {
REFLECT -> {
// Do nothing
}
KAPT -> {
"kaptTest"(project(":moshi-kotlin-codegen"))
}
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)
}