fastlane-plugin-create_simulator_devices 0.0.5 → 0.0.7
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 +4 -4
- data/lib/fastlane/plugin/create_simulator_devices/actions/create_simulator_devices_action.rb +14 -4
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runner.rb +29 -12
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runtime_helper.rb +4 -1
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/shell_helper.rb +14 -5
- data/lib/fastlane/plugin/create_simulator_devices/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 796689ee2ebad5e5e67b35eb55164a1b5239b24d932f0fea95a35b36b1d19af1
|
4
|
+
data.tar.gz: 8a2a316d577089472b7caa5beada6298fa06212322640330b126072ff03de757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9520fb0870ebe2a9325cd8b266ff61047152f5c26c017ea9191d57266b0a26f493400b3d31a7197c4899a8fa663e001bcddbcf5618efe23d3890888b72317f0
|
7
|
+
data.tar.gz: 3f44d5be8744ab991e7a3eae9821293b0da4597b6c2ed85509647c78c945530e79a8c0dedc78a89e39fc5e1e62a20eec6eb42eafbc9914d14c45c538cc84c315
|
data/lib/fastlane/plugin/create_simulator_devices/actions/create_simulator_devices_action.rb
CHANGED
@@ -25,7 +25,7 @@ module Fastlane
|
|
25
25
|
required_devices = params[:devices]
|
26
26
|
UI.user_error!('No devices specified') if required_devices.nil? || required_devices.empty?
|
27
27
|
|
28
|
-
shell_helper = CreateSimulatorDevices::ShellHelper.new(
|
28
|
+
shell_helper = CreateSimulatorDevices::ShellHelper.new(print_command: params[:print_command], print_command_output: params[:print_command_output], action_context: self)
|
29
29
|
runtime_helper = CreateSimulatorDevices::RuntimeHelper.new(cache_dir: params[:cache_dir], shell_helper:, verbose:)
|
30
30
|
|
31
31
|
runner = CreateSimulatorDevices::Runner.new(
|
@@ -69,16 +69,26 @@ module Fastlane
|
|
69
69
|
default_value: 'iPhone 16'),
|
70
70
|
::FastlaneCore::ConfigItem.new(key: :cache_dir,
|
71
71
|
description: 'The directory to cache the simulator runtimes',
|
72
|
-
|
72
|
+
type: String,
|
73
73
|
optional: true,
|
74
74
|
default_value: "#{Dir.home}/.cache/create_simulator_devices"),
|
75
75
|
::FastlaneCore::ConfigItem.new(key: :verbose,
|
76
76
|
env_name: 'VERBOSE',
|
77
77
|
description: 'Verbose output',
|
78
|
-
|
78
|
+
type: Boolean,
|
79
79
|
optional: true,
|
80
80
|
default_value: ::FastlaneCore::Globals.verbose?,
|
81
|
-
default_value_dynamic: true)
|
81
|
+
default_value_dynamic: true),
|
82
|
+
::FastlaneCore::ConfigItem.new(key: :print_command,
|
83
|
+
description: 'Print xcrun simctl commands',
|
84
|
+
type: Boolean,
|
85
|
+
optional: true,
|
86
|
+
default_value: false),
|
87
|
+
::FastlaneCore::ConfigItem.new(key: :print_command_output,
|
88
|
+
description: 'Print xcrun simctl commands output',
|
89
|
+
type: Boolean,
|
90
|
+
optional: true,
|
91
|
+
default_value: false)
|
82
92
|
]
|
83
93
|
end
|
84
94
|
|
data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runner.rb
CHANGED
@@ -13,11 +13,13 @@ module Fastlane
|
|
13
13
|
|
14
14
|
def initialize(runtime_helper:, shell_helper:, verbose:)
|
15
15
|
self.shell_helper = shell_helper
|
16
|
-
self.verbose = verbose
|
16
|
+
self.verbose = verbose
|
17
17
|
self.runtime_helper = runtime_helper
|
18
18
|
end
|
19
19
|
|
20
20
|
def run(devices)
|
21
|
+
UI.message("Simulator devices to create: #{devices.join(', ')}")
|
22
|
+
|
21
23
|
shell_helper.stop_core_simulator_services
|
22
24
|
|
23
25
|
# Delete unusable runtimes and unavailable devices.
|
@@ -29,6 +31,11 @@ module Fastlane
|
|
29
31
|
.filter_map { |device| required_device_for_device(device) }
|
30
32
|
.uniq { |required_device| [required_device.device_type.name, required_device.required_runtime.product_version] }
|
31
33
|
|
34
|
+
if verbose
|
35
|
+
UI.message('Unique required devices:')
|
36
|
+
UI.message(" #{required_devices.map(&:description).join("\n ")}")
|
37
|
+
end
|
38
|
+
|
32
39
|
# Install missing runtimes if needed.
|
33
40
|
runtime_helper.install_missing_runtimes(required_devices)
|
34
41
|
|
@@ -39,12 +46,7 @@ module Fastlane
|
|
39
46
|
matched_devices = required_devices
|
40
47
|
.reject { |required_device| required_device.available_device.nil? }
|
41
48
|
|
42
|
-
|
43
|
-
UI.message('Matched devices:')
|
44
|
-
matched_devices.each do |matched_device|
|
45
|
-
UI.message("\t#{matched_device.description}: #{matched_device.available_device.description}")
|
46
|
-
end
|
47
|
-
end
|
49
|
+
log_matched_devices
|
48
50
|
|
49
51
|
matched_devices.map!(&:description)
|
50
52
|
|
@@ -53,6 +55,18 @@ module Fastlane
|
|
53
55
|
matched_devices
|
54
56
|
end
|
55
57
|
|
58
|
+
def log_matched_devices
|
59
|
+
UI.message('Matched devices:')
|
60
|
+
matched_devices.each do |matched_device|
|
61
|
+
device_info = ''
|
62
|
+
if verbose
|
63
|
+
device_info = shell_helper.device_info_by_udid(matched_device.available_device.udid)
|
64
|
+
device_info = "\n#{device_info}"
|
65
|
+
end
|
66
|
+
UI.message(" #{matched_device.description}: #{matched_device.available_device.description}#{device_info}")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
56
70
|
def delete_unavailable_devices
|
57
71
|
return unless shell_helper.available_devices_for_runtimes.values.flatten.any?(&:available?)
|
58
72
|
|
@@ -82,7 +96,10 @@ module Fastlane
|
|
82
96
|
missing_devices = required_devices
|
83
97
|
.select { |required_device| required_device.available_device.nil? }
|
84
98
|
|
85
|
-
|
99
|
+
if missing_devices.empty?
|
100
|
+
UI.message('All required devices are present. Skipping device creation...') if verbose
|
101
|
+
return
|
102
|
+
end
|
86
103
|
|
87
104
|
UI.message('Creating missing devices')
|
88
105
|
missing_devices.each do |missing_device|
|
@@ -118,9 +135,11 @@ module Fastlane
|
|
118
135
|
def required_device_for_device(device)
|
119
136
|
available_device_types = shell_helper.available_device_types
|
120
137
|
|
138
|
+
device_os_version = device[/ \(([\d.]*?)\)$/, 1]
|
139
|
+
device_name = device.delete_suffix(" (#{device_os_version})").strip unless device_os_version.nil?
|
140
|
+
|
121
141
|
device_type = available_device_types.detect do |available_device_type|
|
122
|
-
|
123
|
-
"#{device} ".start_with?("#{available_device_type.name} ")
|
142
|
+
device_name == available_device_type.name
|
124
143
|
end
|
125
144
|
|
126
145
|
unless device_type
|
@@ -131,8 +150,6 @@ module Fastlane
|
|
131
150
|
product_family = device_type.product_family
|
132
151
|
|
133
152
|
os_name = PRODUCT_FAMILY_TO_OS_NAME[product_family]
|
134
|
-
device_os_version = device.delete_prefix(device_type.name).strip
|
135
|
-
device_os_version = device_os_version[/\(([\d.]*?)\)/, 1]
|
136
153
|
|
137
154
|
runtime_version = nil
|
138
155
|
unless device_os_version.nil? || device_os_version.empty?
|
data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runtime_helper.rb
CHANGED
@@ -43,7 +43,10 @@ module Fastlane
|
|
43
43
|
|
44
44
|
missing_runtimes = missing_runtimes(needed_runtimes)
|
45
45
|
|
46
|
-
|
46
|
+
if missing_runtimes.empty?
|
47
|
+
UI.message('All required runtimes are present. Skipping runtime installation...') if verbose
|
48
|
+
return
|
49
|
+
end
|
47
50
|
|
48
51
|
missing_runtimes.each do |missing_runtime|
|
49
52
|
download_and_install_missing_runtime(missing_runtime)
|
data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/shell_helper.rb
CHANGED
@@ -10,16 +10,17 @@ module Fastlane
|
|
10
10
|
UI = ::Fastlane::UI unless defined?(UI)
|
11
11
|
|
12
12
|
# Proprty verbose
|
13
|
-
attr_accessor :
|
13
|
+
attr_accessor :print_command, :print_command_output, :action_context
|
14
14
|
|
15
|
-
def initialize(
|
16
|
-
self.
|
15
|
+
def initialize(print_command: false, print_command_output: false, action_context: nil)
|
16
|
+
self.print_command = print_command
|
17
|
+
self.print_command_output = print_command_output
|
17
18
|
self.action_context = action_context
|
18
19
|
end
|
19
20
|
|
20
|
-
def sh(command:, print_command:
|
21
|
+
def sh(command:, print_command: self.print_command, print_command_output: self.print_command_output)
|
21
22
|
if action_context
|
22
|
-
action_context.sh(command, print_command
|
23
|
+
action_context.sh(command, print_command: print_command, print_command_output: print_command_output)
|
23
24
|
else
|
24
25
|
# Fallback for testing or direct usage
|
25
26
|
require 'open3'
|
@@ -163,6 +164,14 @@ module Fastlane
|
|
163
164
|
UI.important("Failed to import runtime #{runtime_name} with '#{import_platform_command}' :\n#{e}")
|
164
165
|
end
|
165
166
|
end
|
167
|
+
|
168
|
+
def device_info_by_udid(udid)
|
169
|
+
sh(
|
170
|
+
command: "xcrun simctl list devices --json | jq '.devices | to_entries[].value[] | select(.udid==\"#{udid.shellescape}\")'",
|
171
|
+
print_command: false,
|
172
|
+
print_command_output: false
|
173
|
+
)
|
174
|
+
end
|
166
175
|
end
|
167
176
|
end
|
168
177
|
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.
|
4
|
+
version: 0.0.7
|
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-
|
11
|
+
date: 2025-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: developers@setapp.com
|