microsoft/vscode-react-native
Publicmirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable
src/debugger/android/androidPlatform.ts
28lines · 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 * as Q from "q"; |
| 5 | import {IAppPlatform} from "../platformResolver"; |
| 6 | import {IRunOptions} from "../launchArgs"; |
| 7 | import {CommandExecutor} from "../../common/commandExecutor"; |
| 8 | import {Package} from "../../common/node/package"; |
| 9 | |
| 10 | /** |
| 11 | * Android specific platform implementation for debugging RN applications. |
| 12 | */ |
| 13 | export class AndroidPlatform implements IAppPlatform { |
| 14 | |
| 15 | public runApp(runOptions: IRunOptions): Q.Promise<void> { |
| 16 | return new CommandExecutor(runOptions.projectRoot).spawnAndWaitReactCommand("run-android"); |
| 17 | } |
| 18 | |
| 19 | public enableJSDebuggingMode(runOptions: IRunOptions): Q.Promise<void> { |
| 20 | let pkg = new Package(runOptions.projectRoot); |
| 21 | return pkg.name() |
| 22 | .then(name => { |
| 23 | let enableDebugCommand = `adb shell am broadcast -a "com.${name.toLowerCase()}.RELOAD_APP_ACTION" --ez jsproxy true`; |
| 24 | let cexec = new CommandExecutor(runOptions.projectRoot); |
| 25 | return cexec.execute(enableDebugCommand); |
| 26 | }); |
| 27 | } |
| 28 | } |