add check that xcode project configuration is not missing (#31621)

This commit is contained in:
Jonah Williams
2019-04-25 15:51:25 -07:00
committed by GitHub
parent 0acd3e6b04
commit fdae7bb871
2 changed files with 14 additions and 1 deletions

View File

@@ -319,7 +319,7 @@ abstract class IOSApp extends ApplicationPackage {
return null;
}
if (!project.exists) {
// If the project doesn't exist at all the existing hint to run flutter
// If the project doesn't exist at all the current hint to run flutter
// create is accurate.
return null;
}
@@ -327,6 +327,10 @@ abstract class IOSApp extends ApplicationPackage {
printError('Expected ios/Runner.xcodeproj but this file is missing.');
return null;
}
if (!project.xcodeProjectInfoFile.existsSync()) {
printError('Expected ios/Runner.xcodeproj/project.pbxproj but this file is missing.');
return null;
}
return BuildableIOSApp(project);
}

View File

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