mirror of
https://github.com/flutter/packages.git
synced 2025-08-06 00:42:13 +08:00
[Android] Bump Gradle version to 7.6.3 (#5522)
Part of fix for https://github.com/flutter/flutter/issues/138336 by bumping the Gradle version of all package example apps (plus `image_picker_android` plugin) to 7.6.3 from those that had a version below that to fix security vulnerability. Also fixes a bug I found while using the `update-dependencies` packages tool command that caused it to not catch all of the `gradle-wrapper.properties` files when running with the `gradle` dependency + added a test for the fix.
This commit is contained in:
@ -780,6 +780,73 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
|
||||
'gradle-$newGradleVersion-all.zip'));
|
||||
});
|
||||
|
||||
test(
|
||||
'succeeds if example app has android/gradle and android/app/gradle directory structure',
|
||||
() async {
|
||||
final RepositoryPackage package =
|
||||
createFakePlugin('fake_plugin', packagesDir, extraFiles: <String>[
|
||||
'example/android/gradle/wrapper/gradle-wrapper.properties',
|
||||
'example/android/app/gradle/wrapper/gradle-wrapper.properties'
|
||||
]);
|
||||
const String newGradleVersion = '9.9';
|
||||
|
||||
final File gradleWrapperPropertiesFile = package.directory
|
||||
.childDirectory('example')
|
||||
.childDirectory('android')
|
||||
.childDirectory('gradle')
|
||||
.childDirectory('wrapper')
|
||||
.childFile('gradle-wrapper.properties');
|
||||
|
||||
final File gradleAppWrapperPropertiesFile = package.directory
|
||||
.childDirectory('example')
|
||||
.childDirectory('android')
|
||||
.childDirectory('app')
|
||||
.childDirectory('gradle')
|
||||
.childDirectory('wrapper')
|
||||
.childFile('gradle-wrapper.properties');
|
||||
|
||||
gradleWrapperPropertiesFile.writeAsStringSync(r'''
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
|
||||
''');
|
||||
|
||||
gradleAppWrapperPropertiesFile.writeAsStringSync(r'''
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
|
||||
''');
|
||||
|
||||
await runCapturingPrint(runner, <String>[
|
||||
'update-dependency',
|
||||
'--packages',
|
||||
package.displayName,
|
||||
'--android-dependency',
|
||||
'gradle',
|
||||
'--version',
|
||||
newGradleVersion,
|
||||
]);
|
||||
|
||||
final String updatedGradleWrapperPropertiesContents =
|
||||
gradleWrapperPropertiesFile.readAsStringSync();
|
||||
final String updatedGradleAppWrapperPropertiesContents =
|
||||
gradleAppWrapperPropertiesFile.readAsStringSync();
|
||||
expect(
|
||||
updatedGradleWrapperPropertiesContents,
|
||||
contains(
|
||||
r'distributionUrl=https\://services.gradle.org/distributions/'
|
||||
'gradle-$newGradleVersion-all.zip'));
|
||||
expect(
|
||||
updatedGradleAppWrapperPropertiesContents,
|
||||
contains(
|
||||
r'distributionUrl=https\://services.gradle.org/distributions/'
|
||||
'gradle-$newGradleVersion-all.zip'));
|
||||
});
|
||||
|
||||
test('succeeds if one example app runs on Android and another does not',
|
||||
() async {
|
||||
final RepositoryPackage package = createFakePlugin(
|
||||
|
Reference in New Issue
Block a user