fix(shorebird_cli): handle renamed Runner (#1649)
This commit is contained in:
@@ -298,13 +298,15 @@ Current Flutter Revision: $originalFlutterRevision
|
||||
return tempDir.path;
|
||||
});
|
||||
unzipProgress.complete();
|
||||
|
||||
final appDirectory =
|
||||
getAppDirectory(xcarchiveDirectory: Directory(releaseXcarchivePath));
|
||||
if (appDirectory == null) {
|
||||
logger.err('Unable to find release artifact .app directory');
|
||||
return ExitCode.software.code;
|
||||
}
|
||||
final releaseArtifactFile = File(
|
||||
p.join(
|
||||
releaseXcarchivePath,
|
||||
'Products',
|
||||
'Applications',
|
||||
'Runner.app',
|
||||
appDirectory.path,
|
||||
'Frameworks',
|
||||
'App.framework',
|
||||
'App',
|
||||
|
||||
@@ -177,16 +177,19 @@ make smaller updates to your app.
|
||||
|
||||
buildProgress.complete();
|
||||
|
||||
final archivePath = getXcarchiveDirectory()?.path;
|
||||
if (archivePath == null) {
|
||||
final archiveDirectory = getXcarchiveDirectory();
|
||||
if (archiveDirectory == null) {
|
||||
logger.err('Unable to find .xcarchive directory');
|
||||
return ExitCode.software.code;
|
||||
}
|
||||
final runnerPath = getAppDirectory()?.path;
|
||||
if (runnerPath == null) {
|
||||
final archivePath = archiveDirectory.path;
|
||||
|
||||
final appDirectory = getAppDirectory(xcarchiveDirectory: archiveDirectory);
|
||||
if (appDirectory == null) {
|
||||
logger.err('Unable to find .app directory');
|
||||
return ExitCode.software.code;
|
||||
}
|
||||
final runnerPath = appDirectory.path;
|
||||
|
||||
final plistFile = File(p.join(archivePath, 'Info.plist'));
|
||||
if (!plistFile.existsSync()) {
|
||||
|
||||
@@ -93,15 +93,10 @@ mixin ShorebirdArtifactMixin on ShorebirdCommand {
|
||||
|
||||
/// Returns the .app directory generated by `flutter build ipa`. This was
|
||||
/// traditionally named `Runner.app`, but can now be renamed.
|
||||
Directory? getAppDirectory() {
|
||||
final archiveDirectory = getXcarchiveDirectory();
|
||||
if (archiveDirectory == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Directory? getAppDirectory({required Directory xcarchiveDirectory}) {
|
||||
final applicationsDirectory = Directory(
|
||||
p.join(
|
||||
archiveDirectory.path,
|
||||
xcarchiveDirectory.path,
|
||||
'Products',
|
||||
'Applications',
|
||||
),
|
||||
|
||||
@@ -349,7 +349,21 @@ flutter:
|
||||
zipFile: any(named: 'zipFile'),
|
||||
outputDirectory: any(named: 'outputDirectory'),
|
||||
),
|
||||
).thenAnswer((_) async {});
|
||||
).thenAnswer((invocation) async {
|
||||
final outputDirectory =
|
||||
invocation.namedArguments[#outputDirectory] as Directory;
|
||||
File(
|
||||
p.join(
|
||||
outputDirectory.path,
|
||||
'Products',
|
||||
'Applications',
|
||||
'App.app',
|
||||
'Frameworks',
|
||||
'App.framework',
|
||||
'App',
|
||||
),
|
||||
).createSync(recursive: true);
|
||||
});
|
||||
when(
|
||||
() => artifactManager.createDiff(
|
||||
releaseArtifactPath: any(named: 'releaseArtifactPath'),
|
||||
@@ -906,6 +920,29 @@ Please re-run the release command for this version or create a new release.'''),
|
||||
).called(1);
|
||||
});
|
||||
|
||||
group('when release artifact fails to extract', () {
|
||||
setUp(() {
|
||||
setUpProjectRoot();
|
||||
setUpProjectRootArtifacts();
|
||||
|
||||
when(
|
||||
() => artifactManager.extractZip(
|
||||
zipFile: any(named: 'zipFile'),
|
||||
outputDirectory: any(named: 'outputDirectory'),
|
||||
),
|
||||
).thenAnswer((invocation) async {});
|
||||
});
|
||||
|
||||
test('prints error message and exits with code 70', () async {
|
||||
final exitCode = await runWithOverrides(command.run);
|
||||
|
||||
expect(exitCode, equals(ExitCode.software.code));
|
||||
verify(
|
||||
() => logger.err('Unable to find release artifact .app directory'),
|
||||
).called(1);
|
||||
});
|
||||
});
|
||||
|
||||
test(
|
||||
'''exits with code 70 if zipAndConfirmUnpatchableDiffsIfNecessary throws UnpatchableChangeException''',
|
||||
() async {
|
||||
|
||||
Reference in New Issue
Block a user