microsoft/vscode-react-native

Public

mirrored fromhttps://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
70f7cae4a697f9868d22dfdd08089a2cd2076772

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/ios/deviceDeployer.ts

32lines · 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
4import * as path from "path";
5import * as Q from "q";
6
7import {CommandExecutor} from "../../common/commandExecutor";
8import {Xcodeproj, IXcodeProjFile} from "../../common/ios/xcodeproj";
9import {ErrorHelper} from "../../common/error/errorHelper";
10import {InternalErrorCode} from "../../common/error/internalErrorCode";
11
12export class DeviceDeployer {
13 private projectRoot: string;
14
15 constructor(projectRoot: string) {
16 this.projectRoot = projectRoot;
17 }
18
19 public deploy(): Q.Promise<void> {
20 return new Xcodeproj().findXcodeprojFile(this.projectRoot).then((projectFile: IXcodeProjFile) => {
21 const pathToCompiledApp = path.join(this.projectRoot, "build",
22 "Build", "Products", "Debug-iphoneos", `${projectFile.projectName}.app`);
23 return new CommandExecutor(this.projectRoot)
24 .spawn("ideviceinstaller", ["-i", pathToCompiledApp]).catch((err) => {
25 if ((<any>err).errorCode === InternalErrorCode.CommandFailed && (<any>err).innerError.code === "ENOENT") {
26 throw ErrorHelper.getNestedError(err, InternalErrorCode.IDeviceInstallerNotFound);
27 }
28 throw err;
29 });
30 });
31 }
32}