Skip to content

Commit

Permalink
[flutter_tools] increment y instead of m when calling flutter --versi…
Browse files Browse the repository at this point in the history
…on on master (#97827)
  • Loading branch information
christopherfujino authored Feb 4, 2022
1 parent 734c3c4 commit 1d59d8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/flutter_tools/lib/src/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,9 @@ class GitTagVersion {
return '$x.$y.$z+hotfix.${hotfix! + 1}.pre.$commits';
}
if (devPatch != null && devVersion != null) {
return '$x.$y.$z-${devVersion! + 1}.0.pre.$commits';
// The next published release this commit will appear in will be a beta
// release, thus increment [y].
return '$x.${y! + 1}.0-0.0.pre.$commits';
}
return '$x.$y.${z! + 1}-0.0.pre.$commits';
}
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter_tools/test/general.shard/version_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ void main() {

// Master channel
gitTagVersion = GitTagVersion.parse('1.2.3-4.5.pre-13-g$hash');
expect(gitTagVersion.frameworkVersionFor(hash), '1.2.3-5.0.pre.13');
expect(gitTagVersion.frameworkVersionFor(hash), '1.3.0-0.0.pre.13');
expect(gitTagVersion.gitTag, '1.2.3-4.5.pre');
expect(gitTagVersion.devVersion, 4);
expect(gitTagVersion.devPatch, 5);
Expand Down Expand Up @@ -491,8 +491,8 @@ void main() {
logger: BufferLogger.test(),
);
final GitTagVersion gitTagVersion = GitTagVersion.determine(processUtils, workingDirectory: '.');
// reported version should increment the number after the dash
expect(gitTagVersion.frameworkVersionFor(headRevision), '1.2.3-3.0.pre.12');
// reported version should increment the y
expect(gitTagVersion.frameworkVersionFor(headRevision), '1.3.0-0.0.pre.12');
});

testUsingContext('determine does not call fetch --tags', () {
Expand Down

0 comments on commit 1d59d8d

Please sign in to comment.