microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.4.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/ios/compiler.ts

39lines · modeblame

488f1908Jimmy Thomson10 years ago1// 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
b0061ac6Meena Kunnathur Balakrishnan10 years ago7import {CommandExecutor} from "../../common/commandExecutor";
c4a42a32Jimmy Thomson9 years ago8import {Xcodeproj, IXcodeProjFile} from "../../common/ios/xcodeproj";
60d501abNick Hodapp9 years ago9import {IRunOptions} from "../../common/launchArgs";
488f1908Jimmy Thomson10 years ago10
11export class Compiler {
12private projectRoot: string;
60d501abNick Hodapp9 years ago13private runOptions: IRunOptions;
488f1908Jimmy Thomson10 years ago14
60d501abNick Hodapp9 years ago15constructor(runOptions: IRunOptions, projectRoot: string) {
16this.runOptions = runOptions;
a2550557Mark Oswald10 years ago17this.projectRoot = projectRoot;
488f1908Jimmy Thomson10 years ago18}
19
20public compile(): Q.Promise<void> {
21return this.xcodeBuildArguments().then((xcodeArguments: string[]) => {
323a3cc0Meena Kunnathur Balakrishnan10 years ago22return new CommandExecutor(this.projectRoot).spawn("xcodebuild", xcodeArguments);
488f1908Jimmy Thomson10 years ago23});
24}
25
26/*
27Return the appropriate arguments for compiling a react native project
28*/
29private xcodeBuildArguments(): Q.Promise<string[]> {
c4a42a32Jimmy Thomson9 years ago30return new Xcodeproj().findXcodeprojFile(this.projectRoot).then((projectFile: IXcodeProjFile) => {
488f1908Jimmy Thomson10 years ago31return [
81d6e05bJimmy Thomson9 years ago32projectFile.fileType === ".xcworkspace" ? "-workspace" : "-project", projectFile.fileName,
60d501abNick Hodapp9 years ago33"-scheme", this.runOptions.scheme ? this.runOptions.scheme : projectFile.projectName,
488f1908Jimmy Thomson10 years ago34"-destination", "generic/platform=iOS", // Build for a generic iOS device
b7773a6fMark Oswald10 years ago35"-derivedDataPath", path.join(this.projectRoot, "build"),
488f1908Jimmy Thomson10 years ago36];
37});
38}
39}