Skip to content

Commit b96c572

Browse files
committed
Merge pull request #48 from NativeScript/fatme/fix-xcode-version-comparison
Fix xcode version comparison
2 parents 6fa1882 + b1a8b0d commit b96c572

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/services/ios-project-service.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import path = require("path");
44
import shell = require("shelljs");
5+
import util = require("util");
56
import constants = require("./../constants");
67
import helpers = require("./../common/helpers");
78
import options = require("./../options");
@@ -35,6 +36,11 @@ class IOSProjectService implements IPlatformProjectService {
3536
}
3637

3738
var xcodeBuildVersion = this.$childProcess.exec("xcodebuild -version | head -n 1 | sed -e 's/Xcode //'").wait();
39+
var splitedXcodeBuildVersion = xcodeBuildVersion.split(".");
40+
if(splitedXcodeBuildVersion.length === 3) {
41+
xcodeBuildVersion = util.format("%s.%s", splitedXcodeBuildVersion[0], splitedXcodeBuildVersion[1]);
42+
}
43+
3844
if(helpers.versionCompare(xcodeBuildVersion, IOSProjectService.XCODEBUILD_MIN_VERSION) < 0) {
3945
this.$errors.fail("NativeScript can only run in Xcode version %s or greater", IOSProjectService.XCODEBUILD_MIN_VERSION);
4046
}
@@ -81,7 +87,7 @@ class IOSProjectService implements IPlatformProjectService {
8187
var basicArgs = [
8288
"-project", path.join(projectRoot, this.$projectData.projectName + ".xcodeproj"),
8389
"-target", this.$projectData.projectName,
84-
"-configuration", options.release,
90+
"-configuration", options.release ? "Release": "Debug",
8591
"build"
8692
];
8793
var args: string[] = [];
@@ -90,8 +96,8 @@ class IOSProjectService implements IPlatformProjectService {
9096
args = basicArgs.concat([
9197
"-xcconfig", path.join(projectRoot, "build.xcconfig"),
9298
"-sdk", "iphoneos",
93-
"ARCHS=\"armv7 armv7s arm64\"",
94-
"VALID_ARCHS=\"armv7 armv7s arm64\"",
99+
"ARCHS=\"armv7\"",
100+
"VALID_ARCHS=\"armv7\"",
95101
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "device")
96102
]);
97103
} else {
@@ -103,7 +109,9 @@ class IOSProjectService implements IPlatformProjectService {
103109
]);
104110
}
105111

106-
this.$childProcess.spawn("xcodebuild", args, {cwd: options, stdio: 'inherit'});
112+
var childProcess = this.$childProcess.spawn("xcodebuild", args, {cwd: options, stdio: 'inherit'});
113+
this.$fs.futureFromEvent(childProcess, "exit").wait();
114+
107115
}).future<void>()();
108116
}
109117

0 commit comments

Comments
 (0)