cocoapods 1.3.1 → 1.4.0.beta.1

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
  SHA1:
3
- metadata.gz: e83803ec983d5bc4a42518425b64034d96de344f
4
- data.tar.gz: 6c78bcd1978c3021744292dd48cb58f0c51ec732
3
+ metadata.gz: ccd89248d652b96a2bc808fb3ee21df39d3478f0
4
+ data.tar.gz: 54a96361eb879bb08e1a094032450fa33b84af37
5
5
  SHA512:
6
- metadata.gz: e3eaf621edc09debfe41b0288617eac7f2d92ca81d38e1114b5bb76f66614a9f0f9f4388b9b8aa89425ae40f25f62639b3a492212ba882135144625dbd82efde
7
- data.tar.gz: 79c8a4eb18d87eb1b300563366d72e96d7510785e55d9f857b79863637b31e8a82dc6c161250bdaa2f38caf1410322f74864e3efa9a5c68014dd04b9f314f66c
6
+ metadata.gz: 51657c926930d550992f2463cc1c26b679b8fefb6daaa86e7c83988eb6967ab43792b7c10fe39f58068e205639b6e628d12541094953aee91e9e0adf1290ffd9
7
+ data.tar.gz: e52fe2eb2101c6bdbadd571a77bc6b845b1992b923c5c9ed2a5380990ad94994c4f95d039eda866a3df15ef2045ca49e13e723cbdf47d91534e6994a56beedf6
@@ -4,6 +4,101 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
4
4
 
5
5
  To install release candidates run `[sudo] gem install cocoapods --pre`
6
6
 
7
+ ## 1.4.0.beta.1 (2017-09-24)
8
+
9
+ ##### Enhancements
10
+
11
+ * Do not force include the master spec repo if plugins provide sources
12
+ [Eric Amorde](https://github.com/amorde)
13
+ [#7033](https://github.com/CocoaPods/CocoaPods/pull/7033)
14
+
15
+ * Add custom shell script integration from Podfile
16
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
17
+ [#6820](https://github.com/CocoaPods/CocoaPods/pull/6820)
18
+
19
+ * Show full requirement trees when a version conflict is encountered during
20
+ dependency resolution.
21
+ [Samuel Giddins](https://github.com/segiddins)
22
+
23
+ * Add support for source static library frameworks
24
+ [Paul Beusterien](https://github.com/paulb777)
25
+ [#6811](https://github.com/CocoaPods/CocoaPods/pull/6811)
26
+
27
+ * Add Private Header support to static frameworks
28
+ [Paul Beusterien](https://github.com/paulb777)
29
+ [#6969](https://github.com/CocoaPods/CocoaPods/pull/6969)
30
+
31
+ * For source static frameworks, include frameworks from dependent targets and libraries in OTHER_LDFLAGS
32
+ [paulb777](https://github.com/paulb777)
33
+ [#6988](https://github.com/CocoaPods/CocoaPods/pull/6988)
34
+
35
+ ##### Bug Fixes
36
+
37
+ * Deduplicate test specs correctly from pod variants and targets
38
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
39
+ [#7036](https://github.com/CocoaPods/CocoaPods/pull/7036)
40
+
41
+ * Do not merge `pod_target_xcconfig` from test specs into non test xcconfigs
42
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
43
+ [#7037](https://github.com/CocoaPods/CocoaPods/pull/7037)
44
+
45
+ * Wrap `$PODS_CONFIGURATION_BUILD_DIR` and `$PODS_BUILD_DIR` with curlies
46
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
47
+ [#7048](https://github.com/CocoaPods/CocoaPods/pull/7048)
48
+
49
+ * Fix common paths sometimes calculating incorrectly
50
+ [amorde](https://github.com/amorde)
51
+ [#7028](https://github.com/CocoaPods/CocoaPods/pull/7028)
52
+
53
+ * Do not code sign OSX targets for testing bundles
54
+ [Justin Martin](https://github.com/justinseanmartin)
55
+ [#7027](https://github.com/CocoaPods/CocoaPods/pull/7027)
56
+
57
+ * Ensure a unique ID is generated for each resource bundle
58
+ [Justin Martin](https://github.com/justinseanmartin)
59
+ [#7015](https://github.com/CocoaPods/CocoaPods/pull/7015)
60
+
61
+ * Do not include settings from file accessors of test specs into aggregate xcconfigs
62
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
63
+ [#7019](https://github.com/CocoaPods/CocoaPods/pull/7019)
64
+
65
+ * Use the resolver to identify which pod targets are test only
66
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
67
+ [Justin Martin](https://github.com/justinseanmartin)
68
+ [#7014](https://github.com/CocoaPods/CocoaPods/pull/7014)
69
+
70
+ * Perform code signing on xctest bundles in the Pods project generated by a test spec
71
+ [Justin Martin](https://github.com/justinseanmartin)
72
+ [#7013](https://github.com/CocoaPods/CocoaPods/pull/7013)
73
+
74
+ * Exclude test resource and framework paths from aggregate targets
75
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
76
+ [#7000](https://github.com/CocoaPods/CocoaPods/pull/7000)
77
+
78
+ * Wrap platform warning message with quotes
79
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
80
+ [#6968](https://github.com/CocoaPods/CocoaPods/pull/6968)
81
+
82
+ * Wire dependencies for pod targets not part of any aggregate target
83
+ [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
84
+ [#6948](https://github.com/CocoaPods/CocoaPods/pull/6948)
85
+
86
+ * Fix validation warnings when using --swift-version
87
+ [Danielle Tomlinson](https://github.com/dantoml)
88
+ [#6971](https://github.com/CocoaPods/CocoaPods/issue/6971)
89
+
90
+ * Fix xcconfig boolean merging when substrings include yes or no
91
+ [Paul Beusterien](https://github.com/paulb777)
92
+ [#6997](https://github.com/CocoaPods/CocoaPods/pull/6997)
93
+
94
+ * Filter out subset dependent targets from FRAMEWORK_SEARCH_PATHS
95
+ [Paul Beusterien](https://github.com/paulb777)
96
+ [#7002](https://github.com/CocoaPods/CocoaPods/pull/7002)
97
+
98
+ * Propagate HEADER_SEARCH_PATHS settings from search paths
99
+ [Paul Beusterien](https://github.com/paulb777)
100
+ [#7006](https://github.com/CocoaPods/CocoaPods/pull/7006)
101
+
7
102
  ## 1.3.1 (2017-08-02)
8
103
 
9
104
  ##### Enhancements
@@ -98,7 +193,6 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
98
193
  ## 1.3.0.beta.2 (2017-06-22)
99
194
 
100
195
  ##### Enhancements
101
-
102
196
  * Add inputs and outputs for resources script phase
103
197
  [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
104
198
  [#6806](https://github.com/CocoaPods/CocoaPods/pull/6806)
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  This project is licensed under the MIT license.
2
2
 
3
- Copyright (c) 2011 - 2015 Eloy Durán <eloy.de.enige@gmail.com>,
3
+ Copyright (c) 2011 - 2017 Eloy Durán <eloy.de.enige@gmail.com>,
4
4
  Fabio Pelosin <fabiopelosin@gmail.com>,
5
5
  Samuel Giddins <segiddins@segiddins.me>,
6
6
  Marius Rackwitz <git@mariusrackwitz.de>,
data/README.md CHANGED
@@ -71,7 +71,7 @@ CocoaPods is composed of the following projects:
71
71
  | Status | Project | Description | Info |
72
72
  | :----- | :------ | :--- | :--- |
73
73
  | [![Build Status](http://img.shields.io/travis/CocoaPods/CocoaPods/master.svg?style=flat)](http://travis-ci.org/CocoaPods/CocoaPods) | [CocoaPods](https://github.com/CocoaPods/CocoaPods) | The CocoaPods command line tool. | [guides](https://guides.cocoapods.org)
74
- | [![Build Status](http://img.shields.io/travis/CocoaPods/Core/master.svg?style=flat)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](http://docs.cocoapods.org/cocoapods_core)
74
+ | [![Build Status](http://img.shields.io/travis/CocoaPods/Core/master.svg?style=flat)](http://travis-ci.org/CocoaPods/Core) | [CocoaPods Core](https://github.com/CocoaPods/Core) | Support for working with specifications and podfiles. | [docs](https://guides.cocoapods.org/contributing/components.html)
75
75
  | [![Build Status](http://img.shields.io/travis/CocoaPods/cocoapods-downloader/master.svg?style=flat)](http://travis-ci.org/CocoaPods/cocoapods-downloader) |[CocoaPods Downloader](https://github.com/CocoaPods/cocoapods-downloader) | Downloaders for various source types. | [docs](http://docs.cocoapods.org/cocoapods_downloader/index.html)
76
76
  | [![Build Status](http://img.shields.io/travis/CocoaPods/Xcodeproj/master.svg?style=flat)](https://travis-ci.org/CocoaPods/Xcodeproj) | [Xcodeproj](https://github.com/CocoaPods/Xcodeproj) | Create and modify Xcode projects from Ruby. | [docs](http://docs.cocoapods.org/xcodeproj/index.html)
77
77
  | [![Build Status](http://img.shields.io/travis/CocoaPods/CLAide/master.svg?style=flat)](https://travis-ci.org/CocoaPods/CLAide) | [CLAide](https://github.com/CocoaPods/CLAide) | A small command-line interface framework. | [docs](http://docs.cocoapods.org/claide/index.html)
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the CocoaPods command line tool.
3
3
  #
4
- VERSION = '1.3.1'.freeze unless defined? Pod::VERSION
4
+ VERSION = '1.4.0.beta.1'.freeze unless defined? Pod::VERSION
5
5
  end
@@ -170,12 +170,15 @@ module Pod
170
170
  # - `@import …;` / `import …`
171
171
  #
172
172
  def generate_settings_to_import_pod_targets
173
- @xcconfig.merge! XCConfigHelper.settings_for_dependent_targets(target, pod_targets)
173
+ @xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, pod_targets)
174
174
  @xcconfig.merge!(settings_to_import_pod_targets)
175
175
  target.search_paths_aggregate_targets.each do |search_paths_target|
176
176
  generator = AggregateXCConfig.new(search_paths_target, configuration_name)
177
- @xcconfig.merge! XCConfigHelper.settings_for_dependent_targets(nil, search_paths_target.pod_targets)
177
+ @xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(nil, search_paths_target.pod_targets)
178
178
  @xcconfig.merge!(generator.settings_to_import_pod_targets)
179
+
180
+ # Propagate any HEADER_SEARCH_PATHS settings from the search paths.
181
+ XCConfigHelper.propagate_header_search_paths_from_search_paths(search_paths_target, @xcconfig)
179
182
  end
180
183
  end
181
184
 
@@ -218,7 +221,7 @@ module Pod
218
221
  settings = user_target_xcconfig_values_by_consumer_by_key
219
222
  settings.each_with_object({}) do |(key, values_by_consumer), xcconfig|
220
223
  uniq_values = values_by_consumer.values.uniq
221
- values_are_bools = uniq_values.all? { |v| v =~ /(yes|no)/i }
224
+ values_are_bools = uniq_values.all? { |v| v =~ /^(yes|no)$/i }
222
225
  if values_are_bools
223
226
  # Boolean build settings
224
227
  if uniq_values.count > 1
@@ -66,14 +66,14 @@ module Pod
66
66
 
67
67
  XCConfigHelper.add_settings_for_file_accessors_of_target(nil, target, @xcconfig)
68
68
  target.file_accessors.each do |file_accessor|
69
- @xcconfig.merge!(file_accessor.spec_consumer.pod_target_xcconfig)
69
+ @xcconfig.merge!(file_accessor.spec_consumer.pod_target_xcconfig) if @test_xcconfig == file_accessor.spec.test_specification?
70
70
  end
71
71
  XCConfigHelper.add_target_specific_settings(target, @xcconfig)
72
72
  recursive_dependent_targets = target.recursive_dependent_targets
73
- @xcconfig.merge! XCConfigHelper.settings_for_dependent_targets(target, recursive_dependent_targets, @test_xcconfig)
73
+ @xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, recursive_dependent_targets, @test_xcconfig)
74
74
  if @test_xcconfig
75
75
  test_dependent_targets = [target, *target.recursive_test_dependent_targets].uniq
76
- @xcconfig.merge! XCConfigHelper.settings_for_dependent_targets(target, test_dependent_targets - recursive_dependent_targets, @test_xcconfig)
76
+ @xcconfig.merge! XCConfigHelper.search_paths_for_dependent_targets(target, test_dependent_targets - recursive_dependent_targets, @test_xcconfig)
77
77
  XCConfigHelper.generate_vendored_build_settings(nil, target.all_test_dependent_targets, @xcconfig)
78
78
  XCConfigHelper.generate_other_ld_flags(nil, target.all_test_dependent_targets, @xcconfig)
79
79
  XCConfigHelper.generate_ld_runpath_search_paths(target, false, true, @xcconfig)
@@ -11,7 +11,7 @@ module Pod
11
11
  # this variable to point to the standard directory, which
12
12
  # will be used by CocoaPods.
13
13
  #
14
- BUILD_DIR_VARIABLE = '$PODS_BUILD_DIR'.freeze
14
+ BUILD_DIR_VARIABLE = '${PODS_BUILD_DIR}'.freeze
15
15
 
16
16
  # @return [String] Used as alias for CONFIGURATION_BUILD_DIR, so that
17
17
  # when this is overridden per {PodTarget}, it is still possible
@@ -20,7 +20,7 @@ module Pod
20
20
  # the user can override this variable to point to the standard
21
21
  # directory, which will be used by CocoaPods.
22
22
  #
23
- CONFIGURATION_BUILD_DIR_VARIABLE = '$PODS_CONFIGURATION_BUILD_DIR'.freeze
23
+ CONFIGURATION_BUILD_DIR_VARIABLE = '${PODS_CONFIGURATION_BUILD_DIR}'.freeze
24
24
 
25
25
  # Converts an array of strings to a single string where the each string
26
26
  # is surrounded by double quotes and separated by a space. Used to
@@ -76,13 +76,15 @@ module Pod
76
76
  #
77
77
  def self.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig)
78
78
  pod_target.file_accessors.each do |file_accessor|
79
- XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, xcconfig)
80
- XCConfigHelper.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, file_accessor)
79
+ if aggregate_target.nil? || !file_accessor.spec.test_specification?
80
+ XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, xcconfig)
81
+ XCConfigHelper.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, file_accessor)
82
+ end
81
83
  end
82
- XCConfigHelper.add_dynamic_dependency_build_settings(pod_target, xcconfig)
84
+ XCConfigHelper.add_dynamic_dependency_build_settings(aggregate_target, pod_target, xcconfig)
83
85
  if pod_target.requires_frameworks?
84
86
  pod_target.dependent_targets.each do |dependent_target|
85
- XCConfigHelper.add_dynamic_dependency_build_settings(dependent_target, xcconfig)
87
+ XCConfigHelper.add_dynamic_dependency_build_settings(aggregate_target, dependent_target, xcconfig)
86
88
  end
87
89
  end
88
90
  end
@@ -104,13 +106,15 @@ module Pod
104
106
  # @return [void]
105
107
  #
106
108
  def self.add_static_dependency_build_settings(aggregate_target, pod_target, xcconfig, file_accessor)
107
- file_accessor.vendored_static_frameworks.each do |vendored_static_framework|
108
- adds_other_ldflags = XCConfigHelper.links_dependency?(aggregate_target, pod_target)
109
- XCConfigHelper.add_framework_build_settings(vendored_static_framework, xcconfig, pod_target.sandbox.root, adds_other_ldflags)
110
- end
111
- file_accessor.vendored_static_libraries.each do |vendored_static_library|
112
- adds_other_ldflags = XCConfigHelper.links_dependency?(aggregate_target, pod_target)
113
- XCConfigHelper.add_library_build_settings(vendored_static_library, xcconfig, pod_target.sandbox.root, adds_other_ldflags)
109
+ if aggregate_target.nil? || !file_accessor.spec.test_specification?
110
+ file_accessor.vendored_static_frameworks.each do |vendored_static_framework|
111
+ adds_other_ldflags = XCConfigHelper.links_dependency?(aggregate_target, pod_target)
112
+ XCConfigHelper.add_framework_build_settings(vendored_static_framework, xcconfig, pod_target.sandbox.root, adds_other_ldflags)
113
+ end
114
+ file_accessor.vendored_static_libraries.each do |vendored_static_library|
115
+ adds_other_ldflags = XCConfigHelper.links_dependency?(aggregate_target, pod_target)
116
+ XCConfigHelper.add_library_build_settings(vendored_static_library, xcconfig, pod_target.sandbox.root, adds_other_ldflags)
117
+ end
114
118
  end
115
119
  end
116
120
 
@@ -132,6 +136,9 @@ module Pod
132
136
 
133
137
  # Adds build settings for dynamic vendored frameworks and libraries.
134
138
  #
139
+ # @param [AggregateTarget] aggregate_target
140
+ # The aggregate target, may be nil.
141
+ #
135
142
  # @param [PodTarget] pod_target
136
143
  # The pod target, which holds the list of +Spec::FileAccessor+.
137
144
  #
@@ -140,13 +147,15 @@ module Pod
140
147
  #
141
148
  # @return [void]
142
149
  #
143
- def self.add_dynamic_dependency_build_settings(pod_target, xcconfig)
150
+ def self.add_dynamic_dependency_build_settings(aggregate_target, pod_target, xcconfig)
144
151
  pod_target.file_accessors.each do |file_accessor|
145
- file_accessor.vendored_dynamic_frameworks.each do |vendored_dynamic_framework|
146
- XCConfigHelper.add_framework_build_settings(vendored_dynamic_framework, xcconfig, pod_target.sandbox.root)
147
- end
148
- file_accessor.vendored_dynamic_libraries.each do |vendored_dynamic_library|
149
- XCConfigHelper.add_library_build_settings(vendored_dynamic_library, xcconfig, pod_target.sandbox.root)
152
+ if aggregate_target.nil? || !file_accessor.spec.test_specification?
153
+ file_accessor.vendored_dynamic_frameworks.each do |vendored_dynamic_framework|
154
+ XCConfigHelper.add_framework_build_settings(vendored_dynamic_framework, xcconfig, pod_target.sandbox.root)
155
+ end
156
+ file_accessor.vendored_dynamic_libraries.each do |vendored_dynamic_library|
157
+ XCConfigHelper.add_library_build_settings(vendored_dynamic_library, xcconfig, pod_target.sandbox.root)
158
+ end
150
159
  end
151
160
  end
152
161
  end
@@ -270,14 +279,25 @@ module Pod
270
279
  #
271
280
  # @return [Hash<String, String>] the settings
272
281
  #
273
- def self.settings_for_dependent_targets(target, dependent_targets, test_xcconfig = false)
282
+ def self.search_paths_for_dependent_targets(target, dependent_targets, test_xcconfig = false)
274
283
  dependent_targets = dependent_targets.select(&:should_build?)
275
284
 
285
+ # Filter out dependent targets that are subsets of another target.
286
+ subset_targets = []
287
+ dependent_targets.combination(2) do |a, b|
288
+ if (a.specs - b.specs).empty?
289
+ subset_targets << a
290
+ elsif (b.specs - a.specs).empty?
291
+ subset_targets << b
292
+ end
293
+ end
294
+ dependent_targets -= subset_targets
295
+
276
296
  # Alias build dirs to avoid recursive definitions for pod targets and depending
277
297
  # on build settings which could be overwritten in the user target.
278
298
  build_settings = {
279
- BUILD_DIR_VARIABLE[1..-1] => '$BUILD_DIR',
280
- CONFIGURATION_BUILD_DIR_VARIABLE[1..-1] => "#{BUILD_DIR_VARIABLE}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
299
+ BUILD_DIR_VARIABLE[2..-2] => '${BUILD_DIR}',
300
+ CONFIGURATION_BUILD_DIR_VARIABLE[2..-2] => "#{BUILD_DIR_VARIABLE}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
281
301
  }
282
302
 
283
303
  # Scope pod targets as long as they are not test targets.
@@ -301,6 +321,32 @@ module Pod
301
321
  build_settings
302
322
  end
303
323
 
324
+ # Updates xcconfig with the HEADER_SEARCH_PATHS from the search_paths.
325
+ #
326
+ # @param [Target] search_paths_target
327
+ # The target.
328
+ #
329
+ # @param [Xcodeproj::Config] xcconfig
330
+ # The xcconfig to edit.
331
+ #
332
+ def self.propagate_header_search_paths_from_search_paths(search_paths_target, xcconfig)
333
+ header_search_paths_list = []
334
+ search_paths_target.pod_targets.each do |target|
335
+ target.spec_consumers.each do |spec_consumer|
336
+ paths = spec_consumer.user_target_xcconfig['HEADER_SEARCH_PATHS']
337
+ header_search_paths_list <<= paths unless paths.nil?
338
+ end
339
+ unless header_search_paths_list == []
340
+ header_search_paths = header_search_paths_list.join(' ')
341
+ unless header_search_paths.include? '$(inherited)'
342
+ header_search_paths = '$(inherited) ' + header_search_paths
343
+ end
344
+ build_settings = { 'HEADER_SEARCH_PATHS' => header_search_paths }
345
+ xcconfig.merge!(build_settings)
346
+ end
347
+ end
348
+ end
349
+
304
350
  # Add custom build settings and required build settings to link to
305
351
  # vendored libraries and frameworks.
306
352
  #
@@ -321,7 +367,7 @@ module Pod
321
367
  #
322
368
  def self.generate_vendored_build_settings(aggregate_target, pod_targets, xcconfig)
323
369
  pod_targets.each do |pod_target|
324
- unless pod_target.should_build? && pod_target.requires_frameworks?
370
+ unless pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework?
325
371
  XCConfigHelper.add_settings_for_file_accessors_of_target(aggregate_target, pod_target, xcconfig)
326
372
  end
327
373
  end
@@ -385,6 +431,16 @@ module Pod
385
431
  # @return [void]
386
432
  #
387
433
  def self.generate_other_ld_flags(aggregate_target, pod_targets, xcconfig)
434
+ # Make sure -framework option gets added for the search paths when static_frameworks are involved.
435
+ # Otherwise test targets won't link in their primary target's dependencies.
436
+ unless aggregate_target.nil?
437
+ dependent_targets = aggregate_target.search_paths_aggregate_targets
438
+ dependent_targets.each do |dependent_target|
439
+ if dependent_target.pod_targets.any?(&:static_framework?)
440
+ generate_other_ld_flags(dependent_target, dependent_target.pod_targets, xcconfig)
441
+ end
442
+ end
443
+ end
388
444
  other_ld_flags = pod_targets.select(&:should_build?).map do |pod_target|
389
445
  if pod_target.requires_frameworks?
390
446
  %(-framework "#{pod_target.product_basename}")
@@ -140,11 +140,11 @@ module Pod
140
140
  end
141
141
  end
142
142
 
143
+ # @return [Analyzer] The analyzer used to resolve dependencies
144
+ #
143
145
  def resolve_dependencies
144
- analyzer = create_analyzer
145
-
146
146
  plugin_sources = run_source_provider_hooks
147
- analyzer.sources.insert(0, *plugin_sources)
147
+ analyzer = create_analyzer(plugin_sources)
148
148
 
149
149
  UI.section 'Updating local specs repositories' do
150
150
  analyzer.update_repositories
@@ -155,6 +155,7 @@ module Pod
155
155
  validate_build_configurations
156
156
  clean_sandbox
157
157
  end
158
+ analyzer
158
159
  end
159
160
 
160
161
  def download_dependencies
@@ -243,8 +244,8 @@ module Pod
243
244
  @aggregate_targets = analyzer.result.targets
244
245
  end
245
246
 
246
- def create_analyzer
247
- Analyzer.new(sandbox, podfile, lockfile).tap do |analyzer|
247
+ def create_analyzer(plugin_sources = nil)
248
+ Analyzer.new(sandbox, podfile, lockfile, plugin_sources).tap do |analyzer|
248
249
  analyzer.installation_options = installation_options
249
250
  analyzer.has_dependencies = has_dependencies?
250
251
  end
@@ -32,16 +32,22 @@ module Pod
32
32
  #
33
33
  attr_reader :lockfile
34
34
 
35
+ # @return [Array<Source>] Sources provided by plugins
36
+ #
37
+ attr_reader :plugin_sources
38
+
35
39
  # Initialize a new instance
36
40
  #
37
- # @param [Sandbox] sandbox @see sandbox
38
- # @param [Podfile] podfile @see podfile
39
- # @param [Lockfile] lockfile @see lockfile
41
+ # @param [Sandbox] sandbox @see sandbox
42
+ # @param [Podfile] podfile @see podfile
43
+ # @param [Lockfile] lockfile @see lockfile
44
+ # @param [Array<Source>] plugin_sources @see plugin_sources
40
45
  #
41
- def initialize(sandbox, podfile, lockfile = nil)
46
+ def initialize(sandbox, podfile, lockfile = nil, plugin_sources = nil)
42
47
  @sandbox = sandbox
43
48
  @podfile = podfile
44
49
  @lockfile = lockfile
50
+ @plugin_sources = plugin_sources
45
51
 
46
52
  @update = false
47
53
  @allow_pre_downloads = true
@@ -75,11 +81,15 @@ module Pod
75
81
  store_existing_checkout_options
76
82
  fetch_external_sources if allow_fetches
77
83
 
78
- @locked_dependencies = generate_version_locking_dependencies
79
- @result.specs_by_target = validate_platforms(resolve_dependencies)
80
- @result.specifications = generate_specifications
81
- @result.targets = generate_targets
84
+ @locked_dependencies = generate_version_locking_dependencies
85
+ resolver_specs_by_target = resolve_dependencies
86
+ validate_platforms(resolver_specs_by_target)
87
+ @result.specifications = generate_specifications(resolver_specs_by_target)
88
+ @result.targets = generate_targets(resolver_specs_by_target)
82
89
  @result.sandbox_state = generate_sandbox_state
90
+ @result.specs_by_target = resolver_specs_by_target.each_with_object({}) do |rspecs_by_target, hash|
91
+ hash[rspecs_by_target[0]] = rspecs_by_target[1].map(&:spec)
92
+ end
83
93
  @result
84
94
  end
85
95
 
@@ -365,13 +375,17 @@ module Pod
365
375
 
366
376
  # Creates the models that represent the targets generated by CocoaPods.
367
377
  #
368
- # @return [Array<AggregateTarget>]
378
+ # @param [Hash{Podfile::TargetDefinition => Array<ResolvedSpecification>}] resolver_specs_by_target
379
+ # mapping of targets to resolved specs (containing information about test usage)
380
+ # aggregate targets
369
381
  #
370
- def generate_targets
371
- specs_by_target = result.specs_by_target.reject { |td, _| td.abstract? }
372
- pod_targets = generate_pod_targets(specs_by_target)
373
- aggregate_targets = specs_by_target.keys.map do |target_definition|
374
- generate_target(target_definition, pod_targets)
382
+ # @return [Array<AggregateTarget>] the list of aggregate targets generated.
383
+ #
384
+ def generate_targets(resolver_specs_by_target)
385
+ resolver_specs_by_target = resolver_specs_by_target.reject { |td, _| td.abstract? }
386
+ pod_targets = generate_pod_targets(resolver_specs_by_target)
387
+ aggregate_targets = resolver_specs_by_target.keys.map do |target_definition|
388
+ generate_target(target_definition, pod_targets, resolver_specs_by_target)
375
389
  end
376
390
  if installation_options.integrate_targets?
377
391
  # Copy embedded target pods that cannot have their pods embedded as frameworks to
@@ -406,9 +420,12 @@ module Pod
406
420
  # @param [Array<PodTarget>] pod_targets
407
421
  # the pod targets, which were generated.
408
422
  #
423
+ # @param [Hash{Podfile::TargetDefinition => Array<ResolvedSpecification>}] resolver_specs_by_target
424
+ # the resolved specifications grouped by target.
425
+ #
409
426
  # @return [AggregateTarget]
410
427
  #
411
- def generate_target(target_definition, pod_targets)
428
+ def generate_target(target_definition, pod_targets, resolver_specs_by_target)
412
429
  target = AggregateTarget.new(target_definition, sandbox)
413
430
  target.host_requires_frameworks |= target_definition.uses_frameworks?
414
431
 
@@ -429,7 +446,7 @@ module Pod
429
446
  end
430
447
  end
431
448
 
432
- target.pod_targets = filter_pod_targets_for_target_definition(pod_targets, target_definition)
449
+ target.pod_targets = filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target)
433
450
 
434
451
  target
435
452
  end
@@ -437,97 +454,79 @@ module Pod
437
454
  # Returns a filtered list of pod targets that should or should not be part of the target definition. Pod targets
438
455
  # used by tests only are filtered.
439
456
  #
440
- # @param [Array<PodTarget>] pod_targets
441
- # the array of pod targets to check against
442
- #
443
457
  # @param [TargetDefinition] target_definition
444
458
  # the target definition to use as the base for filtering
445
459
  #
446
- # @return [Array<PodTarget>] the filtered list of pod targets.
447
- #
448
- def filter_pod_targets_for_target_definition(pod_targets, target_definition)
449
- pod_targets.select do |pod_target|
450
- pod_target.target_definitions.include?(target_definition) && !pod_target_test_only?(pod_target, pod_targets)
451
- end
452
- end
453
-
454
- # Returns true if a pod target is only used by other pod targets as a test dependency and therefore should
455
- # not be included as part of the aggregate target.
456
- #
457
- # @param [PodTarget] pod_target
458
- # the pod target being queried
459
- #
460
460
  # @param [Array<PodTarget>] pod_targets
461
461
  # the array of pod targets to check against
462
462
  #
463
- # @return [Boolean] if the pod target is only referenced from test dependencies.
463
+ # @param [Hash{Podfile::TargetDefinition => Array<ResolvedSpecification>}] resolver_specs_by_target
464
+ # the resolved specifications grouped by target.
465
+ #
466
+ # @return [Array<PodTarget>] the filtered list of pod targets.
464
467
  #
465
- def pod_target_test_only?(pod_target, pod_targets)
466
- name = pod_target.name
467
- key = @test_pod_target_key.new(name, pod_targets)
468
- if @test_pod_target_analyzer_cache.key?(key)
469
- return @test_pod_target_analyzer_cache[key]
470
- end
471
- source = pod_targets.any? do |pt|
472
- pt.dependent_targets.map(&:name).include?(name)
473
- end
474
- test = pod_targets.any? do |pt|
475
- pt.test_dependent_targets.reject { |dpt| dpt.name == pt.name }.map(&:name).include?(name)
468
+ def filter_pod_targets_for_target_definition(target_definition, pod_targets, resolver_specs_by_target)
469
+ pod_targets.select do |pod_target|
470
+ included_in_target_definition = pod_target.target_definitions.include?(target_definition)
471
+ used_by_tests_only = resolver_specs_by_target[target_definition].select { |resolver_spec| pod_target.specs.include?(resolver_spec.spec) }.all?(&:used_by_tests_only?)
472
+ included_in_target_definition && !used_by_tests_only
476
473
  end
477
- @test_pod_target_analyzer_cache[key] = !source && test
478
474
  end
479
475
 
480
476
  # Setup the pod targets for an aggregate target. Deduplicates resulting
481
477
  # targets by grouping by platform and subspec by their root
482
478
  # to create a {PodTarget} for each spec.
483
479
  #
484
- # @param [Hash{Podfile::TargetDefinition => Array<Specification>}] specs_by_target
480
+ # @param [Hash{Podfile::TargetDefinition => Array<ResolvedSpecification>}] resolver_specs_by_target
485
481
  # the resolved specifications grouped by target.
486
482
  #
487
483
  # @return [Array<PodTarget>]
488
484
  #
489
- def generate_pod_targets(specs_by_target)
485
+ def generate_pod_targets(resolver_specs_by_target)
490
486
  if installation_options.deduplicate_targets?
491
- distinct_targets = specs_by_target.each_with_object({}) do |dependency, hash|
487
+ distinct_targets = resolver_specs_by_target.each_with_object({}) do |dependency, hash|
492
488
  target_definition, dependent_specs = *dependency
493
- dependent_specs.group_by(&:root).each do |root_spec, specs|
494
- pod_variant = PodVariant.new(specs, target_definition.platform, target_definition.uses_frameworks?)
489
+ dependent_specs.group_by(&:root).each do |root_spec, resolver_specs|
490
+ all_specs = resolver_specs.map(&:spec)
491
+ test_specs, specs = all_specs.partition(&:test_specification?)
492
+ pod_variant = PodVariant.new(specs, test_specs, target_definition.platform, target_definition.uses_frameworks?)
495
493
  hash[root_spec] ||= {}
496
494
  (hash[root_spec][pod_variant] ||= []) << target_definition
495
+ hash[root_spec].keys.find { |k| k == pod_variant }.test_specs.concat(test_specs).uniq!
497
496
  end
498
497
  end
499
498
 
500
499
  pod_targets = distinct_targets.flat_map do |_root, target_definitions_by_variant|
501
500
  suffixes = PodVariantSet.new(target_definitions_by_variant.keys).scope_suffixes
502
501
  target_definitions_by_variant.flat_map do |variant, target_definitions|
503
- generate_pod_target(target_definitions, variant.specs, :scope_suffix => suffixes[variant])
502
+ generate_pod_target(target_definitions, variant.specs + variant.test_specs, :scope_suffix => suffixes[variant])
504
503
  end
505
504
  end
506
505
 
507
- all_specs = specs_by_target.values.flatten.uniq
506
+ all_resolver_specs = resolver_specs_by_target.values.flatten.map(&:spec).uniq
508
507
  pod_targets_by_name = pod_targets.group_by(&:pod_name).each_with_object({}) do |(name, values), hash|
509
508
  # Sort the target by the number of activated subspecs, so that
510
509
  # we prefer a minimal target as transitive dependency.
511
510
  hash[name] = values.sort_by { |pt| pt.specs.count }
512
511
  end
513
512
  pod_targets.each do |target|
514
- dependencies = transitive_dependencies_for_specs(target.specs.reject(&:test_specification?), target.platform, all_specs).group_by(&:root)
515
- test_dependencies = transitive_dependencies_for_specs(target.specs.select(&:test_specification?), target.platform, all_specs).group_by(&:root)
513
+ dependencies = transitive_dependencies_for_specs(target.specs.reject(&:test_specification?), target.platform, all_resolver_specs).group_by(&:root)
514
+ test_dependencies = transitive_dependencies_for_specs(target.specs.select(&:test_specification?), target.platform, all_resolver_specs).group_by(&:root)
516
515
  test_dependencies.delete_if { |k| dependencies.key? k }
517
516
  target.dependent_targets = filter_dependencies(dependencies, pod_targets_by_name, target)
518
517
  target.test_dependent_targets = filter_dependencies(test_dependencies, pod_targets_by_name, target)
519
518
  end
520
519
  else
521
520
  dedupe_cache = {}
522
- specs_by_target.flat_map do |target_definition, specs|
521
+ resolver_specs_by_target.flat_map do |target_definition, specs|
523
522
  grouped_specs = specs.group_by(&:root).values.uniq
524
523
  pod_targets = grouped_specs.flat_map do |pod_specs|
525
- generate_pod_target([target_definition], pod_specs).scoped(dedupe_cache)
524
+ generate_pod_target([target_definition], pod_specs.map(&:spec)).scoped(dedupe_cache)
526
525
  end
527
526
 
528
527
  pod_targets.each do |target|
529
- dependencies = transitive_dependencies_for_specs(target.specs, target.platform, specs).group_by(&:root)
530
- test_dependencies = transitive_dependencies_for_specs(target.specs.select(&:test_specification?), target.platform, all_specs).group_by(&:root)
528
+ dependencies = transitive_dependencies_for_specs(target.specs.reject(&:test_specification?), target.platform, specs.map(&:spec)).group_by(&:root)
529
+ test_dependencies = transitive_dependencies_for_specs(target.specs.select(&:test_specification?), target.platform, specs.map(&:spec)).group_by(&:root)
531
530
  test_dependencies.delete_if { |k| dependencies.key? k }
532
531
  target.dependent_targets = pod_targets.reject { |t| dependencies[t.root_spec].nil? }
533
532
  target.test_dependent_targets = pod_targets.reject { |t| test_dependencies[t.root_spec].nil? }
@@ -764,27 +763,27 @@ module Pod
764
763
  "- #{dependencies.map(&:to_s).join("\n- ")}"
765
764
  end
766
765
 
767
- specs_by_target = nil
766
+ resolver_specs_by_target = nil
768
767
  UI.section "Resolving dependencies of #{UI.path(podfile.defined_in_file) || 'Podfile'}" do
769
768
  resolver = Resolver.new(sandbox, podfile, locked_dependencies, sources)
770
769
  resolver.specs_updated = specs_updated?
771
- specs_by_target = resolver.resolve
772
- specs_by_target.values.flatten(1).each(&:validate_cocoapods_version)
770
+ resolver_specs_by_target = resolver.resolve
771
+ resolver_specs_by_target.values.flatten(1).map(&:spec).each(&:validate_cocoapods_version)
773
772
  end
774
- specs_by_target
773
+ resolver_specs_by_target
775
774
  end
776
775
 
777
776
  # Warns for any specification that is incompatible with its target.
778
777
  #
779
- # @param [Hash{TargetDefinition => Array<Spec>}] specs_by_target
778
+ # @param [Hash{TargetDefinition => Array<Spec>}] resolver_specs_by_target
780
779
  # the specifications grouped by target.
781
780
  #
782
781
  # @return [Hash{TargetDefinition => Array<Spec>}] the specifications
783
782
  # grouped by target.
784
783
  #
785
- def validate_platforms(specs_by_target)
786
- specs_by_target.each do |target, specs|
787
- specs.each do |spec|
784
+ def validate_platforms(resolver_specs_by_target)
785
+ resolver_specs_by_target.each do |target, specs|
786
+ specs.map(&:spec).each do |spec|
788
787
  next unless target_platform = target.platform
789
788
  unless spec.available_platforms.any? { |p| target_platform.supports?(p) }
790
789
  UI.warn "The platform of the target `#{target.name}` " \
@@ -795,12 +794,12 @@ module Pod
795
794
  end
796
795
  end
797
796
 
798
- # Returns the list of all the resolved the resolved specifications.
797
+ # Returns the list of all the resolved specifications.
799
798
  #
800
799
  # @return [Array<Specification>] the list of the specifications.
801
800
  #
802
- def generate_specifications
803
- result.specs_by_target.values.flatten.uniq
801
+ def generate_specifications(resolver_specs_by_target)
802
+ resolver_specs_by_target.values.flatten.map(&:spec).uniq
804
803
  end
805
804
 
806
805
  # Computes the state of the sandbox respect to the resolved
@@ -835,8 +834,8 @@ module Pod
835
834
 
836
835
  # Returns the sources used to query for specifications
837
836
  #
838
- # When no explicit Podfile sources are defined, this defaults to the
839
- # master spec repository.
837
+ # When no explicit Podfile sources or plugin sources are defined, this
838
+ # defaults to the master spec repository.
840
839
  # available sources ({config.sources_manager.all}).
841
840
  #
842
841
  # @return [Array<Source>] the sources to be used in finding
@@ -845,6 +844,7 @@ module Pod
845
844
  def sources
846
845
  @sources ||= begin
847
846
  sources = podfile.sources
847
+ plugin_sources = @plugin_sources || []
848
848
 
849
849
  # Add any sources specified using the :source flag on individual dependencies.
850
850
  dependency_sources = podfile.dependencies.map(&:podspec_repo).compact
@@ -852,15 +852,19 @@ module Pod
852
852
 
853
853
  if all_dependencies_have_sources
854
854
  sources = dependency_sources
855
- elsif has_dependencies? && sources.empty?
855
+ elsif has_dependencies? && sources.empty? && plugin_sources.empty?
856
856
  sources = ['https://github.com/CocoaPods/Specs.git']
857
857
  else
858
858
  sources += dependency_sources
859
859
  end
860
860
 
861
- sources.uniq.map do |source_url|
861
+ result = sources.uniq.map do |source_url|
862
862
  config.sources_manager.find_or_create_source_with_url(source_url)
863
863
  end
864
+ unless plugin_sources.empty?
865
+ result.insert(0, *plugin_sources)
866
+ end
867
+ result
864
868
  end
865
869
  end
866
870