From f130da46e0c587eeecf00f587fd0ccfc49a248cc Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Wed, 7 Feb 2024 10:40:00 -0800 Subject: [PATCH] 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. --- dev/tools/bin/generate_gradle_lockfiles.dart | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dev/tools/bin/generate_gradle_lockfiles.dart b/dev/tools/bin/generate_gradle_lockfiles.dart index af09c3a1a11..8666080fcbb 100644 --- a/dev/tools/bin/generate_gradle_lockfiles.dart +++ b/dev/tools/bin/generate_gradle_lockfiles.dart @@ -40,6 +40,15 @@ void main(List 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 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 +''';