Pass 'build ios' device ID into xcodebuild (#96669)
This commit is contained in:
parent
25b2edbda0
commit
114185f686
@ -269,6 +269,7 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
||||
codesign: shouldCodesign,
|
||||
configOnly: configOnly,
|
||||
buildAction: xcodeBuildAction,
|
||||
deviceID: globals.deviceManager?.specifiedDeviceId,
|
||||
);
|
||||
|
||||
if (!result.success) {
|
||||
|
@ -112,7 +112,13 @@ void main() {
|
||||
|
||||
// Creates a FakeCommand for the xcodebuild call to build the app
|
||||
// in the given configuration.
|
||||
FakeCommand _setUpFakeXcodeBuildHandler({ bool verbose = false, bool simulator = false, int exitCode = 0, void Function() onRun }) {
|
||||
FakeCommand _setUpFakeXcodeBuildHandler({
|
||||
bool verbose = false,
|
||||
bool simulator = false,
|
||||
String deviceId,
|
||||
int exitCode = 0,
|
||||
void Function() onRun,
|
||||
}) {
|
||||
return FakeCommand(
|
||||
command: <String>[
|
||||
'xcrun',
|
||||
@ -132,10 +138,16 @@ void main() {
|
||||
'-sdk',
|
||||
if (simulator) ...<String>[
|
||||
'iphonesimulator',
|
||||
] else ...<String>[
|
||||
'iphoneos',
|
||||
],
|
||||
if (deviceId != null) ...<String>[
|
||||
'-destination',
|
||||
'id=$deviceId',
|
||||
] else if (simulator) ...<String>[
|
||||
'-destination',
|
||||
'generic/platform=iOS Simulator',
|
||||
] else ...<String>[
|
||||
'iphoneos',
|
||||
'-destination',
|
||||
'generic/platform=iOS',
|
||||
],
|
||||
@ -220,6 +232,27 @@ void main() {
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||
});
|
||||
|
||||
testUsingContext('ios build invokes xcode build with device ID', () async {
|
||||
final BuildCommand command = BuildCommand();
|
||||
_createMinimalMockProjectFiles();
|
||||
|
||||
await createTestCommandRunner(command).run(
|
||||
const <String>['build', 'ios', '--no-pub', '--device-id', '1234']
|
||||
);
|
||||
expect(testLogger.statusText, contains('build/ios/iphoneos/Runner.app'));
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
_setUpFakeXcodeBuildHandler(deviceId: '1234', onRun: () {
|
||||
fileSystem.directory('build/ios/Release-iphoneos/Runner.app').createSync(recursive: true);
|
||||
}),
|
||||
_setUpRsyncCommand(),
|
||||
]),
|
||||
Platform: () => macosPlatform,
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||
});
|
||||
|
||||
testUsingContext('ios simulator build invokes xcode build', () async {
|
||||
final BuildCommand command = BuildCommand();
|
||||
_createMinimalMockProjectFiles();
|
||||
|
Loading…
x
Reference in New Issue
Block a user