Skip to content

Commit f20bc39

Browse files
authored
Add kotlin compatability to build file validation (flutter#167143)
Fixes flutter#161443 * adds a new gradle task like `javaVersion` named `kgpVersion` that prints the version of kgp. * adds gradle_utils.dart method for getting kgp version * * kgp method is moved to utilities and we attempt to use a plugin method before reflection. * adds methods or evaluating KGP + gradle and KGP + AGP compatibility. * * It turns out that we have been using incompatible versions that happen to work with the subset of kotlin we are using. * Uses new kgp methods in flutter analyze --suggestions as part of the existing agp/java/gradle compatibility matrix. * adds new tests for all new functionality * Adds comments to sections of the code I found could use them. * Modifies flutter gallery to use a compatible version of kotlin and update its lockfiles. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing.
1 parent d203008 commit f20bc39

File tree

15 files changed

+1015
-172
lines changed

15 files changed

+1015
-172
lines changed

dev/integration_tests/flutter_gallery/android/buildscript-gradle.lockfile

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -113,35 +113,30 @@ org.glassfish.jaxb:jaxb-runtime:2.3.2=classpath
113113
org.glassfish.jaxb:txw2:2.3.2=classpath
114114
org.jdom:jdom2:2.0.6=classpath
115115
org.jetbrains.intellij.deps:trove4j:1.0.20200330=classpath
116-
org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.8.10=classpath
117-
org.jetbrains.kotlin:kotlin-android-extensions:1.8.10=classpath
118-
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.8.10=classpath
119-
org.jetbrains.kotlin:kotlin-build-common:1.8.10=classpath
120-
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.8.10=classpath
121-
org.jetbrains.kotlin:kotlin-compiler-runner:1.8.10=classpath
122-
org.jetbrains.kotlin:kotlin-daemon-client:1.8.10=classpath
123-
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.8.10=classpath
124-
org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.8.10=classpath
125-
org.jetbrains.kotlin:kotlin-gradle-plugin-idea-proto:1.8.10=classpath
126-
org.jetbrains.kotlin:kotlin-gradle-plugin-idea:1.8.10=classpath
127-
org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.8.10=classpath
128-
org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10=classpath
129-
org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.8.10=classpath
130-
org.jetbrains.kotlin:kotlin-native-utils:1.8.10=classpath
131-
org.jetbrains.kotlin:kotlin-project-model:1.8.10=classpath
116+
org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:2.1.10=classpath
117+
org.jetbrains.kotlin:kotlin-build-statistics:2.1.10=classpath
118+
org.jetbrains.kotlin:kotlin-build-tools-api:2.1.10=classpath
119+
org.jetbrains.kotlin:kotlin-compiler-runner:2.1.10=classpath
120+
org.jetbrains.kotlin:kotlin-daemon-client:2.1.10=classpath
121+
org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:2.1.10=classpath
122+
org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.1.10=classpath
123+
org.jetbrains.kotlin:kotlin-gradle-plugin-idea-proto:2.1.10=classpath
124+
org.jetbrains.kotlin:kotlin-gradle-plugin-idea:2.1.10=classpath
125+
org.jetbrains.kotlin:kotlin-gradle-plugin-model:2.1.10=classpath
126+
org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10=classpath
127+
org.jetbrains.kotlin:kotlin-gradle-plugins-bom:2.1.10=classpath
128+
org.jetbrains.kotlin:kotlin-klib-commonizer-api:2.1.10=classpath
129+
org.jetbrains.kotlin:kotlin-native-utils:2.1.10=classpath
132130
org.jetbrains.kotlin:kotlin-reflect:1.9.20=classpath
133-
org.jetbrains.kotlin:kotlin-scripting-common:1.8.10=classpath
134-
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.8.10=classpath
135-
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.8.10=classpath
136-
org.jetbrains.kotlin:kotlin-scripting-jvm:1.8.10=classpath
137131
org.jetbrains.kotlin:kotlin-stdlib-common:1.9.20=classpath
138132
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.20=classpath
139133
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.20=classpath
140134
org.jetbrains.kotlin:kotlin-stdlib:1.9.20=classpath
141-
org.jetbrains.kotlin:kotlin-tooling-core:1.8.10=classpath
142-
org.jetbrains.kotlin:kotlin-util-io:1.8.10=classpath
143-
org.jetbrains.kotlin:kotlin-util-klib:1.8.10=classpath
144-
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0=classpath
135+
org.jetbrains.kotlin:kotlin-tooling-core:2.1.10=classpath
136+
org.jetbrains.kotlin:kotlin-util-io:2.1.10=classpath
137+
org.jetbrains.kotlin:kotlin-util-klib-metadata:2.1.10=classpath
138+
org.jetbrains.kotlin:kotlin-util-klib:2.1.10=classpath
139+
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=classpath
145140
org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.4.0=classpath
146141
org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.0=classpath
147142
org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.4.0=classpath

dev/integration_tests/flutter_gallery/android/project-integration_test.lockfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ javax.annotation:javax.annotation-api:1.3.2=_internal-unified-test-platform-andr
111111
javax.inject:javax.inject:1=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileCompileClasspath,profileRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
112112
junit:junit:4.12=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugRuntimeClasspath,profileCompileClasspath,profileRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath
113113
junit:junit:4.13.2=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
114-
net.bytebuddy:byte-buddy-agent:1.12.22=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
115-
net.bytebuddy:byte-buddy:1.12.22=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
114+
net.bytebuddy:byte-buddy-agent:1.14.10=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
115+
net.bytebuddy:byte-buddy:1.14.10=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
116116
net.java.dev.jna:jna-platform:5.6.0=_internal-unified-test-platform-android-device-provider-ddmlib,_internal-unified-test-platform-android-device-provider-gradle,_internal-unified-test-platform-android-test-plugin-host-additional-test-output,_internal-unified-test-platform-android-test-plugin-host-apk-installer,_internal-unified-test-platform-android-test-plugin-host-coverage,_internal-unified-test-platform-android-test-plugin-host-device-info,_internal-unified-test-platform-android-test-plugin-host-emulator-control,_internal-unified-test-platform-android-test-plugin-host-logcat,_internal-unified-test-platform-android-test-plugin-host-retention,_internal-unified-test-platform-android-test-plugin-result-listener-gradle
117117
net.java.dev.jna:jna:5.6.0=_internal-unified-test-platform-android-device-provider-ddmlib,_internal-unified-test-platform-android-device-provider-gradle,_internal-unified-test-platform-android-test-plugin-host-additional-test-output,_internal-unified-test-platform-android-test-plugin-host-apk-installer,_internal-unified-test-platform-android-test-plugin-host-coverage,_internal-unified-test-platform-android-test-plugin-host-device-info,_internal-unified-test-platform-android-test-plugin-host-emulator-control,_internal-unified-test-platform-android-test-plugin-host-logcat,_internal-unified-test-platform-android-test-plugin-host-retention,_internal-unified-test-platform-android-test-plugin-result-listener-gradle
118118
net.sf.kxml:kxml2:2.3.0=_internal-unified-test-platform-android-device-provider-ddmlib,debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileCompileClasspath,profileRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
@@ -144,8 +144,7 @@ org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4=_internal-unified-test-platf
144144
org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileCompileClasspath,profileRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
145145
org.jetbrains:annotations:13.0=_internal-unified-test-platform-android-device-provider-gradle,_internal-unified-test-platform-android-test-plugin-host-additional-test-output,_internal-unified-test-platform-android-test-plugin-host-apk-installer,_internal-unified-test-platform-android-test-plugin-host-coverage,_internal-unified-test-platform-android-test-plugin-host-device-info,_internal-unified-test-platform-android-test-plugin-host-emulator-control,_internal-unified-test-platform-android-test-plugin-host-logcat,_internal-unified-test-platform-android-test-plugin-host-retention,_internal-unified-test-platform-android-test-plugin-result-listener-gradle
146146
org.jetbrains:annotations:23.0.0=_internal-unified-test-platform-android-device-provider-ddmlib,debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileCompileClasspath,profileRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
147-
org.mockito:mockito-core:5.1.0=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
148-
org.mockito:mockito-inline:5.1.0=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
147+
org.mockito:mockito-core:5.8.0=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
149148
org.objenesis:objenesis:3.3=debugUnitTestRuntimeClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestRuntimeClasspath
150149
org.ow2.asm:asm-analysis:9.1=androidJacocoAnt
151150
org.ow2.asm:asm-commons:9.1=androidJacocoAnt

dev/integration_tests/flutter_gallery/android/project-url_launcher_android.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ androidx.savedstate:savedstate:1.2.1=debugAndroidTestCompileClasspath,debugAndro
3030
androidx.startup:startup-runtime:1.1.1=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileCompileClasspath,profileRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
3131
androidx.test.espresso:espresso-idling-resource:3.5.1=debugUnitTestRuntimeClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestRuntimeClasspath
3232
androidx.test:annotation:1.0.1=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
33-
androidx.test:core:1.0.0=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
33+
androidx.test:core:1.4.0=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
3434
androidx.test:monitor:1.6.1=debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
3535
androidx.tracing:tracing:1.2.0=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileCompileClasspath,profileRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath
3636
androidx.versionedparcelable:versionedparcelable:1.1.1=debugAndroidTestCompileClasspath,debugAndroidTestRuntimeClasspath,debugCompileClasspath,debugRuntimeClasspath,debugUnitTestCompileClasspath,debugUnitTestRuntimeClasspath,profileCompileClasspath,profileRuntimeClasspath,profileUnitTestCompileClasspath,profileUnitTestRuntimeClasspath,releaseCompileClasspath,releaseRuntimeClasspath,releaseUnitTestCompileClasspath,releaseUnitTestRuntimeClasspath

dev/integration_tests/flutter_gallery/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ buildscript {
3535
plugins {
3636
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
3737
id "com.android.application" version "8.7.0" apply false
38-
id "org.jetbrains.kotlin.android" version "1.8.10" apply false
38+
id "org.jetbrains.kotlin.android" version "2.1.10" apply false
3939
}
4040

4141
include ":app"

packages/flutter_tools/gradle/src/main/kotlin/DependencyVersionChecker.kt

Lines changed: 11 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ import org.gradle.api.JavaVersion
1212
import org.gradle.api.Project
1313
import org.gradle.api.logging.Logger
1414
import org.gradle.kotlin.dsl.extra
15-
import org.jetbrains.kotlin.gradle.plugin.KotlinAndroidPluginWrapper
1615

16+
/**
17+
* Warns or errors on version ranges of dependencies required to build a Flutter Android app.
18+
*
19+
* For code that evaluates if dependencies are compatible with each other see
20+
* packages/flutter_tools/lib/src/android/gradle_utils.dart.
21+
*/
1722
object DependencyVersionChecker {
1823
// Logging constants.
1924
@VisibleForTesting internal const val GRADLE_NAME: String = "Gradle"
@@ -114,12 +119,12 @@ object DependencyVersionChecker {
114119
@JvmStatic fun checkDependencyVersions(project: Project) {
115120
project.extra.set(OUT_OF_SUPPORT_RANGE_PROPERTY, false)
116121

117-
checkGradleVersion(getGradleVersion(project), project)
118-
checkJavaVersion(getJavaVersion(), project)
122+
checkGradleVersion(VersionFetcher.getGradleVersion(project), project)
123+
checkJavaVersion(VersionFetcher.getJavaVersion(), project)
119124

120125
configureMinSdkCheck(project)
121126

122-
val agpVersion: AndroidPluginVersion? = getAGPVersion(project)
127+
val agpVersion: AndroidPluginVersion? = VersionFetcher.getAGPVersion(project)
123128
if (agpVersion != null) {
124129
checkAGPVersion(agpVersion, project)
125130
} else {
@@ -129,7 +134,7 @@ object DependencyVersionChecker {
129134
)
130135
}
131136

132-
val kgpVersion: Version? = getKGPVersion(project)
137+
val kgpVersion: Version? = VersionFetcher.getKGPVersion(project)
133138
if (kgpVersion != null) {
134139
checkKGPVersion(kgpVersion, project)
135140
}
@@ -176,62 +181,14 @@ object DependencyVersionChecker {
176181
project: Project,
177182
it: Variant
178183
): MinSdkVersion {
179-
val agpVersion: AndroidPluginVersion? = getAGPVersion(project)
184+
val agpVersion: AndroidPluginVersion? = VersionFetcher.getAGPVersion(project)
180185
return if (agpVersion != null && agpVersion.major >= 8 && agpVersion.minor >= 1) {
181186
MinSdkVersion(it.name, it.minSdk.apiLevel)
182187
} else {
183188
MinSdkVersion(it.name, it.minSdkVersion.apiLevel)
184189
}
185190
}
186191

187-
// https://docs.gradle.org/current/kotlin-dsl/gradle/org.gradle.api.invocation/-gradle/index.html#-837060600%2FFunctions%2F-1793262594
188-
@VisibleForTesting internal fun getGradleVersion(project: Project): Version {
189-
val untrimmedGradleVersion: String = project.gradle.gradleVersion
190-
// Trim to handle candidate gradle versions (example 7.6-rc-4). This means we treat all
191-
// candidate versions of gradle as the same as their base version
192-
// (i.e., "7.6"="7.6-rc-4").
193-
return Version.fromString(untrimmedGradleVersion.substringBefore('-'))
194-
}
195-
196-
// https://docs.gradle.org/current/kotlin-dsl/gradle/org.gradle.api/-java-version/index.html#-1790786897%2FFunctions%2F-1793262594
197-
@VisibleForTesting internal fun getJavaVersion(): JavaVersion = JavaVersion.current()
198-
199-
@VisibleForTesting internal fun getAGPVersion(project: Project): AndroidPluginVersion? {
200-
val androidPluginVersion: AndroidPluginVersion? =
201-
project.extensions
202-
.findByType(
203-
AndroidComponentsExtension::class.java
204-
)?.pluginVersion
205-
return androidPluginVersion
206-
}
207-
208-
// TODO(gmackall): AGP has a getKotlinAndroidPluginVersion(), and KGP has a
209-
// getKotlinPluginVersion(). Consider replacing this implementation with one of
210-
// those.
211-
@VisibleForTesting internal fun getKGPVersion(project: Project): Version? {
212-
val kotlinVersionProperty = "kotlin_version"
213-
val firstKotlinVersionFieldName = "pluginVersion"
214-
val secondKotlinVersionFieldName = "kotlinPluginVersion"
215-
// This property corresponds to application of the Kotlin Gradle plugin in the
216-
// top-level build.gradle file.
217-
if (project.hasProperty(kotlinVersionProperty)) {
218-
return Version.fromString(project.properties[kotlinVersionProperty] as String)
219-
}
220-
val kotlinPlugin =
221-
project.plugins
222-
.findPlugin(KotlinAndroidPluginWrapper::class.java)
223-
val versionField =
224-
kotlinPlugin?.javaClass?.kotlin?.members?.first {
225-
it.name == firstKotlinVersionFieldName || it.name == secondKotlinVersionFieldName
226-
}
227-
val versionString = versionField?.call(kotlinPlugin)
228-
return if (versionString == null) {
229-
null
230-
} else {
231-
Version.fromString(versionString as String)
232-
}
233-
}
234-
235192
@VisibleForTesting internal fun getErrorMessage(
236193
dependencyName: String,
237194
versionString: String,
@@ -394,43 +351,6 @@ object DependencyVersionChecker {
394351
}
395352
}
396353

397-
// Helper class to parse the versions that are provided as plain strings (Gradle, Kotlin) and
398-
// perform easy comparisons. All versions will have a major, minor, and patch value. These values
399-
// default to 0 when they are not provided or are otherwise unparseable.
400-
// For example the version strings "8.2", "8.2.2hfd", and "8.2.0" would parse to the same version.
401-
internal class Version(
402-
val major: Int,
403-
val minor: Int,
404-
val patch: Int
405-
) : Comparable<Version> {
406-
companion object {
407-
fun fromString(version: String): Version {
408-
val asList: List<String> = version.split(".")
409-
val convertedToNumbers: List<Int> = asList.map { it.toIntOrNull() ?: 0 }
410-
return Version(
411-
major = convertedToNumbers.getOrElse(0) { 0 },
412-
minor = convertedToNumbers.getOrElse(1) { 0 },
413-
patch = convertedToNumbers.getOrElse(2) { 0 }
414-
)
415-
}
416-
}
417-
418-
override fun compareTo(other: Version): Int {
419-
if (major != other.major) {
420-
return major - other.major
421-
}
422-
if (minor != other.minor) {
423-
return minor - other.minor
424-
}
425-
if (patch != other.patch) {
426-
return patch - other.patch
427-
}
428-
return 0
429-
}
430-
431-
override fun toString(): String = "$major.$minor.$patch"
432-
}
433-
434354
// Custom error for when the dependency_version_checker.kts script finds a dependency out of
435355
// the defined support range.
436356
@VisibleForTesting internal class DependencyValidationException(

packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ class FlutterPlugin : Plugin<Project> {
314314
}
315315

316316
FlutterPluginUtils.addTaskForJavaVersion(projectToAddTasksTo)
317+
FlutterPluginUtils.addTaskForKGPVersion(projectToAddTasksTo)
317318
if (FlutterPluginUtils.isFlutterAppProject(projectToAddTasksTo)) {
318319
FlutterPluginUtils.addTaskForPrintBuildVariants(projectToAddTasksTo)
319320
FlutterPluginUtils.addTasksForOutputsAppLinkSettings(projectToAddTasksTo)

0 commit comments

Comments
 (0)