microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
4bd0c6691c098818360fd7858937bd9969fa5481

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/debugger/platformResolver.ts

55lines · modeblame

a31b007cunknown10 years ago1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
fb2bae06Daniel10 years ago4import {IRunOptions} from "./launchArgs";
5
65ee84c9unknown10 years ago6/**
7* Contains all the mobile platform specific debugging operations.
8*/
9export interface IMobilePlatform {
fb2bae06Daniel10 years ago10runApp(runOptions: IRunOptions): Q.Promise<void>;
e639e7a4Daniel10 years ago11enableJSDebuggingMode(runOptions: IRunOptions): Q.Promise<void>;
65ee84c9unknown10 years ago12}
13
14/**
15* Contains all the desktop platform specific operations.
16*/
17export interface IDesktopPlatform {
2f10b3adunknown10 years ago18reactNativeCommandName: string;
19reactPackagerExtraParameters: string[];
65ee84c9unknown10 years ago20}
21
f5ea0577unknown10 years ago22export class PlatformResolver {
65ee84c9unknown10 years ago23
f5ea0577unknown10 years ago24/**
25* Resolves the dev machine, desktop platform.
26*/
27public resolveDesktopPlatform(): IDesktopPlatform {
28let platform = process.platform;
29switch (platform) {
30case "darwin":
2f10b3adunknown10 years ago31return { reactNativeCommandName: "react-native", reactPackagerExtraParameters: [] };
f5ea0577unknown10 years ago32case "win32":
33default:
4677921cdigeff10 years ago34return { reactNativeCommandName: "react-native.cmd", reactPackagerExtraParameters: [] };
f5ea0577unknown10 years ago35}
36}
37
38/**
39* Resolves the mobile application target platform.
40*/
41public resolveMobilePlatform(mobilePlatformString: string): IMobilePlatform {
42switch (mobilePlatformString) {
43// We lazyly load the strategies, because some components might be
44// missing on some platforms (like XCode in Windows)
45case "ios":
4677921cdigeff10 years ago46let ios = require("./ios/iOSPlatform");
47return new ios.IOSPlatform(this.resolveDesktopPlatform());
f5ea0577unknown10 years ago48case "android":
4677921cdigeff10 years ago49let android = require("./android/androidPlatform");
50return new android.AndroidPlatform(this.resolveDesktopPlatform());
f5ea0577unknown10 years ago51default:
3af9a124unknown10 years ago52return null;
f5ea0577unknown10 years ago53}
54}
55}