[repo] Simplify buildsrc-compat/build.gradle.kts configuration
Use the Kotlin extension to configure toolchain and compiler options.
This commit is contained in:
committed by
Space Team
parent
d743dc70ac
commit
45d8a8e56a
@@ -1,5 +1,3 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
// workaround for KGP build metrics reports: https://github.com/gradle/gradle/issues/20001
|
// workaround for KGP build metrics reports: https://github.com/gradle/gradle/issues/20001
|
||||||
project.extensions.extraProperties["kotlin.build.report.output"] = null
|
project.extensions.extraProperties["kotlin.build.report.output"] = null
|
||||||
@@ -76,9 +74,13 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
kotlin {
|
||||||
toolchain {
|
jvmToolchain(8)
|
||||||
languageVersion.set(JavaLanguageVersion.of(8))
|
|
||||||
|
compilerOptions {
|
||||||
|
allWarningsAsErrors.set(true)
|
||||||
|
optIn.add("kotlin.ExperimentalStdlibApi")
|
||||||
|
freeCompilerArgs.add("-Xsuppress-version-warnings")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,21 +123,4 @@ dependencies {
|
|||||||
implementation(libs.kotlinx.metadataJvm)
|
implementation(libs.kotlinx.metadataJvm)
|
||||||
}
|
}
|
||||||
|
|
||||||
samWithReceiver {
|
tasks.register("checkBuild")
|
||||||
annotation("org.gradle.api.HasImplicitReceiver")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.samWithReceiver(configure: org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverExtension.() -> Unit): Unit =
|
|
||||||
extensions.configure("samWithReceiver", configure)
|
|
||||||
|
|
||||||
tasks.withType<KotlinCompile>().configureEach {
|
|
||||||
compilerOptions {
|
|
||||||
allWarningsAsErrors.set(true)
|
|
||||||
optIn.add("kotlin.ExperimentalStdlibApi")
|
|
||||||
freeCompilerArgs.add("-Xsuppress-version-warnings")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
tasks.register("checkBuild")
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user