microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
e3ae42278f91179dcf2a3c6389a8dcf0e8a76c13

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/ios/compiler.ts

37lines · 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} 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: string) => {
28 const projectName = path.basename(projectFile, path.extname(projectFile));
29 return [
30 "-project", path.join(this.projectRoot, "ios", projectFile),
31 "-scheme", projectName,
32 "-destination", "generic/platform=iOS", // Build for a generic iOS device
33 "-derivedDataPath", path.join(this.projectRoot, "ios", "build"),
34 ];
35 });
36 }
37}