Fix and validate kotlin version. (#903)

This commit is contained in:
modmuss
2023-06-13 18:31:02 +01:00
committed by GitHub
parent c557647e06
commit 856f0a4f33
2 changed files with 17 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ plugins {
id 'checkstyle'
id 'jacoco'
id 'codenarc'
id "org.jetbrains.kotlin.jvm" version "1.8.0" // Must match the version included with gradle.
alias(libs.plugins.kotlin)
id "com.diffplug.spotless" version "6.18.0"
id "org.gradle.test-retry" version "1.5.2"
}
@@ -34,6 +34,12 @@ if (ENV.BUILD_NUMBER) {
version = baseVersion + '.local'
}
// We must build against the version of Kotlin Gradle ships with.
def kotlinVersion = KotlinDslVersion.current().getKotlinVersion()
if (libs.versions.kotlin.get() != kotlinVersion) {
throw new IllegalStateException("Requires Kotlin version: ${kotlinVersion}")
}
repositories {
maven {
name = 'Fabric'
@@ -100,7 +106,7 @@ dependencies {
}
// Kapt integration
compileOnly('org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0') // Must match the version included with gradle.
compileOnly libs.kotlin.gradle.plugin
// Testing
testImplementation(gradleTestKit())
@@ -216,6 +222,7 @@ test {
}
}
import org.gradle.launcher.cli.KotlinDslVersion
import org.gradle.util.GradleVersion
import org.w3c.dom.Document
import org.w3c.dom.Element

View File

@@ -0,0 +1,8 @@
[versions]
kotlin = "1.8.10"
[libraries]
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }