fastlane-plugin-create_simulator_devices 0.0.18 → 0.0.20
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 +8 -1
- data/lib/fastlane/plugin/create_simulator_devices/actions/gather_simctl_diagnose_action.rb +3 -2
- 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/runner.rb +6 -3
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/runtime_helper.rb +40 -2
- data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/shell_helper.rb +5 -0
- 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: 90a9e367b6c4f8fdebf950f90e2c8a5132e84f70b8e29e7f1fd9f7e0d35ff844
|
|
4
|
+
data.tar.gz: 1798f2157c42c4c0d127205b911f5bc8b4ed11216c68385d7f22156f6a1253e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9ef8d640a6385c091b2a4829bd45f8826bdf4ad142f496a2b19a5d18c4e878a4427d3e02f452a975ae2b63dc38dca89cf78ee6c34140fa56172597e145eb556
|
|
7
|
+
data.tar.gz: b2af15e0226b095f38b6af3c8c77be9453756c816db65980fb0abf20fcc0c0793e8b30302ceb8f848c6a4390eee09e87230565323a914fedfc7b01a8eacd6104
|
data/lib/fastlane/plugin/create_simulator_devices/actions/create_simulator_devices_action.rb
CHANGED
|
@@ -33,7 +33,8 @@ module Fastlane
|
|
|
33
33
|
can_delete_duplicate_devices: params[:delete_duplicate_devices],
|
|
34
34
|
device_naming_style: params[:device_naming_style].to_sym,
|
|
35
35
|
remove_cached_runtimes: params[:remove_cached_runtimes],
|
|
36
|
-
update_dyld_shared_cache: params[:update_dyld_shared_cache]
|
|
36
|
+
update_dyld_shared_cache: params[:update_dyld_shared_cache],
|
|
37
|
+
delete_unused_runtimes: params[:delete_unused_runtimes]
|
|
37
38
|
)
|
|
38
39
|
|
|
39
40
|
runner.run(required_devices)
|
|
@@ -120,6 +121,12 @@ module Fastlane
|
|
|
120
121
|
description: 'Update dyld shared cache',
|
|
121
122
|
type: Boolean,
|
|
122
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,
|
|
123
130
|
default_value: false)
|
|
124
131
|
]
|
|
125
132
|
end
|
|
@@ -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
|
|
@@ -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(
|
|
@@ -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/runner.rb
CHANGED
|
@@ -12,9 +12,9 @@ module Fastlane
|
|
|
12
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, :update_dyld_shared_cache
|
|
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:, update_dyld_shared_cache:) # 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
|
|
@@ -23,6 +23,7 @@ module Fastlane
|
|
|
23
23
|
self.device_naming_style = device_naming_style
|
|
24
24
|
self.remove_cached_runtimes = remove_cached_runtimes
|
|
25
25
|
self.update_dyld_shared_cache = update_dyld_shared_cache
|
|
26
|
+
self.delete_unused_runtimes = delete_unused_runtimes
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def run(devices)
|
|
@@ -45,7 +46,7 @@ module Fastlane
|
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
# Install missing runtimes if needed.
|
|
48
|
-
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, delete_unused_runtimes: delete_unused_runtimes)
|
|
49
50
|
|
|
50
51
|
# Create missing devices for required devices.
|
|
51
52
|
create_missing_devices(required_devices)
|
|
@@ -196,6 +197,8 @@ module Fastlane
|
|
|
196
197
|
|
|
197
198
|
UI.message('Creating missing devices')
|
|
198
199
|
missing_devices.each do |missing_device|
|
|
200
|
+
next if missing_device.simctl_runtime.nil?
|
|
201
|
+
|
|
199
202
|
shell_helper.create_device(
|
|
200
203
|
device_name_for_required_device(missing_device),
|
|
201
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
|
|
@@ -46,13 +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:)
|
|
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 delete_unused_runtimes
|
|
56
57
|
return
|
|
57
58
|
end
|
|
58
59
|
|
|
@@ -61,6 +62,7 @@ module Fastlane
|
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
# Update simctl_runtimes after installing the runtimes.
|
|
65
|
+
shell_helper.stop_core_simulator_services
|
|
64
66
|
shell_helper.installed_runtimes_with_state
|
|
65
67
|
shell_helper.simctl_runtimes(force: true)
|
|
66
68
|
shell_helper.simctl_devices_for_runtimes(force: true)
|
|
@@ -73,6 +75,42 @@ module Fastlane
|
|
|
73
75
|
.each do |missing_runtime|
|
|
74
76
|
UI.important("Failed to find/download/install runtime #{missing_runtime.runtime_name}")
|
|
75
77
|
end
|
|
78
|
+
|
|
79
|
+
delete_unused_runtimes(needed_runtimes) if delete_unused_runtimes
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def delete_unused_runtimes(needed_runtimes)
|
|
83
|
+
UI.message('Deleting unused runtimes...')
|
|
84
|
+
available_simctl_runtimes = shell_helper.simctl_runtimes
|
|
85
|
+
|
|
86
|
+
needed_simctl_runtimes = needed_runtimes.map do |needed_runtime|
|
|
87
|
+
# Check if available runtimes contain the needed runtime.
|
|
88
|
+
simctl_runtime_matching_needed_runtime?(needed_runtime)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
unused_simctl_runtimes = available_simctl_runtimes.reject do |available_simctl_runtime|
|
|
92
|
+
needed_simctl_runtimes.any? do |needed_simctl_runtime|
|
|
93
|
+
needed_simctl_runtime.identifier == available_simctl_runtime.identifier
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
unused_simctl_runtimes = unused_simctl_runtimes.filter_map do |unused_simctl_runtime|
|
|
98
|
+
shell_helper.installed_runtimes_with_state.detect do |installed_simctl_runtime|
|
|
99
|
+
installed_simctl_runtime.runtime_identifier == unused_simctl_runtime.identifier
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
return if unused_simctl_runtimes.empty?
|
|
104
|
+
|
|
105
|
+
unused_simctl_runtimes.each do |unused_simctl_runtime|
|
|
106
|
+
puts "Deleting unused runtime #{unused_simctl_runtime.runtime_identifier} (#{unused_simctl_runtime.identifier})..."
|
|
107
|
+
shell_helper.simctl_delete_runtime(identifier: unused_simctl_runtime.identifier)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
shell_helper.stop_core_simulator_services
|
|
111
|
+
shell_helper.installed_runtimes_with_state
|
|
112
|
+
shell_helper.simctl_runtimes(force: true)
|
|
113
|
+
shell_helper.simctl_devices_for_runtimes(force: true)
|
|
76
114
|
end
|
|
77
115
|
|
|
78
116
|
def missing_runtimes(needed_runtimes)
|
data/lib/fastlane/plugin/create_simulator_devices/helpers/create_simulator_devices/shell_helper.rb
CHANGED
|
@@ -104,6 +104,11 @@ module Fastlane
|
|
|
104
104
|
@simctl_runtimes
|
|
105
105
|
end
|
|
106
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
|
+
|
|
107
112
|
def simctl_matched_runtimes(force: false)
|
|
108
113
|
return @simctl_matched_runtimes unless force || @simctl_matched_runtimes.nil?
|
|
109
114
|
|
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.20
|
|
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-12-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: developers@setapp.com
|