Skip to content

Commit c336474

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Support for building xcworkspace
#686
1 parent 41ba966 commit c336474

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lib/services/ios-project-service.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,22 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
127127

128128
public buildProject(projectRoot: string): IFuture<void> {
129129
return (() => {
130-
var basicArgs = [
131-
"-project", path.join(projectRoot, this.$projectData.projectName + ".xcodeproj"),
132-
"-target", this.$projectData.projectName,
130+
let basicArgs = [
133131
"-configuration", this.$options.release ? "Release" : "Debug",
134132
"build",
135133
'SHARED_PRECOMPS_DIR=' + path.join(projectRoot, 'build', 'sharedpch')
136134
];
137-
var args: string[] = [];
138-
135+
136+
let xcworkspacePath = path.join(projectRoot, this.$projectData.projectName + ".xcworkspace");
137+
if(this.$fs.exists(xcworkspacePath).wait()) {
138+
basicArgs.push("-workspace", xcworkspacePath);
139+
basicArgs.push("-scheme", this.$projectData.projectName);
140+
} else {
141+
basicArgs.push("-project", path.join(projectRoot, this.$projectData.projectName + ".xcodeproj"));
142+
basicArgs.push("-target", this.$projectData.projectName);
143+
}
144+
145+
let args: string[] = [];
139146
if(this.$options.forDevice) {
140147
args = basicArgs.concat([
141148
"-xcconfig", path.join(projectRoot, this.$projectData.projectName, "build.xcconfig"),
@@ -151,7 +158,6 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
151158
"VALID_ARCHS=\"i386\"",
152159
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "emulator")
153160
]);
154-
155161
}
156162

157163
this.$childProcess.spawnFromEvent("xcodebuild", args, "exit", {cwd: this.$options, stdio: 'inherit'}).wait();
@@ -361,4 +367,4 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
361367
}).future<void>()();
362368
}
363369
}
364-
$injector.register("iOSProjectService", IOSProjectService);
370+
$injector.register("iOSProjectService", IOSProjectService);

0 commit comments

Comments
 (0)