From eb6dffe394015d6ed7d85f62a3dd777abc5f2ff7 Mon Sep 17 00:00:00 2001 From: Yang Date: Tue, 1 Jun 2021 20:59:18 +1000 Subject: [PATCH] Require at least Gradle 6.8. --- api/app-versioning.api | 1 - .../reactivecircus/appversioning/AppVersioningPlugin.kt | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/app-versioning.api b/api/app-versioning.api index 945602fb..5d9868dc 100644 --- a/api/app-versioning.api +++ b/api/app-versioning.api @@ -16,7 +16,6 @@ public final class io/github/reactivecircus/appversioning/AppVersioningExtension public final class io/github/reactivecircus/appversioning/AppVersioningPlugin : org/gradle/api/Plugin { public static final field Companion Lio/github/reactivecircus/appversioning/AppVersioningPlugin$Companion; - public static final field MIN_AGP_VERSION Ljava/lang/String; public fun ()V public synthetic fun apply (Ljava/lang/Object;)V public fun apply (Lorg/gradle/api/Project;)V diff --git a/src/main/kotlin/io/github/reactivecircus/appversioning/AppVersioningPlugin.kt b/src/main/kotlin/io/github/reactivecircus/appversioning/AppVersioningPlugin.kt index e4abd2fc..b47ad63e 100644 --- a/src/main/kotlin/io/github/reactivecircus/appversioning/AppVersioningPlugin.kt +++ b/src/main/kotlin/io/github/reactivecircus/appversioning/AppVersioningPlugin.kt @@ -22,6 +22,10 @@ import java.util.concurrent.atomic.AtomicBoolean @Suppress("UnstableApiUsage") class AppVersioningPlugin : Plugin { override fun apply(project: Project) { + val gradleVersion = VersionNumber.parse(project.gradle.gradleVersion) + check(gradleVersion >= VersionNumber.parse(MIN_GRADLE_VERSION)) { + "Android App Versioning Gradle Plugin requires Gradle $MIN_GRADLE_VERSION or later. Detected Gradle version is $gradleVersion." + } val agpVersion = VersionNumber.parse(ANDROID_GRADLE_PLUGIN_VERSION) check(agpVersion >= VersionNumber.parse(MIN_AGP_VERSION)) { "Android App Versioning Gradle Plugin requires Android Gradle Plugin $MIN_AGP_VERSION or later. Detected AGP version is $agpVersion." @@ -121,7 +125,8 @@ class AppVersioningPlugin : Plugin { } companion object { - const val MIN_AGP_VERSION = "4.2.1" + private const val MIN_GRADLE_VERSION = "6.8" + private const val MIN_AGP_VERSION = "4.2.1" } }