Only try to get build settings if the Xcode project exists (#61979)
This commit is contained in:
parent
fe781e7e78
commit
fe670c04cc
@ -521,7 +521,7 @@ class IosProject extends FlutterProjectPlatform implements XcodeBasedProject {
|
|||||||
Map<String, Map<String, String>> _buildSettingsByScheme;
|
Map<String, Map<String, String>> _buildSettingsByScheme;
|
||||||
|
|
||||||
Future<XcodeProjectInfo> projectInfo() async {
|
Future<XcodeProjectInfo> projectInfo() async {
|
||||||
if (!existsSync() || !globals.xcodeProjectInterpreter.isInstalled) {
|
if (!xcodeProject.existsSync() || !globals.xcodeProjectInterpreter.isInstalled) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return _projectInfo ??= await globals.xcodeProjectInterpreter.getInfo(hostAppRoot.path);
|
return _projectInfo ??= await globals.xcodeProjectInterpreter.getInfo(hostAppRoot.path);
|
||||||
|
@ -332,6 +332,7 @@ apply plugin: 'kotlin-android'
|
|||||||
|
|
||||||
testWithMocks('from build settings, if no plist', () async {
|
testWithMocks('from build settings, if no plist', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
|
project.ios.xcodeProject.createSync();
|
||||||
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
|
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
|
||||||
(_) {
|
(_) {
|
||||||
return Future<Map<String,String>>.value(<String, String>{
|
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 {
|
testWithMocks('from build settings and plist, if default variable', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
|
project.ios.xcodeProject.createSync();
|
||||||
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
|
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
|
||||||
(_) {
|
(_) {
|
||||||
return Future<Map<String,String>>.value(<String, String>{
|
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 {
|
testWithMocks('from build settings and plist, by substitution', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
|
project.ios.xcodeProject.createSync();
|
||||||
project.ios.defaultHostInfoPlist.createSync(recursive: true);
|
project.ios.defaultHostInfoPlist.createSync(recursive: true);
|
||||||
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
|
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 {
|
testWithMocks('fails with no flavor and defined schemes', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
|
project.ios.xcodeProject.createSync();
|
||||||
when(mockXcodeProjectInterpreter.getInfo(any, projectFilename: anyNamed('projectFilename'))).thenAnswer( (_) {
|
when(mockXcodeProjectInterpreter.getInfo(any, projectFilename: anyNamed('projectFilename'))).thenAnswer( (_) {
|
||||||
return Future<XcodeProjectInfo>.value(XcodeProjectInfo(<String>[], <String>[], <String>['free', 'paid'], logger));
|
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 {
|
testWithMocks('handles case insensitive flavor', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
|
project.ios.xcodeProject.createSync();
|
||||||
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
|
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer(
|
||||||
(_) {
|
(_) {
|
||||||
return Future<Map<String,String>>.value(<String, String>{
|
return Future<Map<String,String>>.value(<String, String>{
|
||||||
@ -426,6 +431,7 @@ apply plugin: 'kotlin-android'
|
|||||||
|
|
||||||
testWithMocks('fails with flavor and default schemes', () async {
|
testWithMocks('fails with flavor and default schemes', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
|
project.ios.xcodeProject.createSync();
|
||||||
when(mockXcodeProjectInterpreter.getInfo(any, projectFilename: anyNamed('projectFilename'))).thenAnswer( (_) {
|
when(mockXcodeProjectInterpreter.getInfo(any, projectFilename: anyNamed('projectFilename'))).thenAnswer( (_) {
|
||||||
return Future<XcodeProjectInfo>.value(XcodeProjectInfo(<String>[], <String>[], <String>['Runner'], logger));
|
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 {
|
testUsingContext('app product name xcodebuild settings', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
|
project.ios.xcodeProject.createSync();
|
||||||
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer((_) {
|
when(mockXcodeProjectInterpreter.getBuildSettings(any, scheme: anyNamed('scheme'))).thenAnswer((_) {
|
||||||
return Future<Map<String,String>>.value(<String, String>{
|
return Future<Map<String,String>>.value(<String, String>{
|
||||||
'FULL_PRODUCT_NAME': 'My App.app'
|
'FULL_PRODUCT_NAME': 'My App.app'
|
||||||
@ -648,6 +655,7 @@ apply plugin: 'kotlin-android'
|
|||||||
|
|
||||||
testUsingContext('has watch companion', () async {
|
testUsingContext('has watch companion', () async {
|
||||||
final FlutterProject project = await someProject();
|
final FlutterProject project = await someProject();
|
||||||
|
project.ios.xcodeProject.createSync();
|
||||||
project.ios.hostAppRoot.childDirectory('WatchTarget').childFile('Info.plist').createSync(recursive: true);
|
project.ios.hostAppRoot.childDirectory('WatchTarget').childFile('Info.plist').createSync(recursive: true);
|
||||||
when(mockPlistUtils.getValueFromFile(any, 'WKCompanionAppBundleIdentifier')).thenReturn('io.flutter.someProject');
|
when(mockPlistUtils.getValueFromFile(any, 'WKCompanionAppBundleIdentifier')).thenReturn('io.flutter.someProject');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user