fastlane-plugin-create_simulator_devices 0.0.19 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e17a57f2e1b0ff1083d58d23717995d26796843c633231ba41430b877116fb02
4
- data.tar.gz: '017846203dca650cb4d1d70f6da80c81f2aef1369b08e3b9443d6f4479ea1a79'
3
+ metadata.gz: b4410fa9346d92eab68b23096d387f834ddc638213659e22c82f89cf48e5d2e6
4
+ data.tar.gz: 50dc75916b8bd131ca05d0d4a196b9bbed36958e734c5bdda3ee2ebf74074548
5
5
  SHA512:
6
- metadata.gz: 6566a4d2f8837546c119bdb90e4f2013bd4d8b1f499342a6330c4e032b9a9c8099af321ce97c5b601a5ef2b35aa52f33dd74f2475df8ace7290cf66781c5481d
7
- data.tar.gz: b9966803a099e1678eb635a4c0f6bca4b211b5147e3e268443a022124d6c673c9423e6e27d81f93fefda79f3986111cd8f1dc9de10521e615356ffda4a346d1a
6
+ metadata.gz: ebd3eaf035bbe0efc376b17ecd5bd963fe82e5d1bd51c7d47291a0e742dd215159e5ce689dafd937bb099ca655339b0e596fbb1474b03d3b745dedb62f11d9af
7
+ data.tar.gz: d8f8c6d6efed26e64185ca87ee68a1b04390a2fed40da2ca3a8d56779e6ac99cac5238a99114d90f898643dd532bffc024ac3cc920f8b2ea0788ff79b9865b68
@@ -108,7 +108,7 @@ module Fastlane
108
108
  default_value: CreateSimulatorDevices::DeviceNamingStyle::SCAN.to_s,
109
109
  verify_block: proc do |value|
110
110
  allowed_values = CreateSimulatorDevices::DeviceNamingStyle::ALL
111
- UI.user_error!("Invalid device naming style: #{value}. Allowed values: #{allowed_values.map(&:to_s).join(', ')}") unless allowed_values.include?(value.to_sym)
111
+ UI.user_error!("Invalid device naming style: #{value}. Allowed values: #{allowed_values.join(', ')}") unless allowed_values.include?(value.to_sym)
112
112
  end),
113
113
  ::FastlaneCore::ConfigItem.new(key: :remove_cached_runtimes,
114
114
  env_name: 'CREATE_SIMULATOR_DEVICES_REMOVE_CACHED_RUNTIMES',
@@ -110,7 +110,7 @@ module Fastlane
110
110
  default_value: CreateSimulatorDevices::DeviceNamingStyle::SCAN.to_s,
111
111
  verify_block: proc do |value|
112
112
  allowed_values = CreateSimulatorDevices::DeviceNamingStyle::ALL
113
- UI.user_error!("Invalid device naming style: #{value}. Allowed values: #{allowed_values.map(&:to_s).join(', ')}") unless allowed_values.include?(value.to_sym)
113
+ UI.user_error!("Invalid device naming style: #{value}. Allowed values: #{allowed_values.join(', ')}") unless allowed_values.include?(value.to_sym)
114
114
  end),
115
115
  ::FastlaneCore::ConfigItem.new(key: :timeout,
116
116
  env_name: 'GATHER_SIMCTL_DIAGNOSE_TIMEOUT',
@@ -46,7 +46,7 @@ module Fastlane
46
46
  end
47
47
 
48
48
  # Install missing runtimes if needed.
49
- runtime_helper.install_missing_runtimes(required_devices, remove_cached_runtimes: remove_cached_runtimes, remove_unused_runtimes: delete_unused_runtimes)
49
+ runtime_helper.install_missing_runtimes(required_devices, remove_cached_runtimes: remove_cached_runtimes, delete_unused_runtimes: delete_unused_runtimes)
50
50
 
51
51
  # Create missing devices for required devices.
52
52
  create_missing_devices(required_devices)
@@ -46,14 +46,14 @@ module Fastlane
46
46
  shell_helper.simctl_devices_for_runtimes(force: true)
47
47
  end
48
48
 
49
- def install_missing_runtimes(required_devices, remove_cached_runtimes:, remove_unused_runtimes:)
49
+ def install_missing_runtimes(required_devices, remove_cached_runtimes:, delete_unused_runtimes:)
50
50
  needed_runtimes = required_devices.filter_map(&:required_runtime).uniq
51
51
 
52
52
  missing_runtimes = missing_runtimes(needed_runtimes)
53
53
 
54
54
  if missing_runtimes.empty?
55
55
  UI.message('All required runtimes are present. Skipping runtime installation...') if verbose
56
- delete_unused_runtimes(needed_runtimes) if remove_unused_runtimes
56
+ delete_unused_runtimes(needed_runtimes) if delete_unused_runtimes
57
57
  return
58
58
  end
59
59
 
@@ -62,6 +62,7 @@ module Fastlane
62
62
  end
63
63
 
64
64
  # Update simctl_runtimes after installing the runtimes.
65
+ shell_helper.stop_core_simulator_services
65
66
  shell_helper.installed_runtimes_with_state
66
67
  shell_helper.simctl_runtimes(force: true)
67
68
  shell_helper.simctl_devices_for_runtimes(force: true)
@@ -75,14 +76,14 @@ module Fastlane
75
76
  UI.important("Failed to find/download/install runtime #{missing_runtime.runtime_name}")
76
77
  end
77
78
 
78
- delete_unused_runtimes(needed_runtimes) if remove_unused_runtimes
79
+ delete_unused_runtimes(needed_runtimes) if delete_unused_runtimes
79
80
  end
80
81
 
81
82
  def delete_unused_runtimes(needed_runtimes)
82
83
  UI.message('Deleting unused runtimes...')
83
84
  available_simctl_runtimes = shell_helper.simctl_runtimes
84
85
 
85
- needed_simctl_runtimes = needed_runtimes.map do |needed_runtime|
86
+ needed_simctl_runtimes = needed_runtimes.filter_map do |needed_runtime|
86
87
  # Check if available runtimes contain the needed runtime.
87
88
  simctl_runtime_matching_needed_runtime?(needed_runtime)
88
89
  end
@@ -99,14 +100,17 @@ module Fastlane
99
100
  end
100
101
  end
101
102
 
103
+ unused_simctl_runtimes.uniq!(&:identifier)
104
+
102
105
  return if unused_simctl_runtimes.empty?
103
106
 
104
107
  unused_simctl_runtimes.each do |unused_simctl_runtime|
105
- puts "Deleting unused runtime #{unused_simctl_runtime.runtime_identifier} (#{unused_simctl_runtime.identifier})..."
108
+ UI.message("Deleting unused runtime #{unused_simctl_runtime.runtime_identifier} (#{unused_simctl_runtime.identifier})...")
106
109
  shell_helper.simctl_delete_runtime(identifier: unused_simctl_runtime.identifier)
107
110
  end
108
111
 
109
- shell_helper.installed_runtimes_with_state
112
+ shell_helper.stop_core_simulator_services
113
+ shell_helper.installed_runtimes_with_state(retry_count: 3, retry_delay: 60)
110
114
  shell_helper.simctl_runtimes(force: true)
111
115
  shell_helper.simctl_devices_for_runtimes(force: true)
112
116
  end
@@ -7,7 +7,7 @@ module Fastlane
7
7
  # Create simulator devices.
8
8
  module CreateSimulatorDevices
9
9
  # Shell helper
10
- class ShellHelper
10
+ class ShellHelper # rubocop:disable Metrics/ClassLength
11
11
  UI = ::Fastlane::UI unless defined?(UI)
12
12
 
13
13
  # Proprty verbose
@@ -20,7 +20,7 @@ module Fastlane
20
20
  self.action_context = action_context
21
21
  end
22
22
 
23
- def sh(command:, print_command: self.print_command, print_command_output: self.print_command_output)
23
+ def _sh(command:, print_command: self.print_command, print_command_output: self.print_command_output)
24
24
  if action_context
25
25
  action_context.sh(command, print_command: print_command, print_command_output: print_command_output)
26
26
  else
@@ -41,6 +41,18 @@ module Fastlane
41
41
  end
42
42
  end
43
43
 
44
+ def sh(command:, print_command: self.print_command, print_command_output: self.print_command_output, retry_count: 0, retry_delay: nil)
45
+ _sh(command: command, print_command: print_command, print_command_output: print_command_output)
46
+ rescue StandardError => e
47
+ raise e unless retry_count.positive?
48
+
49
+ retry_delay ||= 60
50
+ retry_count -= 1
51
+ UI.important("Retrying command #{command} in #{retry_delay} seconds (remaining retries: #{retry_count})...")
52
+ sleep retry_delay
53
+ sh(command: command, print_command: true, print_command_output: true, retry_count: retry_count, retry_delay: retry_delay)
54
+ end
55
+
44
56
  def stop_core_simulator_services
45
57
  UI.message('Stop CoreSimulator')
46
58
  services_to_stop = [
@@ -120,9 +132,13 @@ module Fastlane
120
132
  .map { |identifier, runtime| SimCTL::MatchedRuntime.from_hash(runtime, identifier: identifier) }
121
133
  end
122
134
 
123
- def installed_runtimes_with_state
135
+ def installed_runtimes_with_state(retry_count: 0, retry_delay: nil)
124
136
  UI.message('Fetching runtimes with state...')
125
- json = sh(command: 'xcrun simctl runtime list --json')
137
+ json = sh(
138
+ command: 'xcrun simctl runtime list --json',
139
+ retry_count: retry_count,
140
+ retry_delay: retry_delay
141
+ )
126
142
 
127
143
  JSON
128
144
  .parse(json, symbolize_names: true)
@@ -93,9 +93,7 @@ module Fastlane
93
93
  def copy_data_containers_and_logs(matched_simctl_devices, output_dir)
94
94
  matched_simctl_devices
95
95
  .reject { |simctl_device| simctl_device.state == 'Booted' }
96
- .each do |simctl_device|
97
- copy_data_container_and_logs(simctl_device, output_dir)
98
- end
96
+ .each { |simctl_device| copy_data_container_and_logs(simctl_device, output_dir) }
99
97
  end
100
98
 
101
99
  def copy_data_container_and_logs(simctl_device, output_dir)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fastlane
4
4
  module CreateSimulatorDevices
5
- VERSION = '0.0.19'
5
+ VERSION = '0.0.22'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-create_simulator_devices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitalii Budnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-09 00:00:00.000000000 Z
11
+ date: 2026-03-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: developers@setapp.com
@@ -53,16 +53,16 @@ require_paths:
53
53
  - lib
54
54
  required_ruby_version: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - ">="
56
+ - - "~>"
57
57
  - !ruby/object:Gem::Version
58
- version: 3.1.1
58
+ version: '3.3'
59
59
  required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  requirements: []
65
- rubygems_version: 3.3.7
65
+ rubygems_version: 3.5.22
66
66
  signing_key:
67
67
  specification_version: 4
68
68
  summary: Fastlane plugin to create simulator devices