Update template/test compileSdk, targetSdk, ndk versions (#152487)
Updates `compileSdk`, `targetSdk`, and `ndk` versions (former 2 to latest, latter to the version of the ndk we are hosting on CIPD). Summary of changes: - Updates mentioned template values - `compileSdk` 35 requires AGP 8.0+, so updated to 8.1 in many places. - This also necessitated Gradle upgrades in most places - This also necessitated moving the `package` xml attribute to the AGP `namespace` field in a couple places (test + template). - Some tests use the output of `flutter create` but then use intentionally lower AGP versions. [I downgraded the `compileSdk` in these tests.](fee34fd61a) - [Stopped lockfile generation](82324a2570) script from hitting the `hello_world` example because it uses `.kts` gradle files. - One test needed [some Gradle options we had already added to templates](6aa187b4b6).
This commit is contained in:
@@ -25,14 +25,22 @@ List<VersionTuple> versionTuples = <VersionTuple>[
|
||||
|
||||
// This test requires a Java version less than 17 due to the intentionally low
|
||||
// version of Gradle. We choose 11 because this was the primary version used in
|
||||
// CI before 17, and hence it is also hosted on CIPD.
|
||||
// CI before 17, and hence it is also hosted on CIPD. It also overrides to
|
||||
// compileSdkVersion 34 because compileSdk 35 requires AGP 8.0+.
|
||||
// https://docs.gradle.org/current/userguide/compatibility.html
|
||||
Future<void> main() async {
|
||||
/// The [FileSystem] for the integration test environment.
|
||||
const LocalFileSystem fileSystem = LocalFileSystem();
|
||||
|
||||
final Directory tempDir = fileSystem.systemTempDirectory.createTempSync('flutter_android_dependency_version_tests');
|
||||
final Directory tempDir = fileSystem
|
||||
.systemTempDirectory
|
||||
.createTempSync('flutter_android_dependency_version_tests');
|
||||
await task(() {
|
||||
return buildFlutterApkWithSpecifiedDependencyVersions(versionTuples: versionTuples, tempDir: tempDir, localFileSystem: fileSystem);
|
||||
return buildFlutterApkWithSpecifiedDependencyVersions(
|
||||
versionTuples: versionTuples,
|
||||
compileSdkOverride: '34',
|
||||
tempDir: tempDir,
|
||||
localFileSystem: fileSystem
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ class ModuleTest {
|
||||
Future<void> main() async {
|
||||
await task(combine(<TaskFunction>[
|
||||
// ignore: avoid_redundant_argument_values
|
||||
ModuleTest('module-gradle-7.6', gradleVersion: '7.6.3').call,
|
||||
ModuleTest('module-gradle-7.6', gradleVersion: '7.6-rc-2').call,
|
||||
ModuleTest('module-gradle-7.6', gradleVersion: '8.4').call,
|
||||
ModuleTest('module-gradle-7.6', gradleVersion: '8.4-rc-3').call,
|
||||
]));
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-GRADLE_REPLACE
|
||||
''';
|
||||
|
||||
const String gradleReplacementString = 'GRADLE_REPLACE_ME';
|
||||
const String flutterCompileSdkString = 'flutter.compileSdkVersion';
|
||||
|
||||
/// A simple class containing a Kotlin, Gradle, and AGP version.
|
||||
class VersionTuple {
|
||||
@@ -87,6 +88,7 @@ class VersionTuple {
|
||||
/// fails, returns a successful result otherwise. Cleans up in either case.
|
||||
Future<TaskResult> buildFlutterApkWithSpecifiedDependencyVersions({
|
||||
required List<VersionTuple> versionTuples,
|
||||
String? compileSdkOverride,
|
||||
required Directory tempDir,
|
||||
required LocalFileSystem localFileSystem,}) async {
|
||||
for (final VersionTuple versions in versionTuples) {
|
||||
@@ -105,6 +107,14 @@ Future<TaskResult> buildFlutterApkWithSpecifiedDependencyVersions({
|
||||
|
||||
final String appPath = '${innerTempDir.absolute.path}/dependency_checker_app';
|
||||
|
||||
if (compileSdkOverride != null) {
|
||||
final File appGradleBuild = localFileSystem.file(localFileSystem.path.join(
|
||||
appPath, 'android', 'app', 'build.gradle'));
|
||||
final String appBuildContent = appGradleBuild.readAsStringSync()
|
||||
.replaceFirst(flutterCompileSdkString, compileSdkOverride);
|
||||
appGradleBuild.writeAsStringSync(appBuildContent);
|
||||
}
|
||||
|
||||
// Modify gradle version to passed in version.
|
||||
final File gradleWrapperProperties = localFileSystem.file(localFileSystem.path.join(
|
||||
appPath, 'android', 'gradle', 'wrapper', 'gradle-wrapper.properties'));
|
||||
|
||||
Reference in New Issue
Block a user