Skip to content

Commit 06fb512

Browse files
Merge pull request #4442 from NativeScript/vladimirov/fix-get-xcode-version
fix: get Xcode version correctly
2 parents d453726 + af090bd commit 06fb512

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

lib/services/ios-project-service.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ const getPlatformSdkName = (forDevice: boolean): string => forDevice ? DevicePla
2828
const getConfigurationName = (release: boolean): string => release ? Configurations.Release : Configurations.Debug;
2929

3030
export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService {
31-
private static XCODEBUILD_MIN_VERSION = "6.0";
3231
private static IOS_PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
3332
private static IOS_PLATFORM_NAME = "ios";
3433

@@ -145,11 +144,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
145144
notConfiguredEnvOptions
146145
});
147146

148-
const xcodeBuildVersion = await this.getXcodeVersion();
149-
if (helpers.versionCompare(xcodeBuildVersion, IOSProjectService.XCODEBUILD_MIN_VERSION) < 0) {
150-
this.$errors.fail("NativeScript can only run in Xcode version %s or greater", IOSProjectService.XCODEBUILD_MIN_VERSION);
151-
}
152-
153147
return {
154148
checkEnvironmentRequirementsOutput
155149
};
@@ -354,13 +348,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
354348
basicArgs.push("-xcconfig", path.join(projectRoot, projectData.projectName, BUILD_XCCONFIG_FILE_NAME));
355349
}
356350

357-
// if (this.$logger.getLevel() === "INFO") {
358-
// let xcodeBuildVersion = this.getXcodeVersion();
359-
// if (helpers.versionCompare(xcodeBuildVersion, "8.0") >= 0) {
360-
// basicArgs.push("-quiet");
361-
// }
362-
// }
363-
364351
const handler = (data: any) => {
365352
this.emit(constants.BUILD_OUTPUT_EVENT_NAME, data);
366353
};
@@ -1238,7 +1225,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
12381225
let xcodeBuildVersion = "";
12391226

12401227
try {
1241-
xcodeBuildVersion = await this.$childProcess.exec("xcodebuild -version | head -n 1 | sed -e 's/Xcode //'");
1228+
xcodeBuildVersion = await this.$sysInfo.getXcodeVersion();
12421229
} catch (error) {
12431230
this.$errors.fail("xcodebuild execution failed. Make sure that you have latest Xcode and tools installed.");
12441231
}

test/ios-project-service.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ function createTestInjector(projectPath: string, projectName: string, xcode?: IX
118118
testInjector.register("pluginsService", PluginsService);
119119
testInjector.register("androidProcessService", {});
120120
testInjector.register("processService", {});
121-
testInjector.register("sysInfo", {});
121+
testInjector.register("sysInfo", {
122+
getXcodeVersion: async () => ""
123+
});
122124
testInjector.register("pbxprojDomXcode", {});
123125
testInjector.register("xcode", xcode || {
124126
project: class {

0 commit comments

Comments
 (0)