Point kotlin message in gradle_errors.dart towards new place where templates define the kotlin version (#145936)

Fixes https://github.com/flutter/flutter/issues/144454

For reference, after formatting it looks like:
```
┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Your project requires a newer version of the Kotlin Gradle plugin.                                 │
│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update the  │
│ version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of            │
│ /Users/mackall/development/BugTesting/ELIMINATEME/blah/android/settings.gradle.                        │
│                                                                                                        │
│ Alternatively (if your project was created before Flutter 3.19), update                                │
│ /Users/mackall/development/BugTesting/ELIMINATEME/blah/android/build.gradle                            │
│ ext.kotlin_version = '<latest-version>'                                                                │
└────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```
This commit is contained in:
Gray Mackall
2024-03-28 17:31:01 -07:00
committed by GitHub
parent a366e5e69d
commit 0984a7f04b
2 changed files with 21 additions and 9 deletions

View File

@@ -441,10 +441,17 @@ final GradleHandledError incompatibleKotlinVersionHandler = GradleHandledError(
final File gradleFile = project.directory
.childDirectory('android')
.childFile('build.gradle');
final File settingsFile = project.directory
.childDirectory('android')
.childFile('settings.gradle');
globals.printBox(
'${globals.logger.terminal.warningMark} Your project requires a newer version of the Kotlin Gradle plugin.\n'
'Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update ${gradleFile.path}:\n'
"ext.kotlin_version = '<latest-version>'",
'Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update the \n'
'version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of \n'
'${settingsFile.path}.\n\n'
'Alternatively (if your project was created before Flutter 3.19), update \n'
'${gradleFile.path}\n'
"ext.kotlin_version = '<latest-version>'",
title: _boxTitle,
);
return GradleBuildStatus.exit;

View File

@@ -814,13 +814,18 @@ Execution failed for task ':app:generateDebugFeatureTransitiveDeps'.
expect(
testLogger.statusText,
contains(
'\n'
'┌─ Flutter Fix ──────────────────────────────────────────────────────────────────────────────┐\n'
'│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │\n'
'│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │\n'
'│ update /android/build.gradle: │\n'
"│ ext.kotlin_version = '<latest-version>' │\n"
'└────────────────────────────────────────────────────────────────────────────────────────────┘\n'
'\n'
'┌─ Flutter Fix ────────────────────────────────────────────────────────────────────────────────┐\n'
'│ [!] Your project requires a newer version of the Kotlin Gradle plugin. │\n'
'│ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then │\n'
'│ update the │\n'
'│ version number of the plugin with id "org.jetbrains.kotlin.android" in the plugins block of │\n'
'│ /android/settings.gradle. │\n'
'│ │\n'
'│ Alternatively (if your project was created before Flutter 3.19), update │\n'
'│ /android/build.gradle │\n'
"│ ext.kotlin_version = '<latest-version>' │\n"
'└──────────────────────────────────────────────────────────────────────────────────────────────┘\n'
)
);
}, overrides: <Type, Generator>{