Unverified Commit fdae7bb8 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

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

parent 0acd3e6b
...@@ -319,7 +319,7 @@ abstract class IOSApp extends ApplicationPackage { ...@@ -319,7 +319,7 @@ abstract class IOSApp extends ApplicationPackage {
return null; return null;
} }
if (!project.exists) { 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. // create is accurate.
return null; return null;
} }
...@@ -327,6 +327,10 @@ abstract class IOSApp extends ApplicationPackage { ...@@ -327,6 +327,10 @@ abstract class IOSApp extends ApplicationPackage {
printError('Expected ios/Runner.xcodeproj but this file is missing.'); printError('Expected ios/Runner.xcodeproj but this file is missing.');
return null; return null;
} }
if (!project.xcodeProjectInfoFile.existsSync()) {
printError('Expected ios/Runner.xcodeproj/project.pbxproj but this file is missing.');
return null;
}
return BuildableIOSApp(project); return BuildableIOSApp(project);
} }
......
...@@ -294,6 +294,15 @@ void main() { ...@@ -294,6 +294,15 @@ void main() {
expect(iosApp, null); expect(iosApp, null);
}, overrides: overrides); }, 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);
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment