snapshot/lib/snapshot/reset_simulators.rb in fastlane-2.57.0.beta.20170915010002 vs snapshot/lib/snapshot/reset_simulators.rb in fastlane-2.57.0.beta.20170916010003

- old
+ new

@@ -13,24 +13,35 @@ raise e end UI.abort_with_message!("User cancelled action") unless sure - devices.each do |device| - _, name, id = device - puts "Removing device #{name} (#{id})" - `xcrun simctl delete #{id}` + if ios_versions + ios_versions.each do |version| + FastlaneCore::Simulator.delete_all_by_version(os_version: version) + end + else + FastlaneCore::Simulator.delete_all end - all_runtime_type = `xcrun simctl list runtimes`.scan(/(.*)\s\(.*\((.*)\)/) + FastlaneCore::SimulatorTV.delete_all + FastlaneCore::SimulatorWatch.delete_all + + all_runtime_type = runtimes # == Runtimes == # iOS 9.3 (9.3 - 13E233) (com.apple.CoreSimulator.SimRuntime.iOS-9-3) # iOS 10.0 (10.0 - 14A345) (com.apple.CoreSimulator.SimRuntime.iOS-10-0) # iOS 10.1 (10.1 - 14B72) (com.apple.CoreSimulator.SimRuntime.iOS-10-1) # iOS 10.2 (10.2 - 14C89) (com.apple.CoreSimulator.SimRuntime.iOS-10-2) # tvOS 10.1 (10.1 - 14U591) (com.apple.CoreSimulator.SimRuntime.tvOS-10-1) # watchOS 3.1 (3.1 - 14S471a) (com.apple.CoreSimulator.SimRuntime.watchOS-3-1) + # + # Xcode 9 changed the format + # == Runtimes == + # iOS 11.0 (11.0 - 15A5361a) - com.apple.CoreSimulator.SimRuntime.iOS-11-0 + # tvOS 11.0 (11.0 - 15J5368a) - com.apple.CoreSimulator.SimRuntime.tvOS-11-0 + # watchOS 4.0 (4.0 - 15R5363a) - com.apple.CoreSimulator.SimRuntime.watchOS-4-0 ios_versions_ids = filter_runtimes(all_runtime_type, 'iOS', ios_versions) tv_version_ids = filter_runtimes(all_runtime_type, 'tvOS') watch_versions_ids = filter_runtimes(all_runtime_type, 'watchOS') all_device_types = `xcrun simctl list devicetypes`.scan(/(.*)\s\((.*)\)/) @@ -76,9 +87,13 @@ result = all_devices.lines.map do |line| (line.match(/\s+(.+?)\s\(([\w\-]+)\).*/) || []).to_a end result.select { |parsed| parsed.length == 3 } # we don't care about those headers + end + + def self.runtimes + Helper.backticks('xcrun simctl list runtimes', print: FastlaneCore::Globals.verbose?).scan(/(.*)\s\(\d.*(com\.apple[^)\s]*)/) end def self.make_phone_watch_pair phones = [] watches = []