66 lines
2 KiB
Kotlin
66 lines
2 KiB
Kotlin
package buildsrc.conventions.lang
|
|
|
|
import buildsrc.utils.Rife2TestListener
|
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
|
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
|
|
|
|
|
/**
|
|
* Base configuration for all Kotlin/Multiplatform conventions.
|
|
*
|
|
* This plugin does not enable any Kotlin target. To enable a target in a subproject, prefer applying specific Kotlin
|
|
* target convention plugins.
|
|
*/
|
|
plugins {
|
|
id("buildsrc.conventions.base")
|
|
kotlin("multiplatform")
|
|
id("io.gitlab.arturbosch.detekt")
|
|
id("org.jetbrains.kotlinx.kover")
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain {
|
|
languageVersion.set(JavaLanguageVersion.of(8))
|
|
}
|
|
|
|
applyDefaultHierarchyTemplate()
|
|
|
|
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
|
compilerOptions {
|
|
languageVersion = KotlinVersion.KOTLIN_1_6
|
|
}
|
|
|
|
// configure all Kotlin/JVM Tests to use JUnit
|
|
targets.withType<KotlinJvmTarget>().configureEach {
|
|
testRuns.configureEach {
|
|
executionTask.configure {
|
|
useJUnitPlatform()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks {
|
|
withType<JavaCompile>().configureEach {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
|
|
targetCompatibility = JavaVersion.VERSION_1_8.toString()
|
|
}
|
|
|
|
withType<KotlinJvmCompile>().configureEach {
|
|
compilerOptions.jvmTarget.set(JvmTarget.JVM_1_8)
|
|
}
|
|
|
|
withType<Test>().configureEach {
|
|
val testsBadgeApiKey = providers.gradleProperty("testsBadgeApiKey")
|
|
addTestListener(Rife2TestListener(testsBadgeApiKey))
|
|
testLogging {
|
|
exceptionFormat = TestExceptionFormat.FULL
|
|
events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED)
|
|
}
|
|
}
|
|
}
|