fastlane-plugin-create_simulator_devices 0.0.17 → 0.0.19
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 +17 -3
- data/lib/fastlane/plugin/create_simulator_devices/actions/gather_simctl_diagnose_action.rb +4 -3
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/apple_build_version.rb +3 -3
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/simctl/matched_runtime.rb +46 -0
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/simctl/runtime.rb +7 -5
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models.rb +1 -0
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runner.rb +13 -4
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runtime_helper.rb +66 -5
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/shell_helper.rb +49 -4
- data/lib/fastlane/plugin/create_simulator_devices/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e17a57f2e1b0ff1083d58d23717995d26796843c633231ba41430b877116fb02
|
|
4
|
+
data.tar.gz: '017846203dca650cb4d1d70f6da80c81f2aef1369b08e3b9443d6f4479ea1a79'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6566a4d2f8837546c119bdb90e4f2013bd4d8b1f499342a6330c4e032b9a9c8099af321ce97c5b601a5ef2b35aa52f33dd74f2475df8ace7290cf66781c5481d
|
|
7
|
+
data.tar.gz: b9966803a099e1678eb635a4c0f6bca4b211b5147e3e268443a022124d6c673c9423e6e27d81f93fefda79f3986111cd8f1dc9de10521e615356ffda4a346d1a
|
data/lib/fastlane/plugin/create_simulator_devices/actions/create_simulator_devices_action.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Fastlane
|
|
|
22
22
|
required_devices = params[:devices]
|
|
23
23
|
UI.user_error!('No devices specified') if required_devices.nil? || required_devices.empty?
|
|
24
24
|
|
|
25
|
-
shell_helper = CreateSimulatorDevices::ShellHelper.new(print_command: params[:print_command], print_command_output: params[:print_command_output], action_context: self)
|
|
25
|
+
shell_helper = CreateSimulatorDevices::ShellHelper.new(verbose: verbose, print_command: params[:print_command], print_command_output: params[:print_command_output], action_context: self)
|
|
26
26
|
runtime_helper = CreateSimulatorDevices::RuntimeHelper.new(cache_dir: params[:cache_dir], shell_helper: shell_helper, verbose: verbose)
|
|
27
27
|
|
|
28
28
|
runner = CreateSimulatorDevices::Runner.new(
|
|
@@ -32,7 +32,9 @@ module Fastlane
|
|
|
32
32
|
can_rename_devices: params[:rename_devices],
|
|
33
33
|
can_delete_duplicate_devices: params[:delete_duplicate_devices],
|
|
34
34
|
device_naming_style: params[:device_naming_style].to_sym,
|
|
35
|
-
remove_cached_runtimes: params[:remove_cached_runtimes]
|
|
35
|
+
remove_cached_runtimes: params[:remove_cached_runtimes],
|
|
36
|
+
update_dyld_shared_cache: params[:update_dyld_shared_cache],
|
|
37
|
+
delete_unused_runtimes: params[:delete_unused_runtimes]
|
|
36
38
|
)
|
|
37
39
|
|
|
38
40
|
runner.run(required_devices)
|
|
@@ -113,7 +115,19 @@ module Fastlane
|
|
|
113
115
|
description: 'Remove cached runtimes after successful installation',
|
|
114
116
|
type: Boolean,
|
|
115
117
|
optional: true,
|
|
116
|
-
default_value: true)
|
|
118
|
+
default_value: true),
|
|
119
|
+
::FastlaneCore::ConfigItem.new(key: :update_dyld_shared_cache,
|
|
120
|
+
env_name: 'CREATE_SIMULATOR_DEVICES_UPDATE_DYLD_SHARED_CACHE',
|
|
121
|
+
description: 'Update dyld shared cache',
|
|
122
|
+
type: Boolean,
|
|
123
|
+
optional: true,
|
|
124
|
+
default_value: false),
|
|
125
|
+
::FastlaneCore::ConfigItem.new(key: :delete_unused_runtimes,
|
|
126
|
+
env_name: 'CREATE_SIMULATOR_DEVICES_DELETE_UNUSED_RUNTIMES',
|
|
127
|
+
description: 'Delete unused runtimes',
|
|
128
|
+
type: Boolean,
|
|
129
|
+
optional: true,
|
|
130
|
+
default_value: false)
|
|
117
131
|
]
|
|
118
132
|
end
|
|
119
133
|
|
|
@@ -10,7 +10,6 @@ require_relative '../helpers/gather_simctl_diagnose/runner'
|
|
|
10
10
|
module Fastlane
|
|
11
11
|
module Actions
|
|
12
12
|
GatherSimctlDiagnose = ::Fastlane::GatherSimctlDiagnose
|
|
13
|
-
CreateSimulatorDevices = ::Fastlane::CreateSimulatorDevices
|
|
14
13
|
|
|
15
14
|
# Gather simctl diagnose data.
|
|
16
15
|
class GatherSimctlDiagnoseAction < Fastlane::Action
|
|
@@ -24,7 +23,7 @@ module Fastlane
|
|
|
24
23
|
required_devices = params[:devices]
|
|
25
24
|
UI.user_error!('No devices specified') if required_devices.nil? || required_devices.empty?
|
|
26
25
|
|
|
27
|
-
shell_helper = CreateSimulatorDevices::ShellHelper.new(print_command: params[:print_command], print_command_output: params[:print_command_output], action_context: self)
|
|
26
|
+
shell_helper = CreateSimulatorDevices::ShellHelper.new(verbose: verbose, print_command: params[:print_command], print_command_output: params[:print_command_output], action_context: self)
|
|
28
27
|
runtime_helper = CreateSimulatorDevices::RuntimeHelper.new(cache_dir: nil, shell_helper: shell_helper, verbose: verbose)
|
|
29
28
|
|
|
30
29
|
create_simulator_devices_runner = ::Fastlane::CreateSimulatorDevices::Runner.new(
|
|
@@ -34,7 +33,9 @@ module Fastlane
|
|
|
34
33
|
can_rename_devices: false,
|
|
35
34
|
can_delete_duplicate_devices: false,
|
|
36
35
|
device_naming_style: params[:device_naming_style].to_sym,
|
|
37
|
-
remove_cached_runtimes: false
|
|
36
|
+
remove_cached_runtimes: false,
|
|
37
|
+
update_dyld_shared_cache: false,
|
|
38
|
+
delete_unused_runtimes: false
|
|
38
39
|
)
|
|
39
40
|
|
|
40
41
|
runner = GatherSimctlDiagnose::Runner.new(
|
|
@@ -62,15 +62,15 @@ module Fastlane
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
def major
|
|
65
|
-
@build_version.match(/^([0-9]+)([A-Z]
|
|
65
|
+
@build_version.match(/^([0-9]+)([A-Z])([0-9]+)/)[1]
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def minor
|
|
69
|
-
@build_version.match(/^([0-9]+)([A-Z]
|
|
69
|
+
@build_version.match(/^([0-9]+)([A-Z])([0-9]+)/)[2]
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def patch
|
|
73
|
-
@build_version.match(/^([0-9]+)([A-Z]
|
|
73
|
+
@build_version.match(/^([0-9]+)([A-Z])([0-9]+)/)[3]
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
def <(other)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'runtime_supported_device_type'
|
|
4
|
+
require_relative '../apple_build_version'
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module CreateSimulatorDevices
|
|
8
|
+
module SimCTL
|
|
9
|
+
# Represents a matched runtime from `xcrun simctl runtime match list --json` output.
|
|
10
|
+
class MatchedRuntime
|
|
11
|
+
attr_accessor :identifier, :default_build, :chosen_runtime_build, :sdk_build, :sdk_version, :platform
|
|
12
|
+
|
|
13
|
+
def initialize(identifier:, default_build:, chosen_runtime_build:, sdk_build:, sdk_version:, platform:) # rubocop:disable Metrics/ParameterLists
|
|
14
|
+
self.identifier = identifier
|
|
15
|
+
self.default_build = default_build
|
|
16
|
+
self.chosen_runtime_build = chosen_runtime_build
|
|
17
|
+
self.sdk_build = sdk_build
|
|
18
|
+
self.sdk_version = sdk_version
|
|
19
|
+
self.platform = platform
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.from_hash(hash, identifier:)
|
|
23
|
+
new(
|
|
24
|
+
identifier: identifier.to_s,
|
|
25
|
+
default_build: AppleBuildVersion.new(hash[:defaultBuild]),
|
|
26
|
+
chosen_runtime_build: AppleBuildVersion.new(hash[:chosenRuntimeBuild]),
|
|
27
|
+
sdk_build: AppleBuildVersion.new(hash[:sdkBuild]),
|
|
28
|
+
sdk_version: Gem::Version.new(hash[:sdkVersion]),
|
|
29
|
+
platform: hash[:platform].to_s
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Example of a Runtime object from `xcrun simctl list runtimes --json` output:
|
|
38
|
+
#
|
|
39
|
+
# {"iphoneos26.1" : {
|
|
40
|
+
# "chosenRuntimeBuild" : "23B80",
|
|
41
|
+
# "defaultBuild" : "23B77",
|
|
42
|
+
# "platform" : "com.apple.platform.iphoneos",
|
|
43
|
+
# "sdkBuild" : "23B77",
|
|
44
|
+
# "sdkDirectory" : "\/Applications\/Xcode-26.1.1.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Developer\/SDKs\/iPhoneOS26.1.sdk",
|
|
45
|
+
# "sdkVersion" : "26.1"
|
|
46
|
+
# }
|
|
@@ -8,14 +8,15 @@ module Fastlane
|
|
|
8
8
|
module SimCTL
|
|
9
9
|
# Represents a runtime from `xcrun simctl runtime list --json` output.
|
|
10
10
|
class RuntimeWithState
|
|
11
|
-
attr_accessor :identifier, :version, :build, :state, :deletable
|
|
11
|
+
attr_accessor :identifier, :version, :build, :state, :deletable, :runtime_identifier
|
|
12
12
|
|
|
13
|
-
def initialize(identifier:, version:, build:, state:, deletable:)
|
|
13
|
+
def initialize(identifier:, version:, build:, state:, deletable:, runtime_identifier:) # rubocop:disable Metrics/ParameterLists
|
|
14
14
|
self.identifier = identifier
|
|
15
15
|
self.version = version
|
|
16
16
|
self.build = build
|
|
17
17
|
self.state = state
|
|
18
18
|
self.deletable = deletable
|
|
19
|
+
self.runtime_identifier = runtime_identifier
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
def ready?
|
|
@@ -32,11 +33,12 @@ module Fastlane
|
|
|
32
33
|
|
|
33
34
|
def self.from_hash(hash)
|
|
34
35
|
new(
|
|
35
|
-
identifier: hash[:identifier],
|
|
36
|
+
identifier: hash[:identifier].to_s,
|
|
36
37
|
version: Gem::Version.new(hash[:version]),
|
|
37
38
|
build: AppleBuildVersion.new(hash[:build]),
|
|
38
|
-
state: hash[:state],
|
|
39
|
-
deletable: hash[:deletable]
|
|
39
|
+
state: hash[:state].to_s,
|
|
40
|
+
deletable: hash[:deletable],
|
|
41
|
+
runtime_identifier: hash[:runtimeIdentifier].to_s
|
|
40
42
|
)
|
|
41
43
|
end
|
|
42
44
|
end
|
data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models.rb
CHANGED
|
@@ -9,6 +9,7 @@ require_relative 'models/required_device'
|
|
|
9
9
|
require_relative 'models/required_runtime'
|
|
10
10
|
require_relative 'models/apple_build_version'
|
|
11
11
|
require_relative 'models/device_naming_style'
|
|
12
|
+
require_relative 'models/simctl/matched_runtime'
|
|
12
13
|
require 'fastlane'
|
|
13
14
|
|
|
14
15
|
module Fastlane
|
data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runner.rb
CHANGED
|
@@ -9,12 +9,12 @@ module Fastlane
|
|
|
9
9
|
# Create simulator devices.
|
|
10
10
|
module CreateSimulatorDevices
|
|
11
11
|
# Does all the work to create simulator devices.
|
|
12
|
-
class Runner
|
|
12
|
+
class Runner
|
|
13
13
|
UI = ::Fastlane::UI unless defined?(UI)
|
|
14
14
|
|
|
15
|
-
attr_accessor :shell_helper, :verbose, :runtime_helper, :can_rename_devices, :can_delete_duplicate_devices, :device_naming_style, :remove_cached_runtimes
|
|
15
|
+
attr_accessor :shell_helper, :verbose, :runtime_helper, :can_rename_devices, :can_delete_duplicate_devices, :device_naming_style, :remove_cached_runtimes, :update_dyld_shared_cache, :delete_unused_runtimes
|
|
16
16
|
|
|
17
|
-
def initialize(runtime_helper:, shell_helper:, verbose:, can_rename_devices:, can_delete_duplicate_devices:, device_naming_style:, remove_cached_runtimes:) # rubocop:disable Metrics/ParameterLists
|
|
17
|
+
def initialize(runtime_helper:, shell_helper:, verbose:, can_rename_devices:, can_delete_duplicate_devices:, device_naming_style:, remove_cached_runtimes:, update_dyld_shared_cache:, delete_unused_runtimes:) # rubocop:disable Metrics/ParameterLists
|
|
18
18
|
self.shell_helper = shell_helper
|
|
19
19
|
self.verbose = verbose
|
|
20
20
|
self.runtime_helper = runtime_helper
|
|
@@ -22,6 +22,8 @@ module Fastlane
|
|
|
22
22
|
self.can_delete_duplicate_devices = can_delete_duplicate_devices
|
|
23
23
|
self.device_naming_style = device_naming_style
|
|
24
24
|
self.remove_cached_runtimes = remove_cached_runtimes
|
|
25
|
+
self.update_dyld_shared_cache = update_dyld_shared_cache
|
|
26
|
+
self.delete_unused_runtimes = delete_unused_runtimes
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
def run(devices)
|
|
@@ -44,7 +46,7 @@ module Fastlane
|
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
# Install missing runtimes if needed.
|
|
47
|
-
runtime_helper.install_missing_runtimes(required_devices, remove_cached_runtimes: remove_cached_runtimes)
|
|
49
|
+
runtime_helper.install_missing_runtimes(required_devices, remove_cached_runtimes: remove_cached_runtimes, remove_unused_runtimes: delete_unused_runtimes)
|
|
48
50
|
|
|
49
51
|
# Create missing devices for required devices.
|
|
50
52
|
create_missing_devices(required_devices)
|
|
@@ -55,6 +57,11 @@ module Fastlane
|
|
|
55
57
|
|
|
56
58
|
log_matched_devices(matched_devices: matched_devices)
|
|
57
59
|
|
|
60
|
+
if update_dyld_shared_cache
|
|
61
|
+
UI.message('Updating dyld shared cache...')
|
|
62
|
+
shell_helper.update_dyld_shared_cache
|
|
63
|
+
end
|
|
64
|
+
|
|
58
65
|
matched_devices_names = matched_devices.map { |matched_device| returning_device_name_for_required_device(matched_device) }
|
|
59
66
|
UI.message("Available simulator devices: #{matched_devices_names.join(', ')}")
|
|
60
67
|
|
|
@@ -190,6 +197,8 @@ module Fastlane
|
|
|
190
197
|
|
|
191
198
|
UI.message('Creating missing devices')
|
|
192
199
|
missing_devices.each do |missing_device|
|
|
200
|
+
next if missing_device.simctl_runtime.nil?
|
|
201
|
+
|
|
193
202
|
shell_helper.create_device(
|
|
194
203
|
device_name_for_required_device(missing_device),
|
|
195
204
|
missing_device.device_type.identifier,
|
data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runtime_helper.rb
CHANGED
|
@@ -7,7 +7,7 @@ require_relative 'shell_helper'
|
|
|
7
7
|
module Fastlane
|
|
8
8
|
module CreateSimulatorDevices
|
|
9
9
|
# Helper class for managing simulator runtimes.
|
|
10
|
-
class RuntimeHelper
|
|
10
|
+
class RuntimeHelper # rubocop:disable Metrics/ClassLength
|
|
11
11
|
UI = ::Fastlane::UI unless defined?(UI)
|
|
12
12
|
|
|
13
13
|
attr_accessor :cache_dir, :shell_helper, :verbose
|
|
@@ -25,6 +25,13 @@ module Fastlane
|
|
|
25
25
|
'xrsimulator' => 'xrOS'
|
|
26
26
|
}.freeze
|
|
27
27
|
|
|
28
|
+
OS_NAME_TO_MATCHED_RUNTIME_IDENTIFIER = {
|
|
29
|
+
'iOS' => 'iphoneos',
|
|
30
|
+
'tvOS' => 'appletvos',
|
|
31
|
+
'watchOS' => 'watchos',
|
|
32
|
+
'xrOS' => 'xros'
|
|
33
|
+
}.freeze
|
|
34
|
+
|
|
28
35
|
def delete_unusable_runtimes
|
|
29
36
|
deletable_runtimes = shell_helper.installed_runtimes_with_state
|
|
30
37
|
.select { |runtime| runtime.unusable? && runtime.deletable? }
|
|
@@ -39,13 +46,14 @@ module Fastlane
|
|
|
39
46
|
shell_helper.simctl_devices_for_runtimes(force: true)
|
|
40
47
|
end
|
|
41
48
|
|
|
42
|
-
def install_missing_runtimes(required_devices, remove_cached_runtimes:)
|
|
49
|
+
def install_missing_runtimes(required_devices, remove_cached_runtimes:, remove_unused_runtimes:)
|
|
43
50
|
needed_runtimes = required_devices.filter_map(&:required_runtime).uniq
|
|
44
51
|
|
|
45
52
|
missing_runtimes = missing_runtimes(needed_runtimes)
|
|
46
53
|
|
|
47
54
|
if missing_runtimes.empty?
|
|
48
55
|
UI.message('All required runtimes are present. Skipping runtime installation...') if verbose
|
|
56
|
+
delete_unused_runtimes(needed_runtimes) if remove_unused_runtimes
|
|
49
57
|
return
|
|
50
58
|
end
|
|
51
59
|
|
|
@@ -66,6 +74,41 @@ module Fastlane
|
|
|
66
74
|
.each do |missing_runtime|
|
|
67
75
|
UI.important("Failed to find/download/install runtime #{missing_runtime.runtime_name}")
|
|
68
76
|
end
|
|
77
|
+
|
|
78
|
+
delete_unused_runtimes(needed_runtimes) if remove_unused_runtimes
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def delete_unused_runtimes(needed_runtimes)
|
|
82
|
+
UI.message('Deleting unused runtimes...')
|
|
83
|
+
available_simctl_runtimes = shell_helper.simctl_runtimes
|
|
84
|
+
|
|
85
|
+
needed_simctl_runtimes = needed_runtimes.map do |needed_runtime|
|
|
86
|
+
# Check if available runtimes contain the needed runtime.
|
|
87
|
+
simctl_runtime_matching_needed_runtime?(needed_runtime)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
unused_simctl_runtimes = available_simctl_runtimes.reject do |available_simctl_runtime|
|
|
91
|
+
needed_simctl_runtimes.any? do |needed_simctl_runtime|
|
|
92
|
+
needed_simctl_runtime.identifier == available_simctl_runtime.identifier
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
unused_simctl_runtimes = unused_simctl_runtimes.filter_map do |unused_simctl_runtime|
|
|
97
|
+
shell_helper.installed_runtimes_with_state.detect do |installed_simctl_runtime|
|
|
98
|
+
installed_simctl_runtime.runtime_identifier == unused_simctl_runtime.identifier
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
return if unused_simctl_runtimes.empty?
|
|
103
|
+
|
|
104
|
+
unused_simctl_runtimes.each do |unused_simctl_runtime|
|
|
105
|
+
puts "Deleting unused runtime #{unused_simctl_runtime.runtime_identifier} (#{unused_simctl_runtime.identifier})..."
|
|
106
|
+
shell_helper.simctl_delete_runtime(identifier: unused_simctl_runtime.identifier)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
shell_helper.installed_runtimes_with_state
|
|
110
|
+
shell_helper.simctl_runtimes(force: true)
|
|
111
|
+
shell_helper.simctl_devices_for_runtimes(force: true)
|
|
69
112
|
end
|
|
70
113
|
|
|
71
114
|
def missing_runtimes(needed_runtimes)
|
|
@@ -153,6 +196,16 @@ module Fastlane
|
|
|
153
196
|
AppleBuildVersion.new(build_version)
|
|
154
197
|
end
|
|
155
198
|
|
|
199
|
+
def matched_runtime_for_missing_runtime(missing_runtime)
|
|
200
|
+
matched_runtimes = shell_helper.simctl_matched_runtimes(force: true)
|
|
201
|
+
|
|
202
|
+
matched_runtime_identifier = "#{OS_NAME_TO_MATCHED_RUNTIME_IDENTIFIER[missing_runtime.os_name]}#{missing_runtime.product_version}"
|
|
203
|
+
|
|
204
|
+
matched_runtimes = matched_runtimes.select { |matched_runtime| matched_runtime.identifier == matched_runtime_identifier && matched_runtime.sdk_build == missing_runtime.product_build_version }
|
|
205
|
+
|
|
206
|
+
matched_runtimes.max_by(&:chosen_runtime_build)
|
|
207
|
+
end
|
|
208
|
+
|
|
156
209
|
def cached_runtime_file(missing_runtime)
|
|
157
210
|
FileUtils.mkdir_p(cache_dir)
|
|
158
211
|
|
|
@@ -164,10 +217,10 @@ module Fastlane
|
|
|
164
217
|
# E.g. Xcode 26.0 Beta 3 has iOS 26.0 (23A5287e) SDK, but
|
|
165
218
|
# xcodebuild downloads iphonesimulator_26.0_23A5287g.dmg as latest.
|
|
166
219
|
product_build_version = missing_runtime.product_build_version
|
|
220
|
+
|
|
167
221
|
if product_build_version
|
|
168
222
|
runtime_dmg_search_pattern += product_build_version.major.to_s
|
|
169
223
|
runtime_dmg_search_pattern += product_build_version.minor.to_s
|
|
170
|
-
runtime_dmg_search_pattern += product_build_version.patch.to_s
|
|
171
224
|
end
|
|
172
225
|
runtime_dmg_search_pattern += '*.dmg'
|
|
173
226
|
|
|
@@ -177,9 +230,17 @@ module Fastlane
|
|
|
177
230
|
UI.message("Available files with pattern: #{Dir.glob(runtime_dmg_search_pattern)}")
|
|
178
231
|
end
|
|
179
232
|
|
|
180
|
-
runtime_file =
|
|
233
|
+
runtime_file = nil
|
|
234
|
+
runtime_files = Dir
|
|
181
235
|
.glob(runtime_dmg_search_pattern)
|
|
182
|
-
|
|
236
|
+
|
|
237
|
+
return nil if runtime_files.empty?
|
|
238
|
+
|
|
239
|
+
matched_runtime = matched_runtime_for_missing_runtime(missing_runtime)
|
|
240
|
+
|
|
241
|
+
runtime_file = runtime_files.detect { |filename| filename.end_with?("_#{matched_runtime.chosen_runtime_build}.dmg") } unless matched_runtime.nil?
|
|
242
|
+
|
|
243
|
+
runtime_file ||= runtime_files.max_by { |filename| runtime_build_version_for_filename(filename) }
|
|
183
244
|
|
|
184
245
|
return nil if runtime_file.nil?
|
|
185
246
|
|
data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/shell_helper.rb
CHANGED
|
@@ -11,9 +11,10 @@ module Fastlane
|
|
|
11
11
|
UI = ::Fastlane::UI unless defined?(UI)
|
|
12
12
|
|
|
13
13
|
# Proprty verbose
|
|
14
|
-
attr_accessor :print_command, :print_command_output, :action_context
|
|
14
|
+
attr_accessor :verbose, :print_command, :print_command_output, :action_context
|
|
15
15
|
|
|
16
|
-
def initialize(print_command: false, print_command_output: false, action_context: nil)
|
|
16
|
+
def initialize(verbose: false, print_command: false, print_command_output: false, action_context: nil)
|
|
17
|
+
self.verbose = verbose
|
|
17
18
|
self.print_command = print_command
|
|
18
19
|
self.print_command_output = print_command_output
|
|
19
20
|
self.action_context = action_context
|
|
@@ -103,6 +104,22 @@ module Fastlane
|
|
|
103
104
|
@simctl_runtimes
|
|
104
105
|
end
|
|
105
106
|
|
|
107
|
+
def simctl_delete_runtime(identifier:)
|
|
108
|
+
UI.message("Deleting runtime #{identifier}...")
|
|
109
|
+
sh(command: "xcrun simctl runtime delete #{identifier.shellescape}")
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def simctl_matched_runtimes(force: false)
|
|
113
|
+
return @simctl_matched_runtimes unless force || @simctl_matched_runtimes.nil?
|
|
114
|
+
|
|
115
|
+
UI.message('Fetching matched runtimes...')
|
|
116
|
+
json = sh(command: 'xcrun simctl runtime match list --json')
|
|
117
|
+
|
|
118
|
+
@simctl_matched_runtimes = JSON
|
|
119
|
+
.parse(json, symbolize_names: true)
|
|
120
|
+
.map { |identifier, runtime| SimCTL::MatchedRuntime.from_hash(runtime, identifier: identifier) }
|
|
121
|
+
end
|
|
122
|
+
|
|
106
123
|
def installed_runtimes_with_state
|
|
107
124
|
UI.message('Fetching runtimes with state...')
|
|
108
125
|
json = sh(command: 'xcrun simctl runtime list --json')
|
|
@@ -141,8 +158,6 @@ module Fastlane
|
|
|
141
158
|
end
|
|
142
159
|
|
|
143
160
|
def download_runtime(missing_runtime, cache_dir)
|
|
144
|
-
UI.message("Downloading #{missing_runtime.runtime_name} to #{cache_dir}. This may take a while...")
|
|
145
|
-
|
|
146
161
|
command = [
|
|
147
162
|
'xcrun',
|
|
148
163
|
'xcodebuild',
|
|
@@ -162,6 +177,30 @@ module Fastlane
|
|
|
162
177
|
command << missing_runtime.product_version.to_s.shellescape
|
|
163
178
|
end
|
|
164
179
|
|
|
180
|
+
simulator_architecture_variant = 'universal'
|
|
181
|
+
|
|
182
|
+
if Fastlane::Helper.xcode_at_least?('26') && missing_runtime.product_version >= '26'
|
|
183
|
+
xcode_binary_path = File.join(Fastlane::Helper.xcode_path, '..', 'MacOS', 'Xcode')
|
|
184
|
+
xcode_binary_path = File.expand_path(xcode_binary_path)
|
|
185
|
+
|
|
186
|
+
UI.message('Getting Xcode architecture variants with lipo...') if verbose
|
|
187
|
+
|
|
188
|
+
xcode_architecture_variants = sh(command: "lipo -archs #{xcode_binary_path.shellescape}", print_command: print_command, print_command_output: print_command_output).split
|
|
189
|
+
|
|
190
|
+
UI.message("Xcode architecture variants: #{xcode_architecture_variants}") if verbose
|
|
191
|
+
|
|
192
|
+
simulator_architecture_variant = if xcode_architecture_variants.include?('x86_64')
|
|
193
|
+
'universal'
|
|
194
|
+
else
|
|
195
|
+
'arm64'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
command << '-architectureVariant'
|
|
199
|
+
command << simulator_architecture_variant.shellescape
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
UI.message("Downloading #{missing_runtime.runtime_name} (arch: #{simulator_architecture_variant}) to #{cache_dir}. This may take a while...")
|
|
203
|
+
|
|
165
204
|
sh(command: command.join(' '), print_command: true, print_command_output: true)
|
|
166
205
|
end
|
|
167
206
|
|
|
@@ -175,6 +214,12 @@ module Fastlane
|
|
|
175
214
|
end
|
|
176
215
|
end
|
|
177
216
|
|
|
217
|
+
def update_dyld_shared_cache
|
|
218
|
+
sh(
|
|
219
|
+
command: 'xcrun simctl runtime dyld_shared_cache update --all'
|
|
220
|
+
)
|
|
221
|
+
end
|
|
222
|
+
|
|
178
223
|
def device_info_by_udid(udid)
|
|
179
224
|
sh(
|
|
180
225
|
command: "xcrun simctl list devices --json | jq '.devices | to_entries[].value[] | select(.udid==\"#{udid.shellescape}\")'",
|
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.19
|
|
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-09
|
|
11
|
+
date: 2025-12-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: developers@setapp.com
|
|
@@ -28,6 +28,7 @@ files:
|
|
|
28
28
|
- lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/required_runtime.rb
|
|
29
29
|
- lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/simctl/device.rb
|
|
30
30
|
- lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/simctl/device_type.rb
|
|
31
|
+
- lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/simctl/matched_runtime.rb
|
|
31
32
|
- lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/simctl/runtime.rb
|
|
32
33
|
- lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/simctl/runtime_supported_device_type.rb
|
|
33
34
|
- lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/models/xcodebuild/sdk.rb
|