Skip to content

Commit

Permalink
fix(shorebird_cli): buildIpa error parsing in Xcode >= 16.0 (#2593)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel authored Oct 29, 2024
1 parent 32d66e7 commit 4ed439c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/shorebird_cli/lib/src/artifact_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ Please file a bug at https://github.com/shorebirdtech/shorebird/issues/new with
// error: exportArchive: Communication with Apple failed
// error: exportArchive: No signing certificate "iOS Distribution" found
// error: exportArchive: Communication with Apple failed
final exportArchiveRegex = RegExp(r'error: exportArchive: (.+)$');

final exportArchiveRegex = RegExp(r'error: exportArchive:? (.+)$');
return stderr
.split('\n')
.map((l) => l.trim())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:async';
import 'dart:io';

import 'package:crypto/crypto.dart';
import 'package:io/io.dart';
import 'package:mason_logger/mason_logger.dart';
import 'package:path/path.dart' as p;
import 'package:shorebird_cli/src/archive_analysis/android_archive_differ.dart';
Expand Down
43 changes: 42 additions & 1 deletion packages/shorebird_cli/test/src/artifact_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ Either run `flutter pub get` manually, or follow the steps in ${cannotRunInVSCod
});
});

group('with error message in stderr', () {
group('with error message in stderr (Xcode <= 15.x)', () {
setUp(() {
when(() => buildProcessResult.exitCode)
.thenReturn(ExitCode.success.code);
Expand Down Expand Up @@ -908,6 +908,47 @@ error: exportArchive: No signing certificate "iOS Distribution" found''',
'message',
'''
Failed to build:
Communication with Apple failed
No signing certificate "iOS Distribution" found
Team "My Team" does not have permission to create "iOS App Store" provisioning profiles.
No profiles for 'com.example.co' were found''',
),
),
);
});
});

group('with error message in stderr (Xcode >= 16.x)', () {
setUp(() {
when(() => buildProcessResult.exitCode)
.thenReturn(ExitCode.success.code);
when(() => buildProcessResult.stderr).thenReturn(
'''
Encountered error while creating the IPA:
error: exportArchive Communication with Apple failed
error: exportArchive No signing certificate "iOS Distribution" found
error: exportArchive Communication with Apple failed
error: exportArchive No signing certificate "iOS Distribution" found
error: exportArchive Team "My Team" does not have permission to create "iOS App Store" provisioning profiles.
error: exportArchive No profiles for 'com.example.co' were found
error: exportArchive Communication with Apple failed
error: exportArchive No signing certificate "iOS Distribution" found
error: exportArchive Communication with Apple failed
error: exportArchive No signing certificate "iOS Distribution" found
error: exportArchive Communication with Apple failed
error: exportArchive No signing certificate "iOS Distribution" found''',
);
});

test('throws ArtifactBuildException with error message', () {
expect(
() => runWithOverrides(() => builder.buildIpa(codesign: false)),
throwsA(
isA<ArtifactBuildException>().having(
(e) => e.message,
'message',
'''
Failed to build:
Communication with Apple failed
No signing certificate "iOS Distribution" found
Team "My Team" does not have permission to create "iOS App Store" provisioning profiles.
Expand Down

0 comments on commit 4ed439c

Please sign in to comment.