microsoft/vscode-react-native

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.1.2

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/debugger/ios/compiler.ts

37lines · 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";
a9d96b7cdigeff10 years ago8import {Xcodeproj} from "../../common/ios/xcodeproj";
488f1908Jimmy Thomson10 years ago9
10export class Compiler {
11private projectRoot: string;
12
bc96b26bJimmy Thomson10 years ago13constructor(projectRoot: string) {
488f1908Jimmy Thomson10 years ago14this.projectRoot = projectRoot;
15}
16
17public compile(): Q.Promise<void> {
18return this.xcodeBuildArguments().then((xcodeArguments: string[]) => {
45944d15Meena Kunnathur Balakrishnan10 years ago19return new CommandExecutor(this.projectRoot).spawnAndWaitForCompletion("xcodebuild", xcodeArguments);
488f1908Jimmy Thomson10 years ago20});
21}
22
23/*
24Return the appropriate arguments for compiling a react native project
25*/
26private xcodeBuildArguments(): Q.Promise<string[]> {
afc46a73Jimmy Thomson10 years ago27return new Xcodeproj().findXcodeprojFile(this.projectRoot).then((projectFile: string) => {
28const projectName = path.basename(projectFile, path.extname(projectFile));
488f1908Jimmy Thomson10 years ago29return [
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}