diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart index 8c54c61d165..7a52b5552d9 100644 --- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart @@ -324,9 +324,11 @@ class XcodeProjectInterpreter { ], workingDirectory: fs.currentDirectory.path); } - Future getInfo(String projectPath) async { + Future getInfo(String projectPath, {String projectFilename}) async { final RunResult result = await runCheckedAsync([ - _executable, '-list', + _executable, + '-list', + if (projectFilename != null) ...['-project', projectFilename], ], workingDirectory: projectPath); return XcodeProjectInfo.fromXcodeBuildOutput(result.toString()); } diff --git a/packages/flutter_tools/lib/src/macos/build_macos.dart b/packages/flutter_tools/lib/src/macos/build_macos.dart index 14c41738fec..0aa94f57c2b 100644 --- a/packages/flutter_tools/lib/src/macos/build_macos.dart +++ b/packages/flutter_tools/lib/src/macos/build_macos.dart @@ -44,9 +44,12 @@ Future buildMacOS({ flutterProject.macos.outputFileList.createSync(recursive: true); } - final Directory xcodeWorkspace = flutterProject.macos.xcodeWorkspace; + final Directory xcodeProject = flutterProject.macos.xcodeProject; - final XcodeProjectInfo projectInfo = await xcodeProjectInterpreter.getInfo(xcodeWorkspace.parent.path); + final XcodeProjectInfo projectInfo = await xcodeProjectInterpreter.getInfo( + xcodeProject.parent.path, + projectFilename: xcodeProject.basename, + ); final String scheme = projectInfo.schemeFor(buildInfo); if (scheme == null) { throwToolExit('Unable to find expected scheme in Xcode project.'); @@ -62,7 +65,7 @@ Future buildMacOS({ '/usr/bin/env', 'xcrun', 'xcodebuild', - '-workspace', xcodeWorkspace.path, + '-workspace', flutterProject.macos.xcodeWorkspace.path, '-configuration', '$configuration', '-scheme', 'Runner', '-derivedDataPath', flutterBuildDir.absolute.path, @@ -92,4 +95,4 @@ Future buildMacOS({ throwToolExit('Build process failed'); } flutterUsage.sendTiming('build', 'xcode-macos', Duration(milliseconds: sw.elapsedMilliseconds)); -} \ No newline at end of file +} diff --git a/packages/flutter_tools/test/general.shard/commands/build_macos_test.dart b/packages/flutter_tools/test/general.shard/commands/build_macos_test.dart index 9efeb3b97d5..00535ff9916 100644 --- a/packages/flutter_tools/test/general.shard/commands/build_macos_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/build_macos_test.dart @@ -25,7 +25,7 @@ import '../../src/testbed.dart'; class FakeXcodeProjectInterpreterWithProfile extends FakeXcodeProjectInterpreter { @override - Future getInfo(String projectPath) async { + Future getInfo(String projectPath, {String projectFilename}) async { return XcodeProjectInfo( ['Runner'], ['Debug', 'Profile', 'Release'], diff --git a/packages/flutter_tools/test/general.shard/commands/clean_test.dart b/packages/flutter_tools/test/general.shard/commands/clean_test.dart index 84860819592..932ea391774 100644 --- a/packages/flutter_tools/test/general.shard/commands/clean_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/clean_test.dart @@ -90,7 +90,7 @@ class MockXcode extends Mock implements Xcode {} class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter { @override - Future getInfo(String projectPath) async { + Future getInfo(String projectPath, {String projectFilename}) async { return XcodeProjectInfo(null, null, ['Runner']); } } diff --git a/packages/flutter_tools/test/src/context.dart b/packages/flutter_tools/test/src/context.dart index 3f516b6712b..c28e2608e83 100644 --- a/packages/flutter_tools/test/src/context.dart +++ b/packages/flutter_tools/test/src/context.dart @@ -349,7 +349,7 @@ class FakeXcodeProjectInterpreter implements XcodeProjectInterpreter { } @override - Future getInfo(String projectPath) async { + Future getInfo(String projectPath, {String projectFilename}) async { return XcodeProjectInfo( ['Runner'], ['Debug', 'Release'],