Unverified Commit fe670c04 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Only try to get build settings if the Xcode project exists (#61979)

parent fe781e7e
......@@ -521,7 +521,7 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
Map<String, Map<String, String>> _buildSettingsByScheme;
Future<XcodeProjectInfo> projectInfo() async {
if (!existsSync() || !globals.xcodeProjectInterpreter.isInstalled) {
if (!xcodeProject.existsSync() || !globals.xcodeProjectInterpreter.isInstalled) {
return null;
}
return _projectInfo ??= await globals.xcodeProjectInterpreter.getInfo(hostAppRoot.path);
......
......@@ -332,6 +332,7 @@ apply plugin: 'kotlin-android'
testWithMocks('from build settings, if no plist', () async {
final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync();
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
(_) {
return Future<Map<String,String>>.value(<String, String>{
......@@ -362,6 +363,7 @@ apply plugin: 'kotlin-android'
testWithMocks('from build settings and plist, if default variable', () async {
final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync();
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
(_) {
return Future<Map<String,String>>.value(<String, String>{
......@@ -379,6 +381,7 @@ apply plugin: 'kotlin-android'
testWithMocks('from build settings and plist, by substitution', () async {
final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync();
project.ios.defaultHostInfoPlist.createSync(recursive: true);
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
(_) {
......@@ -398,6 +401,7 @@ apply plugin: 'kotlin-android'
testWithMocks('fails with no flavor and defined schemes', () async {
final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync();
when(mockXcodeProjectInterpreter.getInfo(any, projectFilename: anyNamed('projectFilename'))).thenAnswer( (_) {
return Future<XcodeProjectInfo>.value(XcodeProjectInfo(<String>[], <String>[], <String>['free', 'paid'], logger));
});
......@@ -409,6 +413,7 @@ apply plugin: 'kotlin-android'
testWithMocks('handles case insensitive flavor', () async {
final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync();
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
(_) {
return Future<Map<String,String>>.value(<String, String>{
......@@ -426,6 +431,7 @@ apply plugin: 'kotlin-android'
testWithMocks('fails with flavor and default schemes', () async {
final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync();
when(mockXcodeProjectInterpreter.getInfo(any, projectFilename: anyNamed('projectFilename'))).thenAnswer( (_) {
return Future<XcodeProjectInfo>.value(XcodeProjectInfo(<String>[], <String>[], <String>['Runner'], logger));
});
......@@ -479,6 +485,7 @@ apply plugin: 'kotlin-android'
testUsingContext('app product name xcodebuild settings', () async {
final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync();
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer((_) {
return Future<Map<String,String>>.value(<String, String>{
'FULL_PRODUCT_NAME': 'My App.app'
......@@ -648,6 +655,7 @@ apply plugin: 'kotlin-android'
testUsingContext('has watch companion', () async {
final FlutterProject project = await someProject();
project.ios.xcodeProject.createSync();
project.ios.hostAppRoot.childDirectory('WatchTarget').childFile('Info.plist').createSync(recursive: true);
when(mockPlistUtils.getValueFromFile(any, 'WKCompanionAppBundleIdentifier')).thenReturn('io.flutter.someProject');
......
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