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

feat(shorebird_cli): require Flutter >=3.22.2 for iOS #2218

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 14 additions & 3 deletions packages/shorebird_cli/lib/src/commands/patch/ios_patcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,21 @@ class IosPatcher extends Patcher {

try {
final shouldCodesign = argResults['codesign'] == true;
final flutterVersionString =
await shorebirdFlutter.getVersionAndRevision();
final (flutterVersionAndRevision, flutterVersion) = await (
shorebirdFlutter.getVersionAndRevision(),
shorebirdFlutter.getVersion(),
).wait;

if ((flutterVersion ?? minimumSupportedIosFlutterVersion) <

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this rule should apply to new builds and not patches ?

minimumSupportedIosFlutterVersion) {
logger.err(
'''iOS patches are not supported with Flutter versions older than $minimumSupportedIosFlutterVersion.''',
);
exit(ExitCode.software.code);
}

final buildProgress = logger.progress(
'Building patch with Flutter $flutterVersionString',
'Building patch with Flutter $flutterVersionAndRevision',
);
final IpaBuildResult ipaBuildResult;
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/shorebird_cli/lib/src/platform/ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class InvalidExportOptionsPlistException implements Exception {
}

/// The minimum allowed Flutter version for creating iOS releases.
final minimumSupportedIosFlutterVersion = Version(3, 19, 5);
final minimumSupportedIosFlutterVersion = Version(3, 22, 2);

/// A reference to a [Ios] instance.
final iosRef = create(Ios.new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:mason_logger/mason_logger.dart';
import 'package:mocktail/mocktail.dart';
import 'package:path/path.dart' as p;
import 'package:platform/platform.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:scoped_deps/scoped_deps.dart';
import 'package:shorebird_cli/src/archive_analysis/archive_analysis.dart';
import 'package:shorebird_cli/src/artifact_builder.dart';
Expand Down Expand Up @@ -267,14 +268,48 @@ void main() {
});

group('buildPatchArtifact', () {
const flutterVersionAndRevision = '3.10.6 (83305b5088)';

const flutterVersionAndRevision = '3.22.2 (83305b5088)';
setUp(() {
when(
() => shorebirdFlutter.getVersionAndRevision(),
).thenAnswer((_) async => flutterVersionAndRevision);
});

group('when specified flutter version is less than minimum', () {
setUp(() {
when(
() => shorebirdValidator.validatePreconditions(
checkUserIsAuthenticated: any(
named: 'checkUserIsAuthenticated',
),
checkShorebirdInitialized: any(
named: 'checkShorebirdInitialized',
),
validators: any(named: 'validators'),
supportedOperatingSystems: any(
named: 'supportedOperatingSystems',
),
),
).thenAnswer((_) async {});
when(
() => shorebirdFlutter.getVersion(),
).thenAnswer((_) async => Version(3, 0, 0));
});

test('logs error and exits with code 70', () async {
await expectLater(
() => runWithOverrides(patcher.buildPatchArtifact),
exitsWithCode(ExitCode.software),
);

verify(
() => logger.err(
'''iOS patches are not supported with Flutter versions older than $minimumSupportedIosFlutterVersion.''',
),
).called(1);
});
});

group('when exportOptionsPlist fails', () {
setUp(() {
when(() => ios.exportOptionsPlistFromArgs(any())).thenThrow(
Expand Down
Loading