mirror of
https://github.com/flutter/flutter
synced 2024-10-13 03:32:55 +00:00
Allow specifying a project for Xcode getInfo (#39782)
Avoids unnecessarily breaking projects that have another .xcodeproj in their macos/ directory, which worked until the addition of the getInfo call.
This commit is contained in:
parent
443892bd27
commit
3948e8759e
|
@ -324,9 +324,11 @@ class XcodeProjectInterpreter {
|
|||
], workingDirectory: fs.currentDirectory.path);
|
||||
}
|
||||
|
||||
Future<XcodeProjectInfo> getInfo(String projectPath) async {
|
||||
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async {
|
||||
final RunResult result = await runCheckedAsync(<String>[
|
||||
_executable, '-list',
|
||||
_executable,
|
||||
'-list',
|
||||
if (projectFilename != null) ...<String>['-project', projectFilename],
|
||||
], workingDirectory: projectPath);
|
||||
return XcodeProjectInfo.fromXcodeBuildOutput(result.toString());
|
||||
}
|
||||
|
|
|
@ -44,9 +44,12 @@ Future<void> 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<void> 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<void> buildMacOS({
|
|||
throwToolExit('Build process failed');
|
||||
}
|
||||
flutterUsage.sendTiming('build', 'xcode-macos', Duration(milliseconds: sw.elapsedMilliseconds));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import '../../src/testbed.dart';
|
|||
|
||||
class FakeXcodeProjectInterpreterWithProfile extends FakeXcodeProjectInterpreter {
|
||||
@override
|
||||
Future<XcodeProjectInfo> getInfo(String projectPath) async {
|
||||
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async {
|
||||
return XcodeProjectInfo(
|
||||
<String>['Runner'],
|
||||
<String>['Debug', 'Profile', 'Release'],
|
||||
|
|
|
@ -90,7 +90,7 @@ class MockXcode extends Mock implements Xcode {}
|
|||
|
||||
class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {
|
||||
@override
|
||||
Future<XcodeProjectInfo> getInfo(String projectPath) async {
|
||||
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async {
|
||||
return XcodeProjectInfo(null, null, <String>['Runner']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ class FakeXcodeProjectInterpreter implements XcodeProjectInterpreter {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<XcodeProjectInfo> getInfo(String projectPath) async {
|
||||
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async {
|
||||
return XcodeProjectInfo(
|
||||
<String>['Runner'],
|
||||
<String>['Debug', 'Release'],
|
||||
|
|
Loading…
Reference in a new issue