( flags: ResolveDeviceFlags, )
| 180 | } |
| 181 | |
| 182 | export function buildDeviceInventoryRequestFromFlags( |
| 183 | flags: ResolveDeviceFlags, |
| 184 | ): DeviceInventoryRequest { |
| 185 | const platform = flags.platform; |
| 186 | if (flags.target && !platform) { |
| 187 | throw new AppError( |
| 188 | 'INVALID_ARGS', |
| 189 | 'Device target selector requires --platform. Use --platform ios|macos|android|linux|apple with --target mobile|tv|desktop.', |
| 190 | ); |
| 191 | } |
| 192 | const iosSimulatorSetPath = resolveAppleSimulatorSetPathForSelector({ |
| 193 | simulatorSetPath: resolveIosSimulatorDeviceSetPath(flags.iosSimulatorDeviceSet), |
| 194 | platform, |
| 195 | target: flags.target, |
| 196 | }); |
| 197 | const androidSerialAllowlist = resolveAndroidSerialAllowlist(flags.androidDeviceAllowlist); |
| 198 | return { |
| 199 | platform, |
| 200 | target: flags.target, |
| 201 | deviceName: flags.device, |
| 202 | udid: flags.udid, |
| 203 | serial: flags.serial, |
| 204 | leaseId: flags.leaseId, |
| 205 | leaseProvider: flags.leaseProvider, |
| 206 | deviceKey: flags.deviceKey, |
| 207 | clientId: flags.clientId, |
| 208 | iosSimulatorSetPath, |
| 209 | androidSerialAllowlist: androidSerialAllowlist |
| 210 | ? Array.from(androidSerialAllowlist).sort() |
| 211 | : undefined, |
| 212 | }; |
| 213 | } |
| 214 | |
| 215 | export async function withResolveTargetDeviceCacheScope<T>(task: () => Promise<T>): Promise<T> { |
| 216 | if (resolveTargetDeviceCacheScope.getStore()) return await task(); |
no test coverage detected