xcodeproj 1.14.0 → 1.15.0

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: 3af9cb46ce94c2bb3e0bff2b7b28e82f5a037788378fa512274f685d41c2910b
4
- data.tar.gz: 4047b7ac654f2aaeaba3363e56362249c2ce4456cea8e73eb27cd731648d4792
3
+ metadata.gz: f67749b29dedd0818af4098881cb282662875d984f7d05c7bda0af4b0c86ec82
4
+ data.tar.gz: '09e6e7cac5b75fa227f838431390860392378891e2f3fc8248fa7795e005d04a'
5
5
  SHA512:
6
- metadata.gz: c47d7f26b3c3078f7cf2094aa81fd809cf938d9741530d09c166a37b3bc0a98e9e4e59e2b51222d1c43b64f9620ff35c0c83077ca6331b49bebed117fa6891f8
7
- data.tar.gz: 65a27789a94d192a1d7c25c851d3ab36fab276f70145432c5a1ca3ecd398ca6f571206aee498d59c05dc688542ca2facd4bac7de08845a936e8cb54452c3073e
6
+ metadata.gz: e7317ac6d84cc9dc3b66d9dc73eb4ae5f9c585e60daed3255bfd209db017a34e1a44f25358e3a1ec7fe61f9c809f0ecb3c526b796b489f8e4e473ffe577e81b3
7
+ data.tar.gz: 16fe549706c8e9c7806de7a1a739ffc0ea145762a0e70a6906884c2437bf8661bd2068f43e9095d208d0ebceda8a36a8c1a7ad39966bc84782490dc4e4720e36
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
2
  # The version of the xcodeproj gem.
3
3
  #
4
- VERSION = '1.14.0'.freeze unless defined? Xcodeproj::VERSION
4
+ VERSION = '1.15.0'.freeze unless defined? Xcodeproj::VERSION
5
5
  end
@@ -6,6 +6,10 @@ module Xcodeproj
6
6
  # {PBXProject} or a {PBXNativeTarget}.
7
7
  #
8
8
  class XCBuildConfiguration < AbstractObject
9
+ MUTUAL_RECURSION_SENTINEL = 'xcodeproj.mutual_recursion_sentinel'.freeze
10
+
11
+ private_constant :MUTUAL_RECURSION_SENTINEL
12
+
9
13
  # @!group Attributes
10
14
 
11
15
  # @return [String] the name of the Target.
@@ -79,16 +83,19 @@ module Xcodeproj
79
83
  # the key of the build setting.
80
84
  #
81
85
  # @param [PBXNativeTarget] root_target
82
- # use this to resolve complete recursion between project and targets
86
+ # use this to resolve complete recursion between project and targets.
87
+ #
88
+ # @param [String] previous_key
89
+ # use this to resolve complete recursion between different build settings.
83
90
  #
84
91
  # @return [String] The value of the build setting
85
92
  #
86
- def resolve_build_setting(key, root_target = nil)
93
+ def resolve_build_setting(key, root_target = nil, previous_key = nil)
87
94
  setting = build_settings[key]
88
- setting = resolve_variable_substitution(key, setting, root_target)
95
+ setting = resolve_variable_substitution(key, setting, root_target, previous_key)
89
96
 
90
97
  config_setting = config[key]
91
- config_setting = resolve_variable_substitution(key, config_setting, root_target)
98
+ config_setting = resolve_variable_substitution(key, config_setting, root_target, previous_key)
92
99
 
93
100
  project_setting = project.build_configuration_list[name]
94
101
  project_setting = nil if equal?(project_setting)
@@ -99,6 +106,12 @@ module Xcodeproj
99
106
  'SRCROOT' => project.project_dir.to_s,
100
107
  }
101
108
 
109
+ # if previous_key is nil, it means that we're back at the first call, so we can replace our sentinel string
110
+ # used to prevent recursion with nil
111
+ if previous_key.nil? && setting == MUTUAL_RECURSION_SENTINEL
112
+ setting = nil
113
+ end
114
+
102
115
  [defaults[key], project_setting, config_setting, setting, ENV[key]].compact.reduce(nil) do |inherited, value|
103
116
  expand_build_setting(value, inherited)
104
117
  end
@@ -142,7 +155,7 @@ module Xcodeproj
142
155
  build_setting_value.flat_map { |value| Constants::INHERITED_KEYWORDS.include?(value) ? inherited : value }
143
156
  end
144
157
 
145
- def resolve_variable_substitution(key, value, root_target)
158
+ def resolve_variable_substitution(key, value, root_target, previous_key = nil)
146
159
  case value
147
160
  when Array
148
161
  return value.map { |v| resolve_variable_substitution(key, v, root_target) }
@@ -168,9 +181,20 @@ module Xcodeproj
168
181
  when key
169
182
  # to prevent infinite recursion
170
183
  nil
184
+ when previous_key
185
+ # to prevent infinite recursion; we don't return nil as for the self recursion because it needs to be
186
+ # distinguished outside this method too
187
+ MUTUAL_RECURSION_SENTINEL
171
188
  else
172
189
  configuration_to_resolve_against = root_target ? root_target.build_configuration_list[name] : self
173
- resolved_value_for_variable = configuration_to_resolve_against.resolve_build_setting(variable, root_target) || ''
190
+ resolved_value_for_variable = configuration_to_resolve_against.resolve_build_setting(variable, root_target, key) || ''
191
+
192
+ # we use this sentinel string instead of nil, because, otherwise, it would be swallowed by the default empty
193
+ # string from the preceding line, and we want to distinguish between mutual recursion and other cases
194
+ if resolved_value_for_variable == MUTUAL_RECURSION_SENTINEL
195
+ return MUTUAL_RECURSION_SENTINEL
196
+ end
197
+
174
198
  value = value.gsub(variable_reference, resolved_value_for_variable)
175
199
  resolve_variable_substitution(key, value, root_target)
176
200
  end
@@ -191,14 +215,15 @@ module Xcodeproj
191
215
 
192
216
  settings.keys.each do |key|
193
217
  next unless value = settings[key]
218
+ stripped_key = key.sub(/\[[^\]]+\]$/, '')
194
219
  case value
195
220
  when String
196
- next unless array_settings.include?(key)
221
+ next unless array_settings.include?(stripped_key)
197
222
  array_value = split_build_setting_array_to_string(value)
198
223
  next unless array_value.size > 1
199
224
  settings[key] = array_value
200
225
  when Array
201
- next if value.size > 1 && array_settings.include?(key)
226
+ next if value.size > 1 && array_settings.include?(stripped_key)
202
227
  settings[key] = value.join(' ')
203
228
  end
204
229
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-14 00:00:00.000000000 Z
11
+ date: 2020-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: atomos
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  - !ruby/object:Gem::Version
184
184
  version: '0'
185
185
  requirements: []
186
- rubygems_version: 3.0.4
186
+ rubygems_version: 3.0.3
187
187
  signing_key:
188
188
  specification_version: 3
189
189
  summary: Create and modify Xcode projects from Ruby.