Files
moshi/moshi-kotlin-tests/build.gradle.kts
renovate[bot] 7ea4ecabfe Update dependency com.pinterest.ktlint:ktlint-cli to v1.3.0 (#1853)
* Update dependency com.pinterest.ktlint:ktlint-cli to v1.3.0

* Disable expression rule

* Reformat

* Whatever

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jake Wharton <jw@squareup.com>
2024-06-21 23:35:34 -04:00

61 lines
1.3 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.add(
"-opt-in=kotlin.ExperimentalStdlibApi",
)
}
}
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)
}