fix: improve flutter minimum support version check for windows (#2747)
This commit is contained in:
@@ -65,7 +65,11 @@ To change the version of this release, change your app's version in your pubspec
|
||||
if (flutterVersionArg != null) {
|
||||
final version =
|
||||
await shorebirdFlutter.resolveFlutterVersion(flutterVersionArg);
|
||||
if (version != null && version < minimumSupportedWindowsFlutterVersion) {
|
||||
final gitHash =
|
||||
await shorebirdFlutter.getRevisionForVersion(flutterVersionArg);
|
||||
if (version != null &&
|
||||
version < minimumSupportedWindowsFlutterVersion &&
|
||||
!windowsFlutterGitHashesBelowMinVersion.contains(gitHash)) {
|
||||
logger.err(
|
||||
'''
|
||||
Windows releases are not supported with Flutter versions older than $minimumSupportedWindowsFlutterVersion.
|
||||
|
||||
@@ -10,7 +10,12 @@ import 'package:pub_semver/pub_semver.dart';
|
||||
const primaryWindowsReleaseArtifactArch = 'win_archive';
|
||||
|
||||
/// The minimum allowed Flutter version for creating Windows releases.
|
||||
final minimumSupportedWindowsFlutterVersion = Version(3, 27, 1);
|
||||
final minimumSupportedWindowsFlutterVersion = Version(3, 27, 2);
|
||||
|
||||
/// Revisions of Flutter 3.27.1 that support windows.
|
||||
const windowsFlutterGitHashesBelowMinVersion = {
|
||||
'56228c343d6c7fd3e1e548dbb290f9713bb22aa9'
|
||||
};
|
||||
|
||||
/// A warning message printed at the start of `shorebird release windows` and
|
||||
/// `shorebird patch windows` commands.
|
||||
|
||||
@@ -222,11 +222,12 @@ To change the version of this release, change your app's version in your pubspec
|
||||
),
|
||||
).thenAnswer((_) async {});
|
||||
when(() => argResults['flutter-version'] as String?)
|
||||
.thenReturn('1.2.3');
|
||||
when(() => shorebirdFlutter.resolveFlutterVersion('1.2.3'))
|
||||
.thenAnswer((_) async => Version(1, 2, 3));
|
||||
when(() => shorebirdFlutter.getVersionAndRevision())
|
||||
.thenAnswer((_) async => '3.27.1');
|
||||
.thenReturn('3.27.1');
|
||||
when(() => shorebirdFlutter.resolveFlutterVersion('3.27.1'))
|
||||
.thenAnswer((_) async => Version(3, 27, 1));
|
||||
when(
|
||||
() => shorebirdFlutter.getRevisionForVersion(any()),
|
||||
).thenAnswer((_) async => 'deadbeef');
|
||||
});
|
||||
|
||||
test('logs error and exits with usage err', () async {
|
||||
@@ -243,6 +244,22 @@ For more information see: ${supportedFlutterVersionsUrl.toLink()}''',
|
||||
),
|
||||
).called(1);
|
||||
});
|
||||
|
||||
group('when flutter version is 3.27.1 but hash is supported', () {
|
||||
setUp(() {
|
||||
when(
|
||||
() => shorebirdFlutter.getRevisionForVersion(any()),
|
||||
).thenAnswer(
|
||||
(_) async => windowsFlutterGitHashesBelowMinVersion.first);
|
||||
});
|
||||
|
||||
test('completes normally', () async {
|
||||
await expectLater(
|
||||
runWithOverrides(releaser.assertPreconditions),
|
||||
completes,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user