Skip to content

Commit 8361465

Browse files
[flutter_tools] change the way version is calculated on master (#110791)
1 parent d05cadb commit 8361465

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/flutter_tools/lib/src/version.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,9 @@ class GitTagVersion {
812812
return '$x.$y.$z+hotfix.${hotfix! + 1}.pre.$commits';
813813
}
814814
if (devPatch != null && devVersion != null) {
815-
// The next published release this commit will appear in will be a beta
816-
// release, thus increment [y].
817-
return '$x.${y! + 1}.0-0.0.pre.$commits';
815+
// The next tag that will contain this commit will be the next candidate
816+
// branch, which will increment the devVersion.
817+
return '$x.$y.0-${devVersion! + 1}.0.pre.$commits';
818818
}
819819
return '$x.$y.${z! + 1}-0.0.pre.$commits';
820820
}

packages/flutter_tools/test/general.shard/version_test.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ void main() {
440440
GitTagVersion gitTagVersion;
441441

442442
// Master channel
443-
gitTagVersion = GitTagVersion.parse('1.2.3-4.5.pre-13-g$hash');
444-
expect(gitTagVersion.frameworkVersionFor(hash), '1.3.0-0.0.pre.13');
445-
expect(gitTagVersion.gitTag, '1.2.3-4.5.pre');
443+
gitTagVersion = GitTagVersion.parse('1.2.0-4.5.pre-13-g$hash');
444+
expect(gitTagVersion.frameworkVersionFor(hash), '1.2.0-5.0.pre.13');
445+
expect(gitTagVersion.gitTag, '1.2.0-4.5.pre');
446446
expect(gitTagVersion.devVersion, 4);
447447
expect(gitTagVersion.devPatch, 5);
448448

@@ -543,7 +543,7 @@ void main() {
543543
});
544544

545545
testUsingContext('determine reports correct git describe version if HEAD is not at a tag', () {
546-
const String devTag = '1.2.3-2.0.pre';
546+
const String devTag = '1.2.0-2.0.pre';
547547
const String headRevision = 'abcd1234';
548548
const String commitsAhead = '12';
549549
final FakeProcessManager fakeProcessManager = FakeProcessManager.list(
@@ -565,8 +565,8 @@ void main() {
565565
final FakePlatform platform = FakePlatform();
566566

567567
final GitTagVersion gitTagVersion = GitTagVersion.determine(processUtils, platform, workingDirectory: '.');
568-
// reported version should increment the y
569-
expect(gitTagVersion.frameworkVersionFor(headRevision), '1.3.0-0.0.pre.12');
568+
// reported version should increment the m
569+
expect(gitTagVersion.frameworkVersionFor(headRevision), '1.2.0-3.0.pre.12');
570570
});
571571

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

0 commit comments

Comments
 (0)