mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 00:37:03 +05:30
refactor(build): migrate to Kotlin compilerOptions
DSL
This commit is contained in:
parent
bf104a1d85
commit
6b164f84d9
2 changed files with 13 additions and 9 deletions
|
@ -7,6 +7,7 @@
|
||||||
import org.gradle.api.JavaVersion
|
import org.gradle.api.JavaVersion
|
||||||
import org.gradle.api.tasks.compile.JavaCompile
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
import org.gradle.kotlin.dsl.withType
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins { `kotlin-dsl` }
|
plugins { `kotlin-dsl` }
|
||||||
|
@ -17,7 +18,7 @@ tasks.withType<JavaCompile>().configureEach {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile>().configureEach {
|
tasks.withType<KotlinCompile>().configureEach {
|
||||||
kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() }
|
compilerOptions { jvmTarget.set(JvmTarget.JVM_11) }
|
||||||
}
|
}
|
||||||
|
|
||||||
gradlePlugin {
|
gradlePlugin {
|
||||||
|
|
|
@ -13,7 +13,9 @@ import org.gradle.api.tasks.compile.JavaCompile
|
||||||
import org.gradle.api.tasks.testing.Test
|
import org.gradle.api.tasks.testing.Test
|
||||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||||
import org.gradle.kotlin.dsl.withType
|
import org.gradle.kotlin.dsl.withType
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
||||||
|
|
||||||
@Suppress("Unused")
|
@Suppress("Unused")
|
||||||
class KotlinCommonPlugin : Plugin<Project> {
|
class KotlinCommonPlugin : Plugin<Project> {
|
||||||
|
@ -24,13 +26,14 @@ class KotlinCommonPlugin : Plugin<Project> {
|
||||||
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
sourceCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
targetCompatibility = JavaVersion.VERSION_11.toString()
|
targetCompatibility = JavaVersion.VERSION_11.toString()
|
||||||
}
|
}
|
||||||
withType<KotlinCompile>().configureEach {
|
withType<KotlinJvmCompile>().configureEach {
|
||||||
kotlinOptions {
|
compilerOptions {
|
||||||
allWarningsAsErrors =
|
allWarningsAsErrors.set(
|
||||||
false // project.providers.environmentVariable("GITHUB_WORKFLOW").isPresent
|
project.providers.environmentVariable("GITHUB_WORKFLOW").isPresent
|
||||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
)
|
||||||
freeCompilerArgs = freeCompilerArgs + ADDITIONAL_COMPILER_ARGS
|
jvmTarget.set(JvmTarget.JVM_11)
|
||||||
languageVersion = "1.7"
|
freeCompilerArgs.addAll(ADDITIONAL_COMPILER_ARGS)
|
||||||
|
languageVersion.set(KotlinVersion.KOTLIN_1_7)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
withType<Test>().configureEach {
|
withType<Test>().configureEach {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue