Extract launchSimulator to IOSBridge

Summary:
This is related to `simctl` functionality, so can be extracted there.

This will aid in future changes whereby we can hide `getDeviceSetPath` in the IOSBridge module

Reviewed By: passy

Differential Revision: D33842987

fbshipit-source-id: de292ce5afba3e7d79d8ba27c2b8852909d7e6f3
This commit is contained in:
Lawrence Lomax
2022-01-31 07:23:29 -08:00
committed by Facebook GitHub Bot
parent 8316a00ef7
commit 959a2a77d7
3 changed files with 19 additions and 18 deletions

View File

@@ -18,6 +18,8 @@ import {
ERR_NO_IDB_OR_XCODE_AVAILABLE,
IOSBridge,
makeIOSBridge,
getDeviceSetPath,
SimctlBridge,
} from './IOSBridge';
import {FlipperServerImpl} from '../../FlipperServerImpl';
import {notNull} from '../../utils/typeUtils';
@@ -57,6 +59,7 @@ export class IOSDeviceManager {
'PortForwardingMacApp',
);
iosBridge: IOSBridge | undefined;
simctlBridge: SimctlBridge = new SimctlBridge();
private xcodeVersionMismatchFound = false;
public xcodeCommandLineToolsDetected = false;
@@ -289,17 +292,6 @@ export class IOSDeviceManager {
}
}
function getDeviceSetPath() {
return process.env.DEVICE_SET_PATH
? ['--set', process.env.DEVICE_SET_PATH]
: [];
}
export async function launchSimulator(udid: string): Promise<any> {
await execFile('xcrun', ['simctl', ...getDeviceSetPath(), 'boot', udid]);
await execFile('open', ['-a', 'simulator']);
}
function getActiveDevices(
idbPath: string,
isPhysicalDeviceEnabled: boolean,