Skip to content

Commit

Permalink
fix(ios): select a valid ios sim xcodebuild destination [backport] (#…
Browse files Browse the repository at this point in the history
…11235)

* fix(ios): select a valid ios sim xcodebuild destination

The desired iOS simulator's runtime may be associated with a different Xcode than the one building with, so simply pick any simulator that is compatible with the Xcode building the app since it won't matter when ioslib laucnhes the selected iOS Simulator.

* fix(ios): fixed ios sim for loop

* chore: bumped ioslib to v1.7.14
  • Loading branch information
cb1kenobi authored and lokeshchdhry committed Oct 9, 2019
1 parent 4c07280 commit 65cd2e5
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 169 deletions.
22 changes: 21 additions & 1 deletion iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6784,9 +6784,29 @@ iOSBuilder.prototype.invokeXcodeBuild = function invokeXcodeBuild(next) {
];

if (this.simHandle) {
let dest;
const xcodeId = this.xcodeEnv.version + ':' + this.xcodeEnv.build;

// xcodebuild requires a -destination when building for iOS Simulator and it needs a
// simulator that is compatible with the selected Xcode version, so just pick one
for (const sims of Object.values(this.iosInfo.simulators.ios)) {
for (const sim of sims) {
if (sim.supportsXcode[xcodeId]) {
dest = `platform=iOS Simulator,id=${sim.udid},OS=${appc.version.format(sim.version, 2, 2)}`;
break;
}
}
}

if (!dest) {
// couldn't find a simulator!
// this shouldn't happen, but just in case, fall back to the selected simulator
dest = `platform=iOS Simulator,id=${this.simHandle.udid},OS=${appc.version.format(this.simHandle.version, 2, 2)}`;
}

// when building for the simulator, we need to specify a destination and a scheme (above)
// so that it can compile all targets (phone and watch targets) for the simulator
args.push('-destination', 'platform=iOS Simulator,id=' + this.simHandle.udid + ',OS=' + appc.version.format(this.simHandle.version, 2, 2));
args.push('-destination', dest);
args.push('ONLY_ACTIVE_ARCH=1');
}

Expand Down
196 changes: 29 additions & 167 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"ejs": "^2.6.1",
"fields": "0.1.24",
"fs-extra": "^8.0.1",
"ioslib": "^1.7.13",
"ioslib": "^1.7.14",
"klaw-sync": "^6.0.0",
"liveview": "^1.5.0",
"lodash.defaultsdeep": "^4.6.1",
Expand Down

0 comments on commit 65cd2e5

Please sign in to comment.