Skip to content

Commit

Permalink
Enforce minimum Kotlin and Gradle versions in plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Abduqodiri Qurbonzoda authored and qurbonzoda committed Mar 1, 2021
1 parent 53ee45d commit 001d3cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugin/main/src/kotlinx/benchmark/gradle/BenchmarksPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ class BenchmarksPlugin : Plugin<Project> {
// DO NOT use properties of an extension immediately, it will not contain any user-specified data
val extension = extensions.create(BENCHMARK_EXTENSION_NAME, BenchmarksExtension::class.java, project)

if (GradleVersion.current() < GradleVersion.version("5.1")) {
logger.error("JetBrains Gradle Benchmarks plugin requires Gradle version 5.1 or higher")
if (GradleVersion.current() < GradleVersion.version("6.8")) {
logger.error("JetBrains Gradle Benchmarks plugin requires Gradle version 6.8 or higher")
return // TODO: Do we need to fail build at this point or just ignore benchmarks?
}

val kotlinClass = tryGetClass<KotlinBasePluginWrapper>("org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper")
if (kotlinClass != null) {
plugins.findPlugin(kotlinClass)?.run {
logger.info("Detected Kotlin plugin version '$kotlinPluginVersion'")
if (VersionNumber.parse(kotlinPluginVersion) < VersionNumber(1, 3, 50, null))
logger.error("JetBrains Gradle Benchmarks plugin requires Kotlin version 1.3.40 or higher")
if (VersionNumber.parse(kotlinPluginVersion) < VersionNumber(1, 4, 30, null))
logger.error("JetBrains Gradle Benchmarks plugin requires Kotlin version 1.4.30 or higher")
}
}

Expand Down

0 comments on commit 001d3cd

Please sign in to comment.