microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
b4683d60d2ce52828fca73ad1093856d8a898640

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/platformResolver.ts

57lines · 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";
bc7a32ceJimmy Thomson10 years ago5import * as IOSPlatform from "./ios/iOSPlatform";
6import * as AndroidPlatform from "./android/androidPlatform";
fb2bae06Daniel10 years ago7
65ee84c9unknown10 years ago8/**
9* Contains all the mobile platform specific debugging operations.
10*/
11export interface IMobilePlatform {
fb2bae06Daniel10 years ago12runApp(runOptions: IRunOptions): Q.Promise<void>;
e639e7a4Daniel10 years ago13enableJSDebuggingMode(runOptions: IRunOptions): Q.Promise<void>;
65ee84c9unknown10 years ago14}
15
16/**
17* Contains all the desktop platform specific operations.
18*/
19export interface IDesktopPlatform {
2f10b3adunknown10 years ago20reactNativeCommandName: string;
21reactPackagerExtraParameters: string[];
65ee84c9unknown10 years ago22}
23
f5ea0577unknown10 years ago24export class PlatformResolver {
65ee84c9unknown10 years ago25
f5ea0577unknown10 years ago26/**
27* Resolves the dev machine, desktop platform.
28*/
29public resolveDesktopPlatform(): IDesktopPlatform {
30let platform = process.platform;
31switch (platform) {
32case "darwin":
2f10b3adunknown10 years ago33return { reactNativeCommandName: "react-native", reactPackagerExtraParameters: [] };
f5ea0577unknown10 years ago34case "win32":
35default:
4677921cdigeff10 years ago36return { reactNativeCommandName: "react-native.cmd", reactPackagerExtraParameters: [] };
f5ea0577unknown10 years ago37}
38}
39
40/**
41* Resolves the mobile application target platform.
42*/
bc7a32ceJimmy Thomson10 years ago43public resolveMobilePlatform(mobilePlatformString: string, desktopPlatform: IDesktopPlatform): IMobilePlatform {
f5ea0577unknown10 years ago44switch (mobilePlatformString) {
45// We lazyly load the strategies, because some components might be
46// missing on some platforms (like XCode in Windows)
47case "ios":
bc7a32ceJimmy Thomson10 years ago48let ios: typeof IOSPlatform = require("./ios/iOSPlatform");
49return new ios.IOSPlatform(desktopPlatform);
f5ea0577unknown10 years ago50case "android":
bc7a32ceJimmy Thomson10 years ago51let android: typeof AndroidPlatform = require("./android/androidPlatform");
52return new android.AndroidPlatform(desktopPlatform);
f5ea0577unknown10 years ago53default:
3af9a124unknown10 years ago54return null;
f5ea0577unknown10 years ago55}
56}
57}