fastlane-plugin-stream_actions 0.3.9 → 0.3.11

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: 2351d32a44938bf481a77ea30dd2de1fe01cd308976715240c7e3b25ab938f42
4
- data.tar.gz: 4678fe7082ae8415a582aab09215e0822c3c06b99fb05d152c06ef2cd161dee9
3
+ metadata.gz: 77d1f01aeaf6caea0d828c622321fbf2911cba2254186e8c9ad992077b31ff14
4
+ data.tar.gz: 32d40096fa6cf67f62e6a8b354d12d5ef2348557121533b9f25137ba477de605
5
5
  SHA512:
6
- metadata.gz: 9083f04733cd69483415f70fe29ba103f95d300316b77777185a6e898e797e2b251138bbc4e9b14747dfdcb5b7ca824fb1c5663102e6cd1bf856e4c28ce13aa5
7
- data.tar.gz: 4c610fa642bb0480be738724dacc101abe8d14ae6e914ce7379e299849f35f5b0e4ce4e62ed5dbe458d7d8b2cd9a2d09e7faf4083db833d1f4cf6ac2cd5a50f9
6
+ metadata.gz: b4c866883b3abb57399fe973aa7e1a59e1dc4e0d6d2db66c95b133b93f160bb3a6f0338eed6929ba8a0a9fead764bc2ccea0c4e1090cc576f7a1da0b636c200a
7
+ data.tar.gz: 609469f599c1e7c128e0abc2fd6e2b76fe96604044d38ffca6ad9199471d51ffa2307e7bd442cdedf1903796471db8fea35413666c798a31d7bd9912232d968b
@@ -0,0 +1,182 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ SIMULATOR_APP_OUTPUT_PATH ||= :SIMULATOR_APP_OUTPUT_PATH
5
+ end
6
+
7
+ class BuildAppForIosSimulatorAction < Action
8
+ def self.run(params)
9
+ params[:platform] = verify_destination(params)
10
+ params[:xcargs] = update_xcargs(params)
11
+ params[:archive] = nil if params[:archive]
12
+ params[:configuration] = 'Debug' unless params[:configuration]
13
+ params[:derivedDataPath] = params[:derived_data_path] if params[:derived_data_path]
14
+
15
+ clean(params)
16
+
17
+ XcodebuildAction.run(params)
18
+
19
+ new_path = copy_app(params)
20
+
21
+ provide_shared_values(new_path)
22
+ new_path
23
+ end
24
+
25
+ def self.clean(params)
26
+ if params[:output_directory]
27
+ FastlaneCore::UI.important('🧹 Clearing output directory.')
28
+ FileUtils.rm_rf(params[:output_directory])
29
+ end
30
+
31
+ path = "./#{params[:scheme]}.app"
32
+ if File.directory?(path)
33
+ FastlaneCore::UI.important('🧹 Removing previous build.')
34
+ FileUtils.rm_rf(path)
35
+ end
36
+
37
+ path = "build/#{params[:scheme]}.app"
38
+ if File.directory?(path)
39
+ FastlaneCore::UI.important('🧹 Removing previous build.')
40
+ FileUtils.rm_rf(path)
41
+ end
42
+ end
43
+
44
+ def self.update_xcargs(params)
45
+ if params[:xcargs] && params[:xcargs].include?('destination')
46
+ FastlaneCore::UI.important(
47
+ '🎭 Overwriting `xcargs` option for safety reasons. Consider excluding `-destination` argument from it.'
48
+ )
49
+ params[:xcargs] = ''
50
+ end
51
+
52
+ platform = available_destinations[params[:platform]][:destination]
53
+ destination = "-destination 'generic/platform=#{platform}'"
54
+ products_path = "-IDECustomBuildProductsPath='#{products_path(params)}'"
55
+ if params[:derived_data_path]
56
+ "#{params[:xcargs]} #{products_path} #{destination}"
57
+ else
58
+ derived_data_path = "-derivedDataPath '#{products_path(params)}'"
59
+ "#{params[:xcargs]} #{products_path} #{destination} #{derived_data_path}"
60
+ end
61
+ end
62
+
63
+ def self.products_path(params)
64
+ params[:output_directory] || 'build'
65
+ end
66
+
67
+ def self.copy_app(params)
68
+ platform = available_destinations[params[:platform]][:folder]
69
+ postfix = "#{params[:configuration]}-#{platform}/#{params[:scheme]}.app"
70
+ products_path = products_path(params)
71
+
72
+ products_app_path =
73
+ if params[:project]
74
+ "#{File.dirname(File.expand_path(params[:project]))}/#{products_path}/#{postfix}"
75
+ elsif params[:workspace]
76
+ "#{File.dirname(File.expand_path(params[:workspace]))}/#{products_path}/#{postfix}"
77
+ else
78
+ "#{Dir.pwd}/#{products_path}/#{postfix}"
79
+ end
80
+
81
+ derived_data_app_path =
82
+ if params[:derived_data_path]
83
+ "#{params[:derived_data_path]}/Build/Products/#{postfix}"
84
+ else
85
+ "#{Dir.pwd}/#{products_path}/Build/Products/#{postfix}"
86
+ end
87
+
88
+ app_path = File.directory?(derived_data_app_path) ? derived_data_app_path : products_app_path
89
+
90
+ new_path =
91
+ if params[:output_directory]
92
+ FileUtils.mkdir_p(params[:output_directory])
93
+ FileUtils.cp_r(app_path, params[:output_directory])
94
+ "#{params[:output_directory]}/#{params[:scheme]}.app"
95
+ else
96
+ FileUtils.rm_rf("#{params[:scheme]}.app")
97
+ FileUtils.cp_r(app_path, './')
98
+ "./#{params[:scheme]}.app"
99
+ end
100
+
101
+ File.expand_path(new_path)
102
+ end
103
+
104
+ def self.verify_destination(params)
105
+ case params[:platform]
106
+ when 'iOS', nil
107
+ :iOS
108
+ when 'tvOS'
109
+ :tvOS
110
+ when 'watchOS'
111
+ :watchOS
112
+ else
113
+ FastlaneCore::UI.user_error!(
114
+ "🔬 Unrecognized platform: '#{params[:platform]}'. Available: 'iOS', 'tvOS' and 'watchOS'"
115
+ )
116
+ end
117
+ end
118
+
119
+ def self.available_destinations
120
+ {
121
+ iOS: { destination: 'iOS Simulator', folder: 'iphonesimulator' },
122
+ tvOS: { destination: 'tvOS Simulator', folder: 'appletvsimulator' },
123
+ watchOS: { destination: 'watchOS Simulator', folder: 'applewatchsimulator' }
124
+ }
125
+ end
126
+
127
+ def self.provide_shared_values(path)
128
+ Actions.lane_context[SharedValues::SIMULATOR_APP_OUTPUT_PATH] = File.expand_path(path)
129
+ ENV[SharedValues::SIMULATOR_APP_OUTPUT_PATH.to_s] = File.expand_path(path)
130
+ end
131
+
132
+ #####################################################
133
+ # Documentation #
134
+ #####################################################
135
+
136
+ def self.description
137
+ "This plugin builds apps exclusively for iOS, tvOS or watchOS Simulators."
138
+ end
139
+
140
+ def self.example_code
141
+ [
142
+ build_app_for_simulator(
143
+ scheme: 'sample-app',
144
+ project: 'sample-app/sample-app.xcodeproj',
145
+ configuration: 'Release',
146
+ output_directory: 'build'
147
+ )
148
+ ]
149
+ end
150
+
151
+ def self.output
152
+ [
153
+ ['SIMULATOR_APP_OUTPUT_PATH', 'The path to the newly generated app file']
154
+ ]
155
+ end
156
+
157
+ def self.available_options
158
+ XcodebuildAction.available_options + [
159
+ ['output_directory', 'The directory in which the app file should be stored in'],
160
+ ['workspace', 'Path to the workspace file'],
161
+ ['project', 'Path to the project file'],
162
+ ['scheme', "The project's scheme. Make sure it's marked as `Shared`"],
163
+ ['platform', "Use a custom simulator destination for building the app (iOS, tvOS or watchOS)"],
164
+ ['configuration', 'The configuration to use when building the app. Defaults to "Release"'],
165
+ ['derived_data_path', 'The directory where built products and other derived data will go'],
166
+ ['result_bundle_path', 'Path to the result bundle directory to create'],
167
+ ['buildlog_path', 'The directory where to store the build log'],
168
+ ['raw_buildlog', 'Set to true to see xcodebuild raw output'],
169
+ ['xcargs', "Pass additional xcodebuild options. Be sure to quote the setting names and values e.g. OTHER_LDFLAGS='-ObjC -lstdc++'"]
170
+ ]
171
+ end
172
+
173
+ def self.category
174
+ :building
175
+ end
176
+
177
+ def self.is_supported?(platform)
178
+ [:ios, :tvos, :watchos].include?(platform)
179
+ end
180
+ end
181
+ end
182
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.3.9'
3
+ VERSION = '0.3.11'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-stream_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - GetStream
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-22 00:00:00.000000000 Z
11
+ date: 2023-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xctest_list
@@ -232,6 +232,7 @@ files:
232
232
  - lib/fastlane/plugin/stream_actions/actions/allure_create_launch.rb
233
233
  - lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb
234
234
  - lib/fastlane/plugin/stream_actions/actions/allure_run_testplan.rb
235
+ - lib/fastlane/plugin/stream_actions/actions/build_app_for_ios_simulator.rb
235
236
  - lib/fastlane/plugin/stream_actions/actions/custom_match.rb
236
237
  - lib/fastlane/plugin/stream_actions/actions/is_check_required.rb
237
238
  - lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb