Skip to content

Pass -destination only when on Xcode 7.2 #1688

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
Apr 18, 2016
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
2 changes: 1 addition & 1 deletion lib/common
2 changes: 1 addition & 1 deletion lib/definitions/npm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ declare module "npm" {
var cli: { data: Object };
}
}
}
}
6 changes: 0 additions & 6 deletions lib/npm-installation-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import * as semver from "semver";
import * as npm from "npm";
import * as constants from "./constants";

interface IVersionData {
major: string;
minor: string;
patch: string;
}

export class NpmInstallationManager implements INpmInstallationManager {
private static NPM_LOAD_FAILED = "Failed to retrieve data from npm. Please try again a little bit later.";
private versionsCache: IDictionary<string[]>;
Expand Down
18 changes: 16 additions & 2 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
private $devicesService: Mobile.IDevicesService,
private $mobileHelper: Mobile.IMobileHelper,
private $pluginVariablesService: IPluginVariablesService) {
private $pluginVariablesService: IPluginVariablesService,
private $xcodeSelectService: IXcodeSelectService) {
super($fs, $projectData, $projectDataService);
}

Expand Down Expand Up @@ -204,10 +205,23 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
let currentSimulator = this.$iOSSimResolver.iOSSim.getRunningSimulator();
args = basicArgs.concat([
"-sdk", "iphonesimulator",
"-destination", `platform=iOS Simulator,name=${this.$iOSSimResolver.iOSSim.getSimulatorName(currentSimulator && currentSimulator.name)}`,
"CONFIGURATION_BUILD_DIR=" + path.join(projectRoot, "build", "emulator"),
"CODE_SIGN_IDENTITY="
]);

let additionalArgs: string[] = [],
xcodeVersion = this.$xcodeSelectService.getXcodeVersion().wait();

xcodeVersion.patch = xcodeVersion.patch || "0";
// passing -destination apparently only works with Xcode 7.2+
if (xcodeVersion.major && xcodeVersion.minor &&
helpers.versionCompare(xcodeVersion, "7.2.0") < 0) {
additionalArgs = ["-arch", "i386", 'VALID_ARCHS="i386"'];
} else {
additionalArgs = ["-destination", `platform=iOS Simulator,name=${this.$iOSSimResolver.iOSSim.getSimulatorName(currentSimulator && currentSimulator.name)}`];
}

args = args.concat(additionalArgs);
}

if (buildConfig && buildConfig.codeSignIdentity) {
Expand Down
17 changes: 7 additions & 10 deletions lib/services/itmstransporter-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as temp from "temp";
import {EOL} from "os";
import {ITMSConstants} from "../constants";
import {ItunesConnectApplicationTypes} from "../constants";
import {quoteString} from "../common/helpers";
import {quoteString, versionCompare} from "../common/helpers";

export class ITMSTransporterService implements IITMSTransporterService {
private _itmsTransporterPath: string = null;
Expand All @@ -22,7 +22,6 @@ export class ITMSTransporterService implements IITMSTransporterService {
private $injector: IInjector,
private $logger: ILogger,
private $staticConfig: IStaticConfig,
private $sysInfo: ISysInfo,
private $xcodeSelectService: IXcodeSelectService) { }

// This property was introduced due to the fact that the $platformService dependency
Expand Down Expand Up @@ -166,17 +165,15 @@ export class ITMSTransporterService implements IITMSTransporterService {
return ((): string => {
if (!this._itmsTransporterPath) {
let xcodePath = this.$xcodeSelectService.getContentsDirectoryPath().wait(),
sysInfo = this.$sysInfo.getSysInfo(this.$staticConfig.pathToPackageJson).wait(),
xcodeVersionMatch = sysInfo.xcodeVer.match(/Xcode (.*)/),
xcodeVersion = this.$xcodeSelectService.getXcodeVersion().wait(),
result = path.join(xcodePath, "Applications", "Application Loader.app", "Contents");

if (xcodeVersionMatch && xcodeVersionMatch[1]) {
let [major, minor] = xcodeVersionMatch[1].split(".");
// iTMS Transporter's path has been modified in Xcode 6.3
// https://github.com/nomad/shenzhen/issues/243
if (+major <= 6 && +minor < 3) {
xcodeVersion.patch = xcodeVersion.patch || "0";
// iTMS Transporter's path has been modified in Xcode 6.3
// https://github.com/nomad/shenzhen/issues/243
if (xcodeVersion.major && xcodeVersion.minor &&
versionCompare(xcodeVersion, "6.3.0") < 0) {
result = path.join(result, "MacOS");
}
}

this._itmsTransporterPath = path.join(result, ITMSConstants.iTMSDirectoryName, "bin", ITMSConstants.iTMSExecutableName);
Expand Down
1 change: 1 addition & 0 deletions test/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function createTestInjector(projectPath: string, projectName: string): IInjector
projectFilePath: path.join(projectPath, "package.json")
});
testInjector.register("projectHelper", {});
testInjector.register("xcodeSelectService", {});
testInjector.register("staticConfig", ConfigLib.StaticConfig);
testInjector.register("projectDataService", {});
testInjector.register("prompter", {});
Expand Down