cocoapods 1.3.0.beta.2 → 1.3.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,7 +47,7 @@ module Pod
47
47
  file_accessors = pod_targets.flat_map(&:file_accessors)
48
48
 
49
49
  frameworks = file_accessors.flat_map(&:vendored_frameworks).uniq.map(&:basename)
50
- frameworks += pod_targets.select { |pt| pt.should_build? && pt.requires_frameworks? }.map(&:product_module_name)
50
+ frameworks += pod_targets.select { |pt| pt.should_build? && pt.requires_frameworks? }.map(&:product_module_name).uniq
51
51
  verify_no_duplicate_names(frameworks, aggregate_target.label, 'frameworks')
52
52
 
53
53
  libraries = file_accessors.flat_map(&:vendored_libraries).uniq.map(&:basename)
@@ -177,12 +177,15 @@ module Pod
177
177
  # If yes, where needed, intermediate groups are created, similar to
178
178
  # how mkdir -p operates.
179
179
  #
180
+ # @param [Pathname] base_path
181
+ # The base path for newly created groups when reflect_file_system_structure is true.
182
+ # If nil, the provided group's real_path is used.
183
+ #
180
184
  # @return [PBXFileReference] The new file reference.
181
185
  #
182
- def add_file_reference(absolute_path, group, reflect_file_system_structure = false)
186
+ def add_file_reference(absolute_path, group, reflect_file_system_structure = false, base_path = nil)
183
187
  file_path_name = absolute_path.is_a?(Pathname) ? absolute_path : Pathname.new(absolute_path)
184
- group = group_for_path_in_group(file_path_name, group, reflect_file_system_structure)
185
-
188
+ group = group_for_path_in_group(file_path_name, group, reflect_file_system_structure, base_path)
186
189
  if ref = reference_for_path(file_path_name.realpath)
187
190
  @refs_by_absolute_path[absolute_path.to_s] = ref
188
191
  ref
@@ -305,24 +308,35 @@ module Pod
305
308
  # If yes, where needed, intermediate groups are created, similar to
306
309
  # how mkdir -p operates.
307
310
  #
311
+ # @param [Pathname] base_path
312
+ # The base path for the newly created group. If nil, the provided group's real_path is used.
313
+ #
308
314
  # @return [PBXGroup] The appropriate group for the filepath.
309
315
  # Can be PBXVariantGroup, if the file is localized.
310
316
  #
311
- def group_for_path_in_group(absolute_pathname, group, reflect_file_system_structure)
317
+ def group_for_path_in_group(absolute_pathname, group, reflect_file_system_structure, base_path = nil)
312
318
  unless absolute_pathname.absolute?
313
319
  raise ArgumentError, "Paths must be absolute #{absolute_pathname}"
314
320
  end
321
+ unless base_path.nil? || base_path.absolute?
322
+ raise ArgumentError, "Paths must be absolute #{base_path}"
323
+ end
315
324
 
316
- relative_pathname = absolute_pathname.relative_path_from(group.real_path)
325
+ relative_base = base_path.nil? ? group.real_path : base_path.realdirpath
326
+ relative_pathname = absolute_pathname.relative_path_from(relative_base)
317
327
  relative_dir = relative_pathname.dirname
318
328
  lproj_regex = /\.lproj/i
319
329
 
320
330
  # Add subgroups for directories, but treat .lproj as a file
321
331
  if reflect_file_system_structure
322
- relative_dir.each_filename do|name|
332
+ path = relative_base
333
+ relative_dir.each_filename do |name|
323
334
  break if name.to_s =~ lproj_regex
324
335
  next if name == '.'
325
- group = group[name] || group.new_group(name, name)
336
+ # Make sure groups have the correct absolute path set, as intermittent
337
+ # directories may not be included in the group structure
338
+ path += name
339
+ group = group[name] || group.new_group(name, path)
326
340
  end
327
341
  end
328
342
 
@@ -89,8 +89,8 @@ module Pod
89
89
  path = pod_dir(name)
90
90
  path.rmtree if path.exist?
91
91
  end
92
- podspe_path = specification_path(name)
93
- podspe_path.rmtree if podspe_path
92
+ podspec_path = specification_path(name)
93
+ podspec_path.rmtree if podspec_path
94
94
  end
95
95
 
96
96
  # Prepares the sandbox for a new installation removing any file that will
@@ -98,7 +98,6 @@ module Pod
98
98
  #
99
99
  def prepare
100
100
  FileUtils.rm_rf(headers_root)
101
- FileUtils.rm_rf(target_support_files_root)
102
101
 
103
102
  FileUtils.mkdir_p(headers_root)
104
103
  FileUtils.mkdir_p(sources_root)
@@ -184,7 +184,7 @@ module Pod
184
184
  pod_targets.any?(&:uses_swift?)
185
185
  end
186
186
 
187
- # @return [Hash{String => Array<Hash{Symbol => [String]}>] The vendored dynamic artifacts and framework target
187
+ # @return [Hash{String => Array<Hash{Symbol => [String]}>}] The vendored dynamic artifacts and framework target
188
188
  # input and output paths grouped by config
189
189
  #
190
190
  def framework_paths_by_config
@@ -193,51 +193,21 @@ module Pod
193
193
  relevant_pod_targets = pod_targets.select do |pod_target|
194
194
  pod_target.include_in_build_config?(target_definition, config)
195
195
  end
196
- framework_paths_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
197
- frameworks = []
198
- pod_target.file_accessors.flat_map(&:vendored_dynamic_artifacts).map do |framework_path|
199
- relative_path_to_sandbox = framework_path.relative_path_from(sandbox.root)
200
- framework = { :name => framework_path.basename.to_s,
201
- :input_path => "${PODS_ROOT}/#{relative_path_to_sandbox}",
202
- :output_path => "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{framework_path.basename}" }
203
- # Until this can be configured, assume the dSYM file uses the file name as the framework.
204
- # See https://github.com/CocoaPods/CocoaPods/issues/1698
205
- dsym_name = "#{framework_path.basename}.dSYM"
206
- dsym_path = Pathname.new("#{framework_path.dirname}/#{dsym_name}")
207
- if dsym_path.exist?
208
- framework[:dsym_name] = dsym_name
209
- framework[:dsym_input_path] = "${PODS_ROOT}/#{relative_path_to_sandbox}.dSYM"
210
- framework[:dsym_output_path] = "${DWARF_DSYM_FOLDER_PATH}/#{dsym_name}"
211
- end
212
- frameworks << framework
213
- end
214
- if pod_target.should_build? && pod_target.requires_frameworks?
215
- frameworks << { :name => pod_target.product_name,
216
- :input_path => pod_target.build_product_path('${BUILT_PRODUCTS_DIR}'),
217
- :output_path => "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{pod_target.product_name}" }
218
- end
219
- frameworks
220
- end
196
+ framework_paths_by_config[config] = relevant_pod_targets.flat_map(&:framework_paths)
221
197
  end
222
198
  framework_paths_by_config
223
199
  end
224
200
 
225
- # @return [Hash{ String => Array<String> }] Uniqued Resources grouped by config
201
+ # @return [Hash{String => Array<String>}] Uniqued Resources grouped by config
226
202
  #
227
203
  def resource_paths_by_config
228
- library_targets = pod_targets.reject do |pod_target|
204
+ relevant_pod_targets = pod_targets.reject do |pod_target|
229
205
  pod_target.should_build? && pod_target.requires_frameworks?
230
206
  end
231
207
  user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
232
- resources_by_config[config] = library_targets.flat_map do |library_target|
233
- next [] unless library_target.include_in_build_config?(target_definition, config)
234
- resource_paths = library_target.file_accessors.flat_map do |accessor|
235
- accessor.resources.flat_map { |res| "${PODS_ROOT}/#{res.relative_path_from(sandbox.project.path.dirname)}" }
236
- end
237
- resource_bundles = library_target.file_accessors.flat_map do |accessor|
238
- accessor.resource_bundles.keys.map { |name| "#{library_target.configuration_build_dir}/#{name.shellescape}.bundle" }
239
- end
240
- (resource_paths + resource_bundles + [bridge_support_file].compact).uniq
208
+ resources_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
209
+ next [] unless pod_target.include_in_build_config?(target_definition, config)
210
+ (pod_target.resource_paths + [bridge_support_file].compact).uniq
241
211
  end
242
212
  end
243
213
  end
@@ -7,7 +7,7 @@ module Pod
7
7
  #
8
8
  attr_reader :specs
9
9
 
10
- # @return [Array<PBXNativeTarget>] the target definitions of the Podfile
10
+ # @return [Array<TargetDefinition>] the target definitions of the Podfile
11
11
  # that generated this target.
12
12
  #
13
13
  attr_reader :target_definitions
@@ -56,6 +56,7 @@ module Pod
56
56
  @build_headers = Sandbox::HeadersStore.new(sandbox, 'Private')
57
57
  @file_accessors = []
58
58
  @resource_bundle_targets = []
59
+ @test_resource_bundle_targets = []
59
60
  @test_native_targets = []
60
61
  @dependent_targets = []
61
62
  @test_dependent_targets = []
@@ -149,6 +150,10 @@ module Pod
149
150
  # to this target.
150
151
  attr_reader :resource_bundle_targets
151
152
 
153
+ # @return [Array<PBXNativeTarget>] the resource bundle test targets belonging
154
+ # to this target.
155
+ attr_reader :test_resource_bundle_targets
156
+
152
157
  # @return [Bool] Whether or not this target should be build.
153
158
  #
154
159
  # A target should not be build if it has no source files.
@@ -192,6 +197,53 @@ module Pod
192
197
  specs.select(&:test_specification?).map(&:test_type).uniq
193
198
  end
194
199
 
200
+ # @return [Array<Hash{Symbol => [String]}>] The vendored and non vendored framework paths
201
+ # this target depends upon.
202
+ #
203
+ def framework_paths
204
+ @framework_paths ||= begin
205
+ frameworks = []
206
+ file_accessors.flat_map(&:vendored_dynamic_artifacts).map do |framework_path|
207
+ relative_path_to_sandbox = framework_path.relative_path_from(sandbox.root)
208
+ framework = { :name => framework_path.basename.to_s,
209
+ :input_path => "${PODS_ROOT}/#{relative_path_to_sandbox}",
210
+ :output_path => "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{framework_path.basename}" }
211
+ # Until this can be configured, assume the dSYM file uses the file name as the framework.
212
+ # See https://github.com/CocoaPods/CocoaPods/issues/1698
213
+ dsym_name = "#{framework_path.basename}.dSYM"
214
+ dsym_path = Pathname.new("#{framework_path.dirname}/#{dsym_name}")
215
+ if dsym_path.exist?
216
+ framework[:dsym_name] = dsym_name
217
+ framework[:dsym_input_path] = "${PODS_ROOT}/#{relative_path_to_sandbox}.dSYM"
218
+ framework[:dsym_output_path] = "${DWARF_DSYM_FOLDER_PATH}/#{dsym_name}"
219
+ end
220
+ frameworks << framework
221
+ end
222
+ if should_build? && requires_frameworks?
223
+ frameworks << { :name => product_name,
224
+ :input_path => build_product_path('${BUILT_PRODUCTS_DIR}'),
225
+ :output_path => "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{product_name}" }
226
+ end
227
+ frameworks
228
+ end
229
+ end
230
+
231
+ # @return [Array<String>] The resource and resource bundle paths this target depends upon.
232
+ #
233
+ def resource_paths
234
+ @resource_paths ||= begin
235
+ resource_paths = file_accessors.flat_map do |accessor|
236
+ accessor.resources.flat_map { |res| "${PODS_ROOT}/#{res.relative_path_from(sandbox.project.path.dirname)}" }
237
+ end
238
+ resource_bundles = file_accessors.flat_map do |accessor|
239
+ prefix = Generator::XCConfig::XCConfigHelper::CONFIGURATION_BUILD_DIR_VARIABLE
240
+ prefix = configuration_build_dir unless accessor.spec.test_specification?
241
+ accessor.resource_bundles.keys.map { |name| "#{prefix}/#{name.shellescape}.bundle" }
242
+ end
243
+ resource_paths + resource_bundles
244
+ end
245
+ end
246
+
195
247
  # Returns the corresponding native target to use based on the provided specification.
196
248
  # This is used to figure out whether to add a source file into the library native target or any of the
197
249
  # test native targets.
@@ -226,6 +278,22 @@ module Pod
226
278
  end
227
279
  end
228
280
 
281
+ # Returns the corresponding test type given the product type.
282
+ #
283
+ # @param [Symbol] product_type
284
+ # The product type to map to a test type.
285
+ #
286
+ # @return [Symbol] The native product type to use.
287
+ #
288
+ def test_type_for_product_type(product_type)
289
+ case product_type
290
+ when :unit_test_bundle
291
+ :unit
292
+ else
293
+ raise Informative, "Unknown product type `#{product_type}`."
294
+ end
295
+ end
296
+
229
297
  # @return [Specification] The root specification for the target.
230
298
  #
231
299
  def root_spec
@@ -256,6 +324,24 @@ module Pod
256
324
  "#{label}-#{test_type.capitalize}-Tests"
257
325
  end
258
326
 
327
+ # @param [Symbol] test_type
328
+ # The test type this embed frameworks script path is for.
329
+ #
330
+ # @return [Pathname] The absolute path of the copy resources script for the given test type.
331
+ #
332
+ def copy_resources_script_path_for_test_type(test_type)
333
+ support_files_dir + "#{test_target_label(test_type)}-resources.sh"
334
+ end
335
+
336
+ # @param [Symbol] test_type
337
+ # The test type this embed frameworks script path is for.
338
+ #
339
+ # @return [Pathname] The absolute path of the embed frameworks script for the given test type.
340
+ #
341
+ def embed_frameworks_script_path_for_test_type(test_type)
342
+ support_files_dir + "#{test_target_label(test_type)}-frameworks.sh"
343
+ end
344
+
259
345
  # @return [Array<String>] The names of the Pods on which this target
260
346
  # depends.
261
347
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.beta.2
4
+ version: 1.3.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-06-22 00:00:00.000000000 Z
14
+ date: 2017-07-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cocoapods-core
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 1.3.0.beta.2
22
+ version: 1.3.0.beta.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.3.0.beta.2
29
+ version: 1.3.0.beta.3
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: claide
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -207,7 +207,7 @@ dependencies:
207
207
  requirements:
208
208
  - - ">="
209
209
  - !ruby/object:Gem::Version
210
- version: 1.5.0
210
+ version: 1.5.1
211
211
  - - "<"
212
212
  - !ruby/object:Gem::Version
213
213
  version: '2.0'
@@ -217,7 +217,7 @@ dependencies:
217
217
  requirements:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
- version: 1.5.0
220
+ version: 1.5.1
221
221
  - - "<"
222
222
  - !ruby/object:Gem::Version
223
223
  version: '2.0'
@@ -471,6 +471,7 @@ files:
471
471
  - lib/cocoapods/installer/pod_source_installer.rb
472
472
  - lib/cocoapods/installer/pod_source_preparer.rb
473
473
  - lib/cocoapods/installer/podfile_validator.rb
474
+ - lib/cocoapods/installer/pods_project_integrator/pod_target_integrator.rb
474
475
  - lib/cocoapods/installer/post_install_hooks_context.rb
475
476
  - lib/cocoapods/installer/pre_install_hooks_context.rb
476
477
  - lib/cocoapods/installer/source_provider_hooks_context.rb