Skip to content

Commit 7de3b51

Browse files
committed
WIP
1 parent e12134e commit 7de3b51

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

fastlane/Fastfile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,26 @@ devices = {
3030
}
3131

3232
before_all do |lane, options|
33-
create_simulators unless lane == :create_simulators
33+
next if lane == :create_simulators
34+
35+
platform = options[:platform].to_s.downcase if options.key?(:platform)
36+
version = options[:version].to_i if options.key?(:version)
37+
38+
if platform && devices.key?(platform)
39+
# Filter to the requested platform and optionally the specific version
40+
subset_versions = devices[platform]
41+
if version && subset_versions.key?(version)
42+
filtered = { platform => { version => subset_versions[version] } }
43+
else
44+
filtered = { platform => subset_versions }
45+
end
46+
create_simulators(devices_subset: filtered)
47+
else
48+
create_simulators
49+
end
3450
end
3551

36-
lane :create_simulators do
52+
lane :create_simulators do |options|
3753
require 'json'
3854
require 'set'
3955

@@ -84,7 +100,9 @@ lane :create_simulators do
84100
"com.apple.CoreSimulator.SimRuntime.#{os_name}-#{version.tr('.', '-')}"
85101
end
86102

87-
devices.each do |platform, versions|
103+
local_devices = (options && options[:devices_subset]) || devices
104+
105+
local_devices.each do |platform, versions|
88106
os_name = platforms_to_os[platform]
89107
next if os_name.nil?
90108

@@ -108,7 +126,8 @@ lane :create_simulators do
108126
device_type_id = device_name_to_id[device_name] || build_device_type_id.call(device_name)
109127
runtime_id = runtime_name_to_id[runtime_name] || build_runtime_id.call(os_name, runtime_version)
110128

111-
sim_name = descriptor # keep the nice human-readable name
129+
# Use the device name without the version suffix as the simulator name
130+
sim_name = device_name
112131

113132
if existing_names.include?(sim_name)
114133
UI.message("Already exists: #{sim_name}, skipping")

0 commit comments

Comments
 (0)