Make generate_gradle_lockfiles also write the gradle wrapper file (#142329)

The `generate_gradle_lockfiles` script currently writes the top level `build.gradle` file and the `settings.gradle` file, and is the easiest way to batch update these files to, for example, increase the AGP version used in integration tests and examples across the framework repo.

This PR makes it also write the gradle version, so that we can do batch upgrades of our gradle version with it as well.
This commit is contained in:
Gray Mackall 2024-02-07 10:40:00 -08:00 committed by GitHub
parent 8acce3d420
commit f130da46e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,6 +40,15 @@ void main(List<String> arguments) {
continue;
}
final File wrapperGradle = androidDirectory
.childDirectory('gradle')
.childDirectory('wrapper')
.childFile('gradle-wrapper.properties');
if (!wrapperGradle.existsSync()) {
print('${wrapperGradle.path} does not exist - skipping');
continue;
}
if (settingsGradle.readAsStringSync().contains('include_flutter.groovy')) {
print('${settingsGradle.path} add to app - skipping');
continue;
@ -78,6 +87,7 @@ void main(List<String> arguments) {
rootBuildGradle.writeAsStringSync(rootGradleFileContent);
settingsGradle.writeAsStringSync(settingGradleFile);
wrapperGradle.writeAsStringSync(wrapperGradleFileContent);
final String appDirectory = androidDirectory.parent.absolute.path;
@ -214,3 +224,11 @@ include ":app"
apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"
''';
const String wrapperGradleFileContent = r'''
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
''';