Repository navigation
Fix frameworkVersionFor for flutter doctor and usage - #54217
Conversation
2d03c9f to
f23114d
Compare
f23114d to
ee33ead
Compare
| final RegExp pattern = RegExp(r'^\d+\.\d+\.\d+(\+hotfix\.\d+)?(-pre\.\d+)?$'); | ||
| // 1.18.0-5.0-pre.8 | ||
| final RegExp pattern = RegExp( | ||
| r'^(\d+)\.(\d+)\.(\d+)(-\d+\.\d+)?(-pre\.\d+)?$'); |
There was a problem hiding this comment.
.pre (dot, not hyphen).
And elsewhere.
There was a problem hiding this comment.
I can make that change, but to clarify, this is just for reporting commits past last tagged version in the tool, and not the git tag format itself, and is a break from how we used to do it.
// old way, 4 commits past 1.2.3
1.2.4-pre.4
// this PR, 4 commits past 1.2.3-0.0.pre
1.2.3-1.0-pre.4
// proposed change, 4 commits past 1.2.3-0.0.pre
1.2.3-1.0.pre.4
There was a problem hiding this comment.
and also, if you are 4 commits past version 1.2.3? Should that be 1.2.3-pre.4 or 1.2.3.pre.4? (though I suppose this would be an edge case, where the user is adding their own commits on the stable branch).
|
|
||
| // TODO(fujino): Deprecate this https://github.com/flutter/flutter/issues/53850 | ||
| /// Check for the release tag format pre-v1.17.0 | ||
| /// Check for the release tag format of the form x.y.z-dev.m.n |
There was a problem hiding this comment.
I had to support the -dev tag or else when I land this (before there are the new tags) the tool will be in a bad state (and pre-submit was failing because it couldn't parse the current version)
There was a problem hiding this comment.
It was either support the -dev tag, or change the git describe --match glob, and I figured if I support the -dev tag here, I can safely remove it after the next dev release with the new tag format.
There was a problem hiding this comment.
If possible, can you split out the -dev parsing code to more clearly delineate what logic can be removed after the next dev?
There was a problem hiding this comment.
This entire method can be removed in the next dev.
| (String source) => source == null ? null : int.tryParse(source)).toList(); | ||
| List<int> devParts = <int>[null, null]; | ||
| if (parts[3] != null) { | ||
| devParts = RegExp(r'^-dev\.(\d+)\.(\d+)') |
| return '$x.$y.$z+hotfix.${hotfix + 1}-pre.$commits'; | ||
| } | ||
| if (devPatch != null && devVersion != null) { | ||
| return '$x.$y.$z-${devVersion + 1}.0-pre.$commits'; |
| } | ||
| if (hotfix != null) { | ||
| // This is an unexpected state where untagged commits exist past a hotfix | ||
| return '$x.$y.$z+hotfix.${hotfix + 1}-pre.$commits'; |
|
I'm looking at the failure to |
|
|
||
| // TODO(fujino): Deprecate this https://github.com/flutter/flutter/issues/53850 | ||
| /// Check for the release tag format pre-v1.17.0 | ||
| /// Check for the release tag format of the form x.y.z-dev.m.n |
There was a problem hiding this comment.
If possible, can you split out the -dev parsing code to more clearly delineate what logic can be removed after the next dev?
| // legacy tag release format | ||
| gitTagVersion = GitTagVersion.parse('v1.2.3-4-g$hash'); | ||
| expect(gitTagVersion.frameworkVersionFor(hash), '1.2.4-pre.4'); | ||
| // legacy tag format (x.y.z-dev.m.n), master channel |
There was a problem hiding this comment.
Would a regression test of the doctor also be useful?
There was a problem hiding this comment.
The diff in this PR for dev/bots/test.dart was because changing the output of frameworkVersionFor caused the verifyVersion integration test to fail. I think between that integration test and this unit test, we're covering any territory a doctor test would assert. What do you think?
* Update engine, includes Dart 2.8.0-20.11.beta * git pull --ff-only (#54987) * [flutter_tools] Reland: fix multiple dart defines (#54973) * Fix `frameworkVersionFor` for flutter doctor and usage (#54217) * update engine hash, use dart 2.8.0-20.10-beta (with old naming schema) Co-authored-by: Jenn Magder <[email protected]> Co-authored-by: Jonah Williams <[email protected]> Co-authored-by: Christopher Fujino <[email protected]>
Description
With the new release tag format, the Flutter tool failed to detect the new tags #53688. Tag parsing was fixed in #53715, however, version reporting was not updated, so flutter doctor and usage reporting would only include
x.y.z, and not the additionalm.nin pre-stable releases.This PR fixes
frameworkVersionFor()AND accounts for another modification to the release tag format (1.2.3-dev.4.5 -> 1.2.3-4.5.pre). Parsing of thex.y.z-dev.m.nformat is being moved to theparseLegacyVersion()method, and we are dropping support forvx.y.z+hotfix.m. This parsing logic is only for the nearest tagged parent, thus we can drop parsing support for old formats once the new format has been published on that channel.Related Issues
fixes #54160, #53688
Tests
I extended the existing test to verify more permutations are correctly being parsed.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read [Handling breaking changes].