fastlane scan が選択する Simulator
#fastlane
※ 2021/03 時点
fastlane scan の Simulator の探索のロジックは、下記に存在します。
https://github.com/fastlane/fastlane/blob/48151291f2c4949c3b1b9919ba2cc81a7cc33293/scan/lib/scan/detect_values.rb
devices が明示的に指定された場合、指定されたデバイス名に合致する Simulator が iOS バージョンにかかわらず探索されるようです。一方、devices を指定しなかった場合、
名前が iPhone 5sの Simulator
iOS バージョンが IPHONEOS_DEPLOYMENT_TARGET 以上の Simulator
code:ruby
if devices.count > 0
detect_simulator(devices, '', '', '', nil)
else
if Scan.project.ios?
# An iPhone 5s is a reasonably small and useful default for tests
detect_simulator(devices, 'iOS', 'IPHONEOS_DEPLOYMENT_TARGET', 'iPhone 5s', nil)
elsif Scan.project.tvos?
detect_simulator(devices, 'tvOS', 'TVOS_DEPLOYMENT_TARGET', 'Apple TV 1080p', 'TV')
end
end
https://github.com/fastlane/fastlane/blob/48151291f2c4949c3b1b9919ba2cc81a7cc33293/scan/lib/scan/detect_values.rb#L31-L40
さらに、Simulator の探索時は、同一名の Simulator が存在した場合、最も iOS バージョンが新しいものが採用されるようです。
code:ruby
result = Array(
simulators
.select { |sim| sim.name == default_device_name }
.reverse # more efficient, because simctl prints higher versions first
.sort_by! { |sim| Gem::Version.new(sim.os_version) }
.last || simulators.first
)
https://github.com/fastlane/fastlane/blob/48151291f2c4949c3b1b9919ba2cc81a7cc33293/scan/lib/scan/detect_values.rb#L176-L182
devices 未指定 && iPhone 5s が見つからなかった場合は、xcrun simctl list devices で先頭にあるデバイスが選択されているように見えるけど、コードから読み取れず...