Update getGradleVersion to ignore commented out lines (#124260)

https://github.com/flutter/flutter/issues/123917
Missed feedback from https://github.com/flutter/flutter/pull/123916 

- Handle commented out lines in gradle-wrapper.properties

This is 1 of 2 prs to handle missed feedback. Formatting will be done in
the second whereas this one captures a weakness missed in the last pr.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
This commit is contained in:
Reid Baker
2023-04-07 12:45:37 -04:00
committed by GitHub
parent f28eb28f0d
commit 7a791b5dbf
2 changed files with 29 additions and 1 deletions

View File

@@ -189,8 +189,9 @@ Future<String?> getGradleVersion(
// Expected content format (with lines above and below).
// Version can have 2 or 3 numbers.
// 'distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip'
// '^\s*' protects against commented out lines.
final RegExp distributionUrlRegex =
RegExp(r'distributionUrl\s?=\s?.*\.zip');
RegExp(r'^\s*distributionUrl\s?=\s?.*\.zip', multiLine: true);
final RegExpMatch? distributionUrl =
distributionUrlRegex.firstMatch(wrapperFileContent);