Skip to content
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

fix(ios): select a valid ios sim xcodebuild destination [backport] #11235

Merged
merged 5 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -69,7 +69,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