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/compiler.ts

36lines · 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";
9
10export class Compiler {
11 private projectRoot: string;
12
13 constructor(projectRoot: string) {
14 this.projectRoot = projectRoot;
15 }
16
17 public compile(): Q.Promise<void> {
18 return this.xcodeBuildArguments().then((xcodeArguments: string[]) => {
19 return new CommandExecutor(this.projectRoot).spawn("xcodebuild", xcodeArguments);
20 });
21 }
22
23 /*
24 Return the appropriate arguments for compiling a react native project
25 */
26 private xcodeBuildArguments(): Q.Promise<string[]> {
27 return new Xcodeproj().findXcodeprojFile(this.projectRoot).then((projectFile: IXcodeProjFile) => {
28 return [
29 projectFile.fileType === ".xcworkspace" ? "-workspace" : "-project", projectFile.fileName,
30 "-scheme", projectFile.projectName,
31 "-destination", "generic/platform=iOS", // Build for a generic iOS device
32 "-derivedDataPath", path.join(this.projectRoot, "build"),
33 ];
34 });
35 }
36}