diff --git a/packages/flutter_tools/lib/src/macos/build_macos.dart b/packages/flutter_tools/lib/src/macos/build_macos.dart index c456f39350..07c2c8c326 100644 --- a/packages/flutter_tools/lib/src/macos/build_macos.dart +++ b/packages/flutter_tools/lib/src/macos/build_macos.dart @@ -38,7 +38,7 @@ Future buildMacOS(FlutterProject flutterProject, BuildInfo buildInfo) asyn '/usr/bin/env', 'xcrun', 'xcodebuild', - '-project', flutterProject.macos.xcodeProjectFile.path, + '-workspace', flutterProject.macos.xcodeWorkspace.path, '-configuration', '$config', '-scheme', 'Runner', '-derivedDataPath', flutterBuildDir.absolute.path, diff --git a/packages/flutter_tools/lib/src/project.dart b/packages/flutter_tools/lib/src/project.dart index 8fec10ac47..42ea0bbc81 100644 --- a/packages/flutter_tools/lib/src/project.dart +++ b/packages/flutter_tools/lib/src/project.dart @@ -571,6 +571,8 @@ class MacOSProject { final FlutterProject project; + static const String _hostAppBundleName = 'Runner'; + bool existsSync() => project.directory.childDirectory('macos').existsSync(); Directory get _editableDirectory => project.directory.childDirectory('macos'); @@ -582,7 +584,10 @@ class MacOSProject { File get generatedXcodePropertiesFile => _cacheDirectory.childFile('Generated.xcconfig'); /// The Xcode project file. - Directory get xcodeProjectFile => _editableDirectory.childDirectory('Runner.xcodeproj'); + Directory get xcodeProject => _editableDirectory.childDirectory('$_hostAppBundleName.xcodeproj'); + + /// The Xcode workspace file. + Directory get xcodeWorkspace => _editableDirectory.childDirectory('$_hostAppBundleName.xcworkspace'); /// The file where the Xcode build will write the name of the built app. /// diff --git a/packages/flutter_tools/test/commands/build_macos_test.dart b/packages/flutter_tools/test/commands/build_macos_test.dart index 7b600326cd..946cb41400 100644 --- a/packages/flutter_tools/test/commands/build_macos_test.dart +++ b/packages/flutter_tools/test/commands/build_macos_test.dart @@ -75,7 +75,7 @@ void main() { '/usr/bin/env', 'xcrun', 'xcodebuild', - '-project', flutterProject.macos.xcodeProjectFile.path, + '-workspace', flutterProject.macos.xcodeWorkspace.path, '-configuration', 'Debug', '-scheme', 'Runner', '-derivedDataPath', flutterBuildDir.absolute.path,