cocoapods 0.38.2 → 0.39.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +175 -90
  3. data/lib/cocoapods.rb +0 -6
  4. data/lib/cocoapods/command/lib.rb +15 -10
  5. data/lib/cocoapods/command/repo/lint.rb +3 -1
  6. data/lib/cocoapods/command/repo/push.rb +13 -4
  7. data/lib/cocoapods/command/spec/create.rb +5 -6
  8. data/lib/cocoapods/command/spec/lint.rb +15 -10
  9. data/lib/cocoapods/executable.rb +36 -6
  10. data/lib/cocoapods/gem_version.rb +1 -1
  11. data/lib/cocoapods/generator/copy_resources_script.rb +1 -1
  12. data/lib/cocoapods/generator/embed_frameworks_script.rb +40 -10
  13. data/lib/cocoapods/generator/xcconfig.rb +1 -2
  14. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +9 -8
  15. data/lib/cocoapods/generator/xcconfig/{private_pod_xcconfig.rb → pod_xcconfig.rb} +14 -63
  16. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +1 -2
  17. data/lib/cocoapods/installer.rb +60 -32
  18. data/lib/cocoapods/installer/analyzer.rb +2 -0
  19. data/lib/cocoapods/installer/file_references_installer.rb +3 -3
  20. data/lib/cocoapods/installer/pod_source_installer.rb +24 -5
  21. data/lib/cocoapods/installer/source_provider_hooks_context.rb +32 -0
  22. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +6 -4
  23. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +2 -7
  24. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +59 -25
  25. data/lib/cocoapods/resolver.rb +10 -2
  26. data/lib/cocoapods/sandbox/file_accessor.rb +57 -0
  27. data/lib/cocoapods/sandbox/headers_store.rb +5 -6
  28. data/lib/cocoapods/target.rb +0 -12
  29. data/lib/cocoapods/target/pod_target.rb +7 -0
  30. data/lib/cocoapods/validator.rb +34 -23
  31. metadata +16 -16
  32. data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +0 -53
@@ -370,22 +370,30 @@ module Pod
370
370
  # @param [Molinillo::ResolverError] error
371
371
  #
372
372
  def handle_resolver_error(error)
373
+ message = error.message
373
374
  case error
374
375
  when Molinillo::VersionConflict
375
376
  error.conflicts.each do |name, conflict|
376
377
  lockfile_reqs = conflict.requirements[name_for_locking_dependency_source]
377
378
  if lockfile_reqs && lockfile_reqs.last && lockfile_reqs.last.prerelease? && !conflict.existing
378
- raise Informative, 'Due to the previous naïve CocoaPods resolver, ' \
379
+ message = 'Due to the previous naïve CocoaPods resolver, ' \
379
380
  "you were using a pre-release version of `#{name}`, " \
380
381
  'without explicitly asking for a pre-release version, which now leads to a conflict. ' \
381
382
  'Please decide to either use that pre-release version by adding the ' \
382
383
  'version requirement to your Podfile ' \
383
384
  "(e.g. `pod '#{name}', '#{lockfile_reqs.map(&:requirement).join("', '")}'`) " \
384
385
  "or revert to a stable version by running `pod update #{name}`."
386
+ elsif !conflict.existing
387
+ conflict.requirements.values.flatten.each do |r|
388
+ unless search_for(r).empty?
389
+ message << "\n\nSpecs satisfying the `#{r}` dependency were found, " \
390
+ 'but they required a higher minimum deployment target.'
391
+ end
392
+ end
385
393
  end
386
394
  end
387
395
  end
388
- raise Informative, error.message
396
+ raise Informative, message
389
397
  end
390
398
 
391
399
  # Returns whether the given spec is platform-compatible with the dependency
@@ -152,6 +152,22 @@ module Pod
152
152
  paths_for_attribute(:vendored_frameworks, true)
153
153
  end
154
154
 
155
+ # @return [Array<Pathname>] The paths of the dynamic framework bundles
156
+ # that come shipped with the Pod.
157
+ #
158
+ def vendored_dynamic_frameworks
159
+ vendored_frameworks.select do |framework|
160
+ dynamic_binary?(framework + framework.basename('.*'))
161
+ end
162
+ end
163
+
164
+ # @return [Array<Pathname>] The paths of the static (fake) framework
165
+ # bundles that come shipped with the Pod.
166
+ #
167
+ def vendored_static_frameworks
168
+ vendored_frameworks - vendored_dynamic_frameworks
169
+ end
170
+
155
171
  # @param [Pathname] framework
156
172
  # The vendored framework to search into.
157
173
  # @return [Pathname] The path of the header directory of the
@@ -187,6 +203,36 @@ module Pod
187
203
  paths_for_attribute(:vendored_libraries)
188
204
  end
189
205
 
206
+ # @return [Array<Pathname>] The paths of the dynamic libraries
207
+ # that come shipped with the Pod.
208
+ #
209
+ def vendored_dynamic_libraries
210
+ vendored_libraries.select do |library|
211
+ dynamic_binary?(library)
212
+ end
213
+ end
214
+
215
+ # @return [Array<Pathname>] The paths of the static libraries
216
+ # that come shipped with the Pod.
217
+ #
218
+ def vendored_static_libraries
219
+ vendored_libraries - vendored_dynamic_libraries
220
+ end
221
+
222
+ # @return [Array<Pathname>] The paths of the dynamic binary artifacts
223
+ # that come shipped with the Pod.
224
+ #
225
+ def vendored_dynamic_artifacts
226
+ vendored_dynamic_libraries + vendored_dynamic_frameworks
227
+ end
228
+
229
+ # @return [Array<Pathname>] The paths of the static binary artifacts
230
+ # that come shipped with the Pod.
231
+ #
232
+ def vendored_static_artifacts
233
+ vendored_static_libraries + vendored_static_frameworks
234
+ end
235
+
190
236
  # @return [Hash{String => Array<Pathname>}] A hash that describes the
191
237
  # resource bundles of the Pod. The keys represent the name of
192
238
  # the bundle while the values the path of the resources.
@@ -315,6 +361,17 @@ module Pod
315
361
  result.flatten.compact.uniq
316
362
  end
317
363
 
364
+ # @param [Pathname] binary
365
+ # The file to be checked for being a dynamic Mach-O binary.
366
+ #
367
+ # @return [Boolean] Whether `binary` can be dynamically linked.
368
+ #
369
+ def dynamic_binary?(binary)
370
+ return unless binary.file?
371
+ output, status = Executable.capture_command('file', [binary], :capture => :out)
372
+ status.success? && output =~ /dynamically linked/
373
+ end
374
+
318
375
  #-----------------------------------------------------------------------#
319
376
  end
320
377
  end
@@ -66,13 +66,13 @@ module Pod
66
66
  # the path of the header file relative to the Pods project
67
67
  # (`PODS_ROOT` variable of the xcconfigs).
68
68
  #
69
- # @note This method adds the files to the search paths.
69
+ # @note This method does _not_ add the files to the search paths.
70
70
  #
71
71
  # @return [Array<Pathname>]
72
72
  #
73
- def add_files(namespace, relative_header_paths, platform)
73
+ def add_files(namespace, relative_header_paths)
74
74
  relative_header_paths.map do |relative_header_path|
75
- add_file(namespace, relative_header_path, relative_header_path.basename, platform)
75
+ add_file(namespace, relative_header_path, relative_header_path.basename)
76
76
  end
77
77
  end
78
78
 
@@ -90,12 +90,11 @@ module Pod
90
90
  # the name under which the file should be available in the
91
91
  # headers directory.
92
92
  #
93
- # @note This method adds the file to the search paths.
93
+ # @note This method does _not_ add the file to the search paths.
94
94
  #
95
95
  # @return [Pathname]
96
96
  #
97
- def add_file(namespace, relative_header_path, final_name, platform)
98
- add_search_path(namespace, platform)
97
+ def add_file(namespace, relative_header_path, final_name)
99
98
  namespaced_path = root + namespace
100
99
  namespaced_path.mkpath unless File.exist?(namespaced_path)
101
100
 
@@ -75,12 +75,6 @@ module Pod
75
75
  requires_frameworks? ? :framework : :static_library
76
76
  end
77
77
 
78
- # @return [String] the XCConfig namespaced prefix.
79
- #
80
- def xcconfig_prefix
81
- label.upcase.gsub(/[^A-Z]/, '_') + '_'
82
- end
83
-
84
78
  # @return [String] A string suitable for debugging.
85
79
  #
86
80
  def inspect
@@ -140,12 +134,6 @@ module Pod
140
134
  end
141
135
  end
142
136
 
143
- # @return [Pathname] the absolute path of the private xcconfig file.
144
- #
145
- def xcconfig_private_path
146
- support_files_dir + "#{label}-Private.xcconfig"
147
- end
148
-
149
137
  # @return [Pathname] the absolute path of the header file which contains
150
138
  # the exported foundation constants with framework version
151
139
  # information and all headers, which should been exported in the
@@ -33,6 +33,11 @@ module Pod
33
33
  attr_reader :scoped
34
34
  alias_method :scoped?, :scoped
35
35
 
36
+ # @return [Array<PodTarget>] the targets that this target has a dependency
37
+ # upon.
38
+ #
39
+ attr_accessor :dependent_targets
40
+
36
41
  # @param [Array<Specification>] @spec #see spec
37
42
  # @param [Array<TargetDefinition>] target_definitions @see target_definitions
38
43
  # @param [Sandbox] sandbox @see sandbox
@@ -49,6 +54,7 @@ module Pod
49
54
  @build_headers = Sandbox::HeadersStore.new(sandbox, 'Private')
50
55
  @file_accessors = []
51
56
  @resource_bundle_targets = []
57
+ @dependent_targets = []
52
58
  end
53
59
 
54
60
  # @return [Array<PodTarget>] a scoped copy for each target definition.
@@ -60,6 +66,7 @@ module Pod
60
66
  target.user_build_configurations = user_build_configurations
61
67
  target.native_target = native_target
62
68
  target.archs = archs
69
+ target.dependent_targets = dependent_targets.map(&:scoped)
63
70
  end
64
71
  end
65
72
  end
@@ -62,7 +62,7 @@ module Pod
62
62
  # @return [Bool] whether the specification passed validation.
63
63
  #
64
64
  def validate
65
- @results = []
65
+ @results = []
66
66
 
67
67
  # Replace default spec with a subspec if asked for
68
68
  a_spec = spec
@@ -111,7 +111,7 @@ module Pod
111
111
  when :warning then type = 'WARN'
112
112
  when :note then type = 'NOTE'
113
113
  else raise "#{result.type}" end
114
- UI.puts " - #{type.ljust(5)} | #{platform_message}#{subspecs_message}#{result.message}"
114
+ UI.puts " - #{type.ljust(5)} | #{platform_message}#{subspecs_message}#{result.attribute_name}: #{result.message}"
115
115
  end
116
116
  UI.puts
117
117
  end
@@ -127,9 +127,13 @@ module Pod
127
127
  if !allow_warnings && (size = results_by_type[:warning].size) && size > 0
128
128
  reason = "#{size} #{'warning'.pluralize(size)}"
129
129
  pronoun = size == 1 ? 'it' : 'them'
130
- reason << " (but you can use `--allow-warnings` to ignore #{pronoun})" if reasons.empty?
130
+ reason << " (but you can use `--allow-warnings` to ignore #{pronoun})" if reasons.empty?
131
131
  reasons << reason
132
132
  end
133
+ if results.all?(&:public_only)
134
+ reasons << 'All results apply only to public specs, but you can use ' \
135
+ '`--private` to ignore them if linting the specification for a private pod.'
136
+ end
133
137
  reasons.to_sentence
134
138
  end
135
139
 
@@ -177,6 +181,11 @@ module Pod
177
181
  #
178
182
  attr_accessor :use_frameworks
179
183
 
184
+ # @return [Boolean] Whether attributes that affect only public sources
185
+ # Bool be skipped.
186
+ #
187
+ attr_accessor :ignore_public_only_results
188
+
180
189
  #-------------------------------------------------------------------------#
181
190
 
182
191
  # !@group Lint results
@@ -195,7 +204,9 @@ module Pod
195
204
  # One of: `:error`, `:warning`, `:note`.
196
205
  #
197
206
  def result_type
198
- types = results.map(&:type).uniq
207
+ applicable_results = results
208
+ applicable_results = applicable_results.reject(&:public_only?) if ignore_public_only_results
209
+ types = applicable_results.map(&:type).uniq
199
210
  if types.include?(:error) then :error
200
211
  elsif types.include?(:warning) then :warning
201
212
  else :note
@@ -277,9 +288,9 @@ module Pod
277
288
  resp = Pod::HTTP.validate_url(url)
278
289
 
279
290
  if !resp
280
- warning('url', "There was a problem validating the URL #{url}.")
291
+ warning('url', "There was a problem validating the URL #{url}.", true)
281
292
  elsif !resp.success?
282
- warning('url', "The URL (#{url}) is not reachable.")
293
+ warning('url', "The URL (#{url}) is not reachable.", true)
283
294
  end
284
295
 
285
296
  resp
@@ -297,8 +308,8 @@ module Pod
297
308
  #
298
309
  def validate_screenshots(spec)
299
310
  spec.screenshots.compact.each do |screenshot|
300
- request = validate_url(screenshot)
301
- if request && !(request.headers['content-type'] && request.headers['content-type'].first =~ /image\/.*/i)
311
+ response = validate_url(screenshot)
312
+ if response && !(response.headers['content-type'] && response.headers['content-type'].first =~ /image\/.*/i)
302
313
  warning('screenshot', "The screenshot #{screenshot} is not a valid image.")
303
314
  end
304
315
  end
@@ -371,8 +382,8 @@ module Pod
371
382
  deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)
372
383
 
373
384
  unless file_accessor.nil?
374
- dynamic_frameworks = file_accessor.vendored_frameworks.select { |fw| `file #{fw + fw.basename('.framework')} 2>&1` =~ /dynamically linked/ }
375
- dynamic_libraries = file_accessor.vendored_libraries.select { |lib| `file #{lib} 2>&1` =~ /dynamically linked/ }
385
+ dynamic_frameworks = file_accessor.vendored_dynamic_frameworks
386
+ dynamic_libraries = file_accessor.vendored_dynamic_libraries
376
387
  if (dynamic_frameworks.count > 0 || dynamic_libraries.count > 0) && consumer.platform_name == :ios &&
377
388
  (deployment_target.nil? || Version.new(deployment_target).major < 8)
378
389
  error('dynamic', 'Dynamic frameworks and libraries are only supported on iOS 8.0 and onwards.')
@@ -395,7 +406,7 @@ module Pod
395
406
  UI.message "\nBuilding with xcodebuild.\n".yellow do
396
407
  output = Dir.chdir(config.sandbox_root) { xcodebuild }
397
408
  UI.puts output
398
- parsed_output = parse_xcodebuild_output(output)
409
+ parsed_output = parse_xcodebuild_output(output)
399
410
  parsed_output.each do |message|
400
411
  # Checking the error for `InputFile` is to work around an Xcode
401
412
  # issue where linting would fail even though `xcodebuild` actually
@@ -490,24 +501,24 @@ module Pod
490
501
 
491
502
  # !@group Result Helpers
492
503
 
493
- def error(attribute_name, message)
494
- add_result(:error, attribute_name, message)
504
+ def error(*args)
505
+ add_result(:error, *args)
495
506
  end
496
507
 
497
- def warning(attribute_name, message)
498
- add_result(:warning, attribute_name, message)
508
+ def warning(*args)
509
+ add_result(:warning, *args)
499
510
  end
500
511
 
501
- def note(attribute_name, message)
502
- add_result(:note, attribute_name, message)
512
+ def note(*args)
513
+ add_result(:note, *args)
503
514
  end
504
515
 
505
- def add_result(type, attribute_name, message)
516
+ def add_result(type, attribute_name, message, public_only = false)
506
517
  result = results.find do |r|
507
- r.type == type && r.attribute_name && r.message == message
518
+ r.type == type && r.attribute_name && r.message == message && r.public_only? == public_only
508
519
  end
509
520
  unless result
510
- result = Result.new(type, attribute_name, message)
521
+ result = Result.new(type, attribute_name, message, public_only)
511
522
  results << result
512
523
  end
513
524
  result.platforms << consumer.platform_name if consumer
@@ -517,8 +528,8 @@ module Pod
517
528
  # Specialized Result to support subspecs aggregation
518
529
  #
519
530
  class Result < Specification::Linter::Results::Result
520
- def initialize(type, attribute_name, message)
521
- super(type, attribute_name, message)
531
+ def initialize(type, attribute_name, message, public_only = false)
532
+ super(type, attribute_name, message, public_only)
522
533
  @subspecs = []
523
534
  end
524
535
 
@@ -583,7 +594,7 @@ module Pod
583
594
  def parse_xcodebuild_output(output)
584
595
  lines = output.split("\n")
585
596
  selected_lines = lines.select do |l|
586
- l.include?('error: ') && (l !~ /errors? generated\./) && (l !~ /error: \(null\)/) ||
597
+ l.include?('error: ') && (l !~ /errors? generated\./) && (l !~ /error: \(null\)/) ||
587
598
  l.include?('warning: ') && (l !~ /warnings? generated\./) && (l !~ /frameworks only run on iOS 8/) ||
588
599
  l.include?('note: ') && (l !~ /expanded from macro/)
589
600
  end
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: 0.38.2
4
+ version: 0.39.0.beta.1
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: 2015-07-25 00:00:00.000000000 Z
14
+ date: 2015-08-26 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: 0.38.2
22
+ version: 0.39.0.beta.1
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: 0.38.2
29
+ version: 0.39.0.beta.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: claide
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -47,28 +47,28 @@ dependencies:
47
47
  requirements:
48
48
  - - ~>
49
49
  - !ruby/object:Gem::Version
50
- version: 0.26.3
50
+ version: 0.27.0
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
- version: 0.26.3
57
+ version: 0.27.0
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: cocoapods-downloader
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - ~>
63
63
  - !ruby/object:Gem::Version
64
- version: 0.9.1
64
+ version: 0.9.2
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - ~>
70
70
  - !ruby/object:Gem::Version
71
- version: 0.9.1
71
+ version: 0.9.2
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: cocoapods-plugins
74
74
  requirement: !ruby/object:Gem::Requirement
@@ -89,42 +89,42 @@ dependencies:
89
89
  requirements:
90
90
  - - ~>
91
91
  - !ruby/object:Gem::Version
92
- version: 0.5.3
92
+ version: 0.6.0
93
93
  type: :runtime
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - ~>
98
98
  - !ruby/object:Gem::Version
99
- version: 0.5.3
99
+ version: 0.6.0
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: cocoapods-try
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
104
  - - ~>
105
105
  - !ruby/object:Gem::Version
106
- version: 0.4.5
106
+ version: 0.5.0
107
107
  type: :runtime
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - ~>
112
112
  - !ruby/object:Gem::Version
113
- version: 0.4.5
113
+ version: 0.5.0
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: cocoapods-trunk
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
118
  - - ~>
119
119
  - !ruby/object:Gem::Version
120
- version: 0.6.1
120
+ version: 0.6.2
121
121
  type: :runtime
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
125
  - - ~>
126
126
  - !ruby/object:Gem::Version
127
- version: 0.6.1
127
+ version: 0.6.2
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: molinillo
130
130
  requirement: !ruby/object:Gem::Requirement
@@ -311,8 +311,7 @@ files:
311
311
  - lib/cocoapods/generator/umbrella_header.rb
312
312
  - lib/cocoapods/generator/xcconfig.rb
313
313
  - lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb
314
- - lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb
315
- - lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb
314
+ - lib/cocoapods/generator/xcconfig/pod_xcconfig.rb
316
315
  - lib/cocoapods/generator/xcconfig/xcconfig_helper.rb
317
316
  - lib/cocoapods/hooks_manager.rb
318
317
  - lib/cocoapods/installer.rb
@@ -330,6 +329,7 @@ files:
330
329
  - lib/cocoapods/installer/podfile_validator.rb
331
330
  - lib/cocoapods/installer/post_install_hooks_context.rb
332
331
  - lib/cocoapods/installer/pre_install_hooks_context.rb
332
+ - lib/cocoapods/installer/source_provider_hooks_context.rb
333
333
  - lib/cocoapods/installer/target_installer.rb
334
334
  - lib/cocoapods/installer/target_installer/aggregate_target_installer.rb
335
335
  - lib/cocoapods/installer/target_installer/pod_target_installer.rb