fastlane-plugin-sq_ci 0.5.1 → 0.6.0

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: d78148f8b4b871b6fb375d6131e4db8719cd32e4f055a8a0ae27d3ce1392e0b7
4
- data.tar.gz: 40a69c0951782de0b44c9757e210ba90a2c74442e8c60394a61555fa98fe58a3
3
+ metadata.gz: c09703d3c3000a088cb152876d59e9a66bf8b69b1fe99ae730837b4dc160c194
4
+ data.tar.gz: bd1f460aa32c575c0f771fd2b83f1dd36943a94c4e5218391201a8578159e6b6
5
5
  SHA512:
6
- metadata.gz: 370eeeb1362e7d52d095ccbf7b88abc293531fab7bd93a68cdc2f8d480ee907b6897305d566e60bf61942343266bbd7946b851f257d3e5729c4e80c122ccac70
7
- data.tar.gz: 2b33b80d066c9206d7e3ab785e80cd1f5465b7fff77868d86c9808050a97212bc49d50da1775c0924f8d89b1c1f3b439f3a5633e01e2527e5e5d76d70c9738f7
6
+ metadata.gz: 3a564363058d623511148e395fb82cf90da7202d334e0f6d53b6625a1b89aeef6a4762f0a00e7eac9a02d8b9d827b6592b7c869dda2e2ac1426d57a75aeafccd
7
+ data.tar.gz: dcf274a1fb9d4a7e3fdd8817fb512524e8f5aab98acdad5570f5c710e3f2462a26ebf8d7ab146242ffaa7122f5f6d0c976789509b4e8e58c1311ba1e871eb8cd
@@ -12,7 +12,7 @@ module Fastlane
12
12
  end
13
13
 
14
14
  build_configuration = Helper::SqCiHelper.get_xcodeproj_build_config(project_path, params[:main_target], params[:scheme])
15
- build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
15
+ Helper::SqCiHelper.resolve_recursive_build_setting(build_configuration, 'PRODUCT_BUNDLE_IDENTIFIER')
16
16
  end
17
17
 
18
18
  def self.description
@@ -12,7 +12,7 @@ module Fastlane
12
12
  end
13
13
 
14
14
  build_configuration = Helper::SqCiHelper.get_xcodeproj_build_config(project_path, params[:main_target], params[:scheme])
15
- build_configuration.build_settings['DEVELOPMENT_TEAM']
15
+ Helper::SqCiHelper.resolve_recursive_build_setting(build_configuration, 'DEVELOPMENT_TEAM')
16
16
  end
17
17
 
18
18
  def self.description
@@ -135,57 +135,59 @@ module Fastlane
135
135
 
136
136
  def self.get_xcodeproj_build_config(xcodeproj_path, main_target, target_scheme)
137
137
  project = Xcodeproj::Project.open(xcodeproj_path)
138
- xcscheme = self.xcscheme(xcodeproj_path, target_scheme)
139
- target_uuids = xcscheme.build_action.entries.first.buildable_references.map(&:target_uuid)
140
-
141
- targets = project.targets.find_all { |t| target_uuids.include?(t.uuid) }
142
- if main_target.nil?
143
- build_configuration = xcbuildconfiguration(targets.first, target_scheme)
144
- else
145
- target = targets.find { |t| t.name == main_target }
146
-
147
- UI.user_error!("Target '#{main_target}' does not exist in the given scheme") if target.nil?
148
-
149
- build_configuration = xcbuildconfiguration(target, target_scheme)
150
- end
151
-
152
- build_configuration
138
+ target = project.native_targets.find { |native_target| native_target.name == main_target }
139
+ target.build_configurations.find { |configuration| configuration.name == target_scheme }
153
140
  end
154
141
 
155
142
  def self.get_xcodeproj_targets(xcodeproj_path, target_scheme)
156
143
  project = Xcodeproj::Project.open(xcodeproj_path)
157
-
158
144
  targets = {}
159
- project.targets.each do |target|
160
- build_configuration = xcbuildconfiguration(target, target_scheme)
161
- targets[target.name] = build_configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER']
145
+ project.native_targets.each do |native_target|
146
+ build_configuration = native_target.build_configurations.find { |configuration| configuration.name == target_scheme }
147
+ targets[native_target.name] = self.resolve_recursive_build_setting(build_configuration, 'PRODUCT_BUNDLE_IDENTIFIER')
162
148
  end
163
149
 
164
150
  targets
165
151
  end
166
152
 
167
- def self.xcscheme(xcodeproj_path, target_scheme)
168
- scheme_paths = Dir.glob("#{xcodeproj_path}/xcshareddata/xcschemes/#{target_scheme}.xcscheme")
169
- if scheme_paths.empty?
170
- scheme_paths = Dir.glob("#{xcodeproj_path}/xcuserdata/xcschemes/#{target_scheme}.xcscheme")
171
- end
172
- UI.user_error!("Scheme '#{target_scheme}' does not exist in the given project") if scheme_paths.empty?
173
-
174
- scheme_path = scheme_paths.first
175
- Xcodeproj::XCScheme.new(scheme_path)
176
- end
177
-
178
- def self.xcbuildconfiguration(target, build_configuration_name)
179
- if build_configuration_name.nil?
180
- configuration = target.build_configurations.first
181
-
182
- UI.message("No configuration specified, taking first: '#{configuration.name}'")
183
- else
184
- configuration = target.build_configurations.find { |c| c.name == build_configuration_name }
185
-
186
- UI.user_error!("Build configuration '#{build_configuration_name}' does not exist in target '#{target.name}'") if configuration.nil?
153
+ def self.resolve_recursive_build_setting(config, setting)
154
+ resolution = config.resolve_build_setting(setting)
155
+
156
+ # finds values with one of
157
+ # $VALUE
158
+ # $(VALLUE)
159
+ # $(VALUE:modifier)
160
+ # ${VALUE}
161
+ # ${VALUE:modifier}
162
+ resolution.gsub(/\$[\(\{]?.+[\)\}]?/) do |raw_value|
163
+ # strip $() characters
164
+ unresolved = raw_value.gsub(/[\$\(\)\{\}]/, '')
165
+
166
+ # Get the modifiers after the ':' characters
167
+ name, *modifiers = unresolved.split(':')
168
+
169
+ # Expand variable name
170
+ subresolution = resolve_recursive_build_setting(config, name)
171
+
172
+ # Apply modifiers
173
+ # NOTE: not all cases accounted for
174
+ #
175
+ # See http://codeworkshop.net/posts/xcode-build-setting-transformations
176
+ # for various modifier options
177
+ modifiers.each do |modifier|
178
+ case modifier
179
+ when 'lower'
180
+ subresolution.downcase!
181
+ when 'upper'
182
+ subresolution.upcase!
183
+ else
184
+ # Fastlane message
185
+ UI.error("Unknown modifier: `#{modifier}` in `#{raw_value}")
186
+ end
187
+ end
188
+
189
+ subresolution
187
190
  end
188
- configuration
189
191
  end
190
192
  end
191
193
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module SqCi
3
- VERSION = "0.5.1"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-sq_ci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Semen Kologrivov