fastlane-plugin-stream_actions 0.3.9 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2351d32a44938bf481a77ea30dd2de1fe01cd308976715240c7e3b25ab938f42
4
- data.tar.gz: 4678fe7082ae8415a582aab09215e0822c3c06b99fb05d152c06ef2cd161dee9
3
+ metadata.gz: b79f6dff0348e86b6e0c99905b3dbe290315bdd6463b58e7f3d4ae16624e5be0
4
+ data.tar.gz: 4d5a2f46f4dab3244265f00225d4e27c11b40e48f40415bc5b65ec65ba3c6954
5
5
  SHA512:
6
- metadata.gz: 9083f04733cd69483415f70fe29ba103f95d300316b77777185a6e898e797e2b251138bbc4e9b14747dfdcb5b7ca824fb1c5663102e6cd1bf856e4c28ce13aa5
7
- data.tar.gz: 4c610fa642bb0480be738724dacc101abe8d14ae6e914ce7379e299849f35f5b0e4ce4e62ed5dbe458d7d8b2cd9a2d09e7faf4083db833d1f4cf6ac2cd5a50f9
6
+ metadata.gz: 102bf95950869523ad1bfd0c1a10d3860845521f2ed6fdbd3461886d695a65149cb6a0078c5715fe860af8e66ff921fe6f31c9bb29e060be9bdf49815aef1d37
7
+ data.tar.gz: 5c471b093fb45cf98ad819d4625a9cad46c4152aac9bdfa1912438df822f9130230354f34e91741c01be0a7817a323ba0b2cf44c8acf6d2a46b54d714458ae25
@@ -0,0 +1,179 @@
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
+ if params[:output_directory]
91
+ FileUtils.mkdir_p(params[:output_directory])
92
+ FileUtils.cp_r(app_path, params[:output_directory])
93
+ "#{params[:output_directory]}/#{params[:scheme]}.app"
94
+ else
95
+ FileUtils.rm_rf("#{params[:scheme]}.app")
96
+ FileUtils.cp_r(app_path, './')
97
+ "./#{params[:scheme]}.app"
98
+ end
99
+ end
100
+
101
+ def self.verify_destination(params)
102
+ case params[:platform]
103
+ when 'iOS', nil
104
+ :iOS
105
+ when 'tvOS'
106
+ :tvOS
107
+ when 'watchOS'
108
+ :watchOS
109
+ else
110
+ FastlaneCore::UI.user_error!(
111
+ "🔬 Unrecognized platform: '#{params[:platform]}'. Available: 'iOS', 'tvOS' and 'watchOS'"
112
+ )
113
+ end
114
+ end
115
+
116
+ def self.available_destinations
117
+ {
118
+ iOS: { destination: 'iOS Simulator', folder: 'iphonesimulator' },
119
+ tvOS: { destination: 'tvOS Simulator', folder: 'appletvsimulator' },
120
+ watchOS: { destination: 'watchOS Simulator', folder: 'applewatchsimulator' }
121
+ }
122
+ end
123
+
124
+ def self.provide_shared_values(path)
125
+ Actions.lane_context[SharedValues::SIMULATOR_APP_OUTPUT_PATH] = File.expand_path(path)
126
+ ENV[SharedValues::SIMULATOR_APP_OUTPUT_PATH.to_s] = File.expand_path(path)
127
+ end
128
+
129
+ #####################################################
130
+ # Documentation #
131
+ #####################################################
132
+
133
+ def self.description
134
+ "This plugin builds apps exclusively for iOS, tvOS or watchOS Simulators."
135
+ end
136
+
137
+ def self.example_code
138
+ [
139
+ build_app_for_simulator(
140
+ scheme: 'sample-app',
141
+ project: 'sample-app/sample-app.xcodeproj',
142
+ configuration: 'Release',
143
+ output_directory: 'build'
144
+ )
145
+ ]
146
+ end
147
+
148
+ def self.output
149
+ [
150
+ ['SIMULATOR_APP_OUTPUT_PATH', 'The path to the newly generated app file']
151
+ ]
152
+ end
153
+
154
+ def self.available_options
155
+ XcodebuildAction.available_options + [
156
+ ['output_directory', 'The directory in which the app file should be stored in'],
157
+ ['workspace', 'Path to the workspace file'],
158
+ ['project', 'Path to the project file'],
159
+ ['scheme', "The project's scheme. Make sure it's marked as `Shared`"],
160
+ ['platform', "Use a custom simulator destination for building the app (iOS, tvOS or watchOS)"],
161
+ ['configuration', 'The configuration to use when building the app. Defaults to "Release"'],
162
+ ['derived_data_path', 'The directory where built products and other derived data will go'],
163
+ ['result_bundle_path', 'Path to the result bundle directory to create'],
164
+ ['buildlog_path', 'The directory where to store the build log'],
165
+ ['raw_buildlog', 'Set to true to see xcodebuild raw output'],
166
+ ['xcargs', "Pass additional xcodebuild options. Be sure to quote the setting names and values e.g. OTHER_LDFLAGS='-ObjC -lstdc++'"]
167
+ ]
168
+ end
169
+
170
+ def self.category
171
+ :building
172
+ end
173
+
174
+ def self.is_supported?(platform)
175
+ [:ios, :tvos, :watchos].include?(platform)
176
+ end
177
+ end
178
+ end
179
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module StreamActions
3
- VERSION = '0.3.9'
3
+ VERSION = '0.3.10'
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.10
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-23 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