Skip to content

fix: get Xcode version correctly #4442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const getPlatformSdkName = (forDevice: boolean): string => forDevice ? DevicePla
const getConfigurationName = (release: boolean): string => release ? Configurations.Release : Configurations.Debug;

export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase implements IPlatformProjectService {
private static XCODEBUILD_MIN_VERSION = "6.0";
private static IOS_PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
private static IOS_PLATFORM_NAME = "ios";

Expand Down Expand Up @@ -145,11 +144,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
notConfiguredEnvOptions
});

const xcodeBuildVersion = await this.getXcodeVersion();
if (helpers.versionCompare(xcodeBuildVersion, IOSProjectService.XCODEBUILD_MIN_VERSION) < 0) {
this.$errors.fail("NativeScript can only run in Xcode version %s or greater", IOSProjectService.XCODEBUILD_MIN_VERSION);
}

return {
checkEnvironmentRequirementsOutput
};
Expand Down Expand Up @@ -354,13 +348,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
basicArgs.push("-xcconfig", path.join(projectRoot, projectData.projectName, BUILD_XCCONFIG_FILE_NAME));
}

// if (this.$logger.getLevel() === "INFO") {
// let xcodeBuildVersion = this.getXcodeVersion();
// if (helpers.versionCompare(xcodeBuildVersion, "8.0") >= 0) {
// basicArgs.push("-quiet");
// }
// }

const handler = (data: any) => {
this.emit(constants.BUILD_OUTPUT_EVENT_NAME, data);
};
Expand Down Expand Up @@ -1238,7 +1225,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
let xcodeBuildVersion = "";

try {
xcodeBuildVersion = await this.$childProcess.exec("xcodebuild -version | head -n 1 | sed -e 's/Xcode //'");
xcodeBuildVersion = await this.$sysInfo.getXcodeVersion();
} catch (error) {
this.$errors.fail("xcodebuild execution failed. Make sure that you have latest Xcode and tools installed.");
}
Expand Down
4 changes: 3 additions & 1 deletion test/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ function createTestInjector(projectPath: string, projectName: string, xcode?: IX
testInjector.register("pluginsService", PluginsService);
testInjector.register("androidProcessService", {});
testInjector.register("processService", {});
testInjector.register("sysInfo", {});
testInjector.register("sysInfo", {
getXcodeVersion: async () => ""
});
testInjector.register("pbxprojDomXcode", {});
testInjector.register("xcode", xcode || {
project: class {
Expand Down