mirror of
https://github.com/flutter/flutter
synced 2024-10-13 11:42:54 +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);
|
], workingDirectory: fs.currentDirectory.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<XcodeProjectInfo> getInfo(String projectPath) async {
|
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async {
|
||||||
final RunResult result = await runCheckedAsync(<String>[
|
final RunResult result = await runCheckedAsync(<String>[
|
||||||
_executable, '-list',
|
_executable,
|
||||||
|
'-list',
|
||||||
|
if (projectFilename != null) ...<String>['-project', projectFilename],
|
||||||
], workingDirectory: projectPath);
|
], workingDirectory: projectPath);
|
||||||
return XcodeProjectInfo.fromXcodeBuildOutput(result.toString());
|
return XcodeProjectInfo.fromXcodeBuildOutput(result.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,9 +44,12 @@ Future<void> buildMacOS({
|
||||||
flutterProject.macos.outputFileList.createSync(recursive: true);
|
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);
|
final String scheme = projectInfo.schemeFor(buildInfo);
|
||||||
if (scheme == null) {
|
if (scheme == null) {
|
||||||
throwToolExit('Unable to find expected scheme in Xcode project.');
|
throwToolExit('Unable to find expected scheme in Xcode project.');
|
||||||
|
@ -62,7 +65,7 @@ Future<void> buildMacOS({
|
||||||
'/usr/bin/env',
|
'/usr/bin/env',
|
||||||
'xcrun',
|
'xcrun',
|
||||||
'xcodebuild',
|
'xcodebuild',
|
||||||
'-workspace', xcodeWorkspace.path,
|
'-workspace', flutterProject.macos.xcodeWorkspace.path,
|
||||||
'-configuration', '$configuration',
|
'-configuration', '$configuration',
|
||||||
'-scheme', 'Runner',
|
'-scheme', 'Runner',
|
||||||
'-derivedDataPath', flutterBuildDir.absolute.path,
|
'-derivedDataPath', flutterBuildDir.absolute.path,
|
||||||
|
@ -92,4 +95,4 @@ Future<void> buildMacOS({
|
||||||
throwToolExit('Build process failed');
|
throwToolExit('Build process failed');
|
||||||
}
|
}
|
||||||
flutterUsage.sendTiming('build', 'xcode-macos', Duration(milliseconds: sw.elapsedMilliseconds));
|
flutterUsage.sendTiming('build', 'xcode-macos', Duration(milliseconds: sw.elapsedMilliseconds));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import '../../src/testbed.dart';
|
||||||
|
|
||||||
class FakeXcodeProjectInterpreterWithProfile extends FakeXcodeProjectInterpreter {
|
class FakeXcodeProjectInterpreterWithProfile extends FakeXcodeProjectInterpreter {
|
||||||
@override
|
@override
|
||||||
Future<XcodeProjectInfo> getInfo(String projectPath) async {
|
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async {
|
||||||
return XcodeProjectInfo(
|
return XcodeProjectInfo(
|
||||||
<String>['Runner'],
|
<String>['Runner'],
|
||||||
<String>['Debug', 'Profile', 'Release'],
|
<String>['Debug', 'Profile', 'Release'],
|
||||||
|
|
|
@ -90,7 +90,7 @@ class MockXcode extends Mock implements Xcode {}
|
||||||
|
|
||||||
class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {
|
class MockXcodeProjectInterpreter extends Mock implements XcodeProjectInterpreter {
|
||||||
@override
|
@override
|
||||||
Future<XcodeProjectInfo> getInfo(String projectPath) async {
|
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async {
|
||||||
return XcodeProjectInfo(null, null, <String>['Runner']);
|
return XcodeProjectInfo(null, null, <String>['Runner']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -349,7 +349,7 @@ class FakeXcodeProjectInterpreter implements XcodeProjectInterpreter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<XcodeProjectInfo> getInfo(String projectPath) async {
|
Future<XcodeProjectInfo> getInfo(String projectPath, {String projectFilename}) async {
|
||||||
return XcodeProjectInfo(
|
return XcodeProjectInfo(
|
||||||
<String>['Runner'],
|
<String>['Runner'],
|
||||||
<String>['Debug', 'Release'],
|
<String>['Debug', 'Release'],
|
||||||
|
|
Loading…
Reference in a new issue