make sure we exit early if the Runner.xcodeproj file is missing (#31591)

This commit is contained in:
Jonah Williams
2019-04-25 00:12:17 -07:00
committed by GitHub
parent 8cfc92465d
commit 482078387e
2 changed files with 15 additions and 1 deletions

View File

@@ -318,8 +318,13 @@ abstract class IOSApp extends ApplicationPackage {
if (getCurrentHostPlatform() != HostPlatform.darwin_x64) {
return null;
}
// TODO(jonahwilliams): do more verification in this check.
if (!project.exists) {
// If the project doesn't exist at all the existing hint to run flutter
// create is accurate.
return null;
}
if (!project.xcodeProject.existsSync()) {
printError('Expected ios/Runner.xcodeproj but this file is missing.');
return null;
}
return BuildableIOSApp(project);

View File

@@ -285,6 +285,15 @@ void main() {
expect(iosApp, null);
}, overrides: overrides);
testUsingContext('returns null when there is no Runner.xcodeproj', () async {
fs.file('pubspec.yaml').createSync();
fs.file('.packages').createSync();
fs.file('ios/FooBar.xcodeproj').createSync(recursive: true);
final BuildableIOSApp iosApp = IOSApp.fromIosProject((await FlutterProject.fromDirectory(fs.currentDirectory)).ios);
expect(iosApp, null);
}, overrides: overrides);
});
}