mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Android templates: update default Kotlin from 1.8.22 to 2.1.0, update default Gradle from 8.9 to 8.12 (#160974)
This commit is contained in:
parent
1daa75598b
commit
558b21abf1
@ -15,8 +15,8 @@ import 'package:flutter_devicelab/framework/framework.dart';
|
||||
// https://developer.android.com/build/releases/past-releases/agp-8-4-0-release-notes.
|
||||
// - Kotlin: No methodology as of yet.
|
||||
// (*) - support range defined in packages/flutter_tools/gradle/src/main/kotlin/dependency_version_checker.gradle.kts.
|
||||
// Note that compileSdk 35 requires AGP 8.1.0+, so override to compileSdk 34 for AGP 8.0.
|
||||
List<VersionTuple> versionTuples = <VersionTuple>[
|
||||
// compileSdk 35 requires AGP 8.1.0+, so override to compileSdk 34 for AGP 8.0.
|
||||
VersionTuple(
|
||||
agpVersion: '8.0.0',
|
||||
gradleVersion: '8.0',
|
||||
@ -30,6 +30,8 @@ List<VersionTuple> versionTuples = <VersionTuple>[
|
||||
VersionTuple(agpVersion: '8.5.0', gradleVersion: '8.7', kotlinVersion: '1.8.22'),
|
||||
VersionTuple(agpVersion: '8.6.0', gradleVersion: '8.7', kotlinVersion: '1.8.22'),
|
||||
VersionTuple(agpVersion: '8.7.0', gradleVersion: '8.9', kotlinVersion: '1.8.22'),
|
||||
VersionTuple(agpVersion: '8.7.0', gradleVersion: '8.9', kotlinVersion: '2.1.0'),
|
||||
VersionTuple(agpVersion: '8.7.0', gradleVersion: '8.12', kotlinVersion: '2.1.0'),
|
||||
];
|
||||
|
||||
Future<void> main() async {
|
||||
|
@ -7,7 +7,7 @@
|
||||
// See dev/tools/bin/generate_gradle_lockfiles.dart.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.8.22'
|
||||
ext.kotlin_version = '2.1.0'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
@ -22,14 +22,21 @@ import 'android_sdk.dart';
|
||||
|
||||
// These are the versions used in the project templates.
|
||||
//
|
||||
// In general, Flutter aims to default to the latest version.
|
||||
// However, this currently requires to migrate existing integration tests to the latest supported values.
|
||||
// In general, Flutter aims to default to the latest stable version.
|
||||
// However, this currently requires to migrate existing integration tests to the
|
||||
// latest supported values.
|
||||
//
|
||||
// Please see the README before changing any of these values.
|
||||
const String templateDefaultGradleVersion = '8.10.2';
|
||||
const String templateAndroidGradlePluginVersion = '8.7.0';
|
||||
const String templateAndroidGradlePluginVersionForModule = '8.7.0';
|
||||
const String templateKotlinGradlePluginVersion = '1.8.22';
|
||||
|
||||
// See https://gradle.org/releases
|
||||
const String templateDefaultGradleVersion = '8.12';
|
||||
|
||||
// See https://mvnrepository.com/artifact/com.android.tools.build/gradle
|
||||
const String templateAndroidGradlePluginVersion = '8.7.3';
|
||||
const String templateAndroidGradlePluginVersionForModule = '8.7.3';
|
||||
|
||||
// See https://kotlinlang.org/docs/releases.html#release-details
|
||||
const String templateKotlinGradlePluginVersion = '2.1.0';
|
||||
|
||||
// The Flutter Gradle Plugin is only applied to app projects, and modules that
|
||||
// are built from source using (`include_flutter.groovy`). The remaining
|
||||
@ -53,17 +60,17 @@ const String oneMajorVersionHigherJavaVersion = '24';
|
||||
//
|
||||
// Supported here means supported by the tooling for
|
||||
// flutter analyze --suggestions and does not imply broader flutter support.
|
||||
const String maxKnownAndSupportedGradleVersion = '8.10.2';
|
||||
const String maxKnownAndSupportedGradleVersion = '8.12';
|
||||
|
||||
// Update this when new versions of AGP come out.
|
||||
//
|
||||
// Supported here means tooling is aware of this version's Java <-> AGP
|
||||
// compatibility.
|
||||
@visibleForTesting
|
||||
const String maxKnownAndSupportedAgpVersion = '8.7.1';
|
||||
const String maxKnownAndSupportedAgpVersion = '8.7.3';
|
||||
|
||||
// Update this when new versions of AGP come out.
|
||||
const String maxKnownAgpVersion = '8.7.1';
|
||||
const String maxKnownAgpVersion = '8.7.3';
|
||||
|
||||
// Oldest documented version of AGP that has a listed minimum
|
||||
// compatible Java version.
|
||||
@ -481,7 +488,7 @@ bool validateGradleAndAgp(Logger logger, {required String? gradleV, required Str
|
||||
return isWithinVersionRange(gradleV, min: '4.10.1', max: maxKnownAndSupportedGradleVersion);
|
||||
}
|
||||
|
||||
logger.printTrace('Unknown Gradle-Agp compatibility, $gradleV, $agpV');
|
||||
logger.printTrace('Unknown Gradle-AGP compatibility, Gradle: $gradleV, AGP: $agpV');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -545,7 +552,7 @@ bool validateJavaAndGradle(Logger logger, {required String? javaV, required Stri
|
||||
}
|
||||
}
|
||||
|
||||
logger.printTrace('Unknown Java-Gradle compatibility $javaV, $gradleV');
|
||||
logger.printTrace('Unknown Java-Gradle compatibility, Java: $javaV, Gradle: $gradleV');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -22,4 +22,9 @@ class VersionRange {
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(versionMin, versionMax);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'VersionRange(versionMin: $versionMin, versionMax: $versionMax)';
|
||||
}
|
||||
}
|
||||
|
@ -1002,7 +1002,7 @@ A problem occurred evaluating project ':app'.
|
||||
"│ + classpath 'com.android.tools.build:gradle:$templateAndroidGradlePluginVersion' │\n"
|
||||
'│ /android/gradle/wrapper/gradle-wrapper.properties: │\n'
|
||||
'│ - https://services.gradle.org/distributions/gradle-<current-version>-all.zip │\n'
|
||||
'│ + https://services.gradle.org/distributions/gradle-$templateDefaultGradleVersion-all.zip │\n'
|
||||
'│ + https://services.gradle.org/distributions/gradle-$templateDefaultGradleVersion-all.zip │\n'
|
||||
'└──────────────────────────────────────────────────────────────────────────────────┘\n',
|
||||
),
|
||||
);
|
||||
|
@ -1314,13 +1314,13 @@ allprojects {
|
||||
);
|
||||
// Strictly too new Gradle and AGP versions.
|
||||
expect(
|
||||
getJavaVersionFor(gradleV: '8.11', agpV: '8.8'),
|
||||
getJavaVersionFor(gradleV: '8.13', agpV: '8.9'),
|
||||
equals(const VersionRange(null, null)),
|
||||
);
|
||||
// Strictly too new Gradle version and maximum version of AGP.
|
||||
//*This test case will need its expected Java range updated when a new version of AGP is supported.*
|
||||
expect(
|
||||
getJavaVersionFor(gradleV: '8.11', agpV: maxKnownAndSupportedAgpVersion),
|
||||
getJavaVersionFor(gradleV: '8.13', agpV: maxKnownAndSupportedAgpVersion),
|
||||
equals(const VersionRange('17', null)),
|
||||
);
|
||||
// Strictly too new AGP version and maximum version of Gradle.
|
||||
|
@ -16,7 +16,7 @@ class PluginDeferredComponentsConfig extends BasicDeferredComponentsConfig {
|
||||
@override
|
||||
String get androidBuild => r'''
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.8.22'
|
||||
ext.kotlin_version = '2.1.0'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
Loading…
Reference in New Issue
Block a user