mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-22 11:46:10 +08:00
[sim] Honour explicit device_name or target specified by user.
Specifying both is disallowed, because a device is configured for a specific SDK. Fixes http://hipbyte.myjetbrains.com/youtrack/issue/RM-657
This commit is contained in:
3
NEWS
3
NEWS
@@ -1,5 +1,8 @@
|
||||
= RubyMotion 2.39 =
|
||||
|
||||
* [iOS] Honour explicit `device_name` or `target` specified by user.
|
||||
Specifying both is disallowed, because a device is configured for a
|
||||
specific SDK.
|
||||
* [iOS] Fixed a regression where Extension and Frameworks could not build for
|
||||
iOS device.
|
||||
* [iOS] Fixed a bug where `rake spec' would return 0 as exit code even if it
|
||||
|
||||
20
bin/sim.m
20
bin/sim.m
@@ -1459,13 +1459,23 @@ main(int argc, char **argv)
|
||||
id sim_runtime = ((id (*)(id, SEL, id))objc_msgSend)(system_root, @selector(runtime), nil);
|
||||
|
||||
sim_device = [sim_devices objectAtIndex:0];
|
||||
// If either `target` or `device_name` was explicitly specified, then
|
||||
// only compare that specific value and not the other or both.
|
||||
BOOL specific_sdk = getenv("target") != NULL;
|
||||
BOOL specific_device = getenv("device_name") != NULL;
|
||||
BOOL no_specifics = !specific_sdk && !specific_device;
|
||||
for (id device in sim_devices) {
|
||||
id device_runtime = ((id (*)(id, SEL, id))objc_msgSend)(device, @selector(runtime), nil);
|
||||
if (device_runtime == sim_runtime &&
|
||||
[device_name compare:[device name]] == NSOrderedSame) {
|
||||
sim_device = device;
|
||||
break;
|
||||
if ((specific_device || no_specifics) && [device_name compare:[device name]] != NSOrderedSame) {
|
||||
continue;
|
||||
}
|
||||
if (specific_sdk || no_specifics) {
|
||||
id device_runtime = ((id (*)(id, SEL, id))objc_msgSend)(device, @selector(runtime), nil);
|
||||
if (device_runtime != sim_runtime) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
sim_device = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@ task :simulator do
|
||||
App.fail "It is not possible to simulate an SDK version (#{target}) " \
|
||||
"lower than the app's deployment target (#{deployment_target})"
|
||||
end
|
||||
if target && ENV['device_name']
|
||||
App.fail "It is not possible to specify both `device_name' and `target'"
|
||||
end
|
||||
target ||= App.config.sdk_version
|
||||
|
||||
# May be overridden on Xcode <= 5 with the `device_family' option (see below)
|
||||
|
||||
Reference in New Issue
Block a user