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:
@@ -117,6 +117,7 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-GRADLE_REPLACE
|
||||
''';
|
||||
|
||||
const String gradleReplacementString = 'GRADLE_REPLACE_ME';
|
||||
const String flutterCompileSdkString = 'flutter.compileSdkVersion';
|
||||
|
||||
class VersionTuple {
|
||||
|
||||
@@ -141,6 +142,7 @@ class VersionTuple {
|
||||
/// ProcessResult.
|
||||
Future<ProcessResult> buildFlutterApkWithSpecifiedDependencyVersions({
|
||||
required VersionTuple versions,
|
||||
String? compileSdkOverride,
|
||||
required Directory tempDir,}) async {
|
||||
// Create a new flutter project.
|
||||
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
|
||||
@@ -154,6 +156,14 @@ Future<ProcessResult> buildFlutterApkWithSpecifiedDependencyVersions({
|
||||
|
||||
final Directory app = Directory(fileSystem.path.join(tempDir.path, 'dependency_checker_app'));
|
||||
|
||||
if (compileSdkOverride != null) {
|
||||
final File appGradleBuild = File(fileSystem.path.join(
|
||||
app.path, '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 = File(fileSystem.path.join(
|
||||
app.path, 'android', 'gradle', 'wrapper', 'gradle-wrapper.properties'));
|
||||
|
||||
Reference in New Issue
Block a user