microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
a10fb050eee3276c9b42fc2b6bf50c3eb07ed5ae

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/ios/compiler.ts

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