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(shorebird_cli): shorebird patch ios-alpha handle BuildException when building IPA #1045

Merged
merged 1 commit into from
Aug 7, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ Please re-run the release command for this version or create a new release.''');
} on ProcessException catch (error) {
buildProgress.fail('Failed to build: ${error.message}');
return ExitCode.software.code;
} on BuildException catch (error) {
buildProgress.fail('Failed to build IPA');
logger.err(error.message);
return ExitCode.software.code;
}

final File aotFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,44 @@ Please re-run the release command for this version or create a new release.'''),
expect(exitCode, equals(ExitCode.software.code));
});

test('exits with code 70 when building fails (due to BuildException)',
() async {
when(() => flutterBuildProcessResult.exitCode).thenReturn(0);
when(() => flutterBuildProcessResult.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
''');

final tempDir = setUpTempDir();
final exitCode = await IOOverrides.runZoned(
() => runWithOverrides(command.run),
getCurrentDirectory: () => tempDir,
);

expect(exitCode, equals(ExitCode.software.code));
verify(
() => progress.fail(any(that: contains('Failed to build'))),
).called(1);
verify(
() => logger.err('''
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'''),
).called(1);
});

test('throws error when creating aot snapshot fails', () async {
const error = 'oops something went wrong';
when(() => aotBuildProcessResult.exitCode).thenReturn(1);
Expand Down