Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure windows releases include build number #2746

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/shorebird_cli/lib/src/executables/powershell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ class Powershell {
runInShell: true,
);

return (result.stdout as String).trim();
var versionString = (result.stdout as String).trim();
if (!versionString.contains('+')) {
versionString += '+0';
bryanoltman marked this conversation as resolved.
Show resolved Hide resolved
}
return versionString;
}
}
33 changes: 25 additions & 8 deletions packages/shorebird_cli/test/src/executables/powershell_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,33 @@ void main() {
});

group('when exit code is success', () {
setUp(() {
when(() => processResult.exitCode).thenReturn(0);
when(() => processResult.stdout).thenReturn('1.0.0');
group('when version code includes a build number', () {
setUp(() {
when(() => processResult.exitCode).thenReturn(0);
when(() => processResult.stdout).thenReturn('1.0.0+1');
});

test('returns unaltered version string', () async {
final version = await runWithOverrides(
() => powershell.getExeVersionString(File('')),
);
expect(version, '1.0.0+1');
});
});

test('returns the version string', () async {
final version = await runWithOverrides(
() => powershell.getExeVersionString(File('')),
);
expect(version, '1.0.0');
group('when version code does not include a build number', () {
setUp(() {
when(() => processResult.exitCode).thenReturn(0);
when(() => processResult.stdout).thenReturn('1.0.0');
});

test('returns the version string with build number 0 added',
() async {
final version = await runWithOverrides(
() => powershell.getExeVersionString(File('')),
);
expect(version, '1.0.0+0');
});
});
});
});
Expand Down
Loading