microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/debugger/platformResolver.ts
29lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. |
| 3 | |
| 4 | import {IRunOptions} from "../common/launchArgs"; |
| 5 | import {IOSPlatform} from "./ios/iOSPlatform"; |
| 6 | import {AndroidPlatform} from "../common/android/androidPlatform"; |
| 7 | import {GeneralMobilePlatform} from "../common/generalMobilePlatform"; |
| 8 | import {ExponentPlatform} from "../common/exponent/exponentPlatform"; |
| 9 | |
| 10 | export class PlatformResolver { |
| 11 | |
| 12 | /** |
| 13 | * Resolves the mobile application target platform. |
| 14 | */ |
| 15 | public resolveMobilePlatform(mobilePlatformString: string, runOptions: IRunOptions): GeneralMobilePlatform { |
| 16 | switch (mobilePlatformString) { |
| 17 | // We lazyly load the strategies, because some components might be |
| 18 | // missing on some platforms (like XCode in Windows) |
| 19 | case "ios": |
| 20 | return new IOSPlatform(runOptions); |
| 21 | case "android": |
| 22 | return new AndroidPlatform(runOptions); |
| 23 | case "exponent": |
| 24 | return new ExponentPlatform(runOptions); |
| 25 | default: |
| 26 | return new GeneralMobilePlatform(runOptions); |
| 27 | } |
| 28 | } |
| 29 | } |