cocoapods 1.0.1 → 1.1.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +107 -0
  3. data/lib/cocoapods/command.rb +1 -0
  4. data/lib/cocoapods/command/repo/push.rb +26 -5
  5. data/lib/cocoapods/command/setup.rb +2 -1
  6. data/lib/cocoapods/downloader.rb +20 -0
  7. data/lib/cocoapods/downloader/cache.rb +1 -0
  8. data/lib/cocoapods/gem_version.rb +1 -1
  9. data/lib/cocoapods/generator/acknowledgements/plist.rb +1 -0
  10. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +9 -2
  11. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +5 -4
  12. data/lib/cocoapods/installer.rb +41 -205
  13. data/lib/cocoapods/installer/analyzer.rb +65 -1
  14. data/lib/cocoapods/installer/analyzer/pod_variant.rb +9 -3
  15. data/lib/cocoapods/installer/analyzer/target_inspector.rb +24 -0
  16. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +23 -6
  17. data/lib/cocoapods/installer/xcode.rb +7 -0
  18. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +265 -0
  19. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +202 -0
  20. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +314 -0
  21. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +397 -0
  22. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +214 -0
  23. data/lib/cocoapods/resolver.rb +1 -2
  24. data/lib/cocoapods/target/aggregate_target.rb +19 -0
  25. data/lib/cocoapods/target/pod_target.rb +15 -2
  26. data/lib/cocoapods/user_interface.rb +6 -1
  27. data/lib/cocoapods/user_interface/error_report.rb +7 -0
  28. data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
  29. data/lib/cocoapods/validator.rb +15 -7
  30. metadata +42 -19
  31. data/lib/cocoapods/installer/file_references_installer.rb +0 -310
  32. data/lib/cocoapods/installer/target_installer.rb +0 -210
  33. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +0 -191
  34. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +0 -389
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeda2d6ab232bd8f105714f6a51b3986ca80b775
4
- data.tar.gz: 5fbdf86b804049c847b316843922500fd3d187d7
3
+ metadata.gz: 874ef7ca85409e240f67902b93426a61624b351f
4
+ data.tar.gz: 9ba454d15e64fdaa7fc0902120e93b9fe1fd86ec
5
5
  SHA512:
6
- metadata.gz: 871f362cd52240407bf82ae6d82c120fb44e4d00c2cf5d0c6ce1f71c05eea7efccbfa046224600b8a268357992bab0603e6d66b13544ef573427e49ef8fc3d69
7
- data.tar.gz: 74971c13eded91890a16897f00dfab17a1d9d3248ba7e2a1b19fbb924ced964f76f711ff607cb065790b552d906c8d6ab6d476c05fb1fc302d465e51500f4e42
6
+ metadata.gz: d5bbc9deebcd172a88456e21ee536aedb983383e287acafbf4481949980715139d5e673c0d18ecc10988e1521c59c3c710a7130ade7c405fd4a4a63ec3681fc1
7
+ data.tar.gz: b9510b26eb4290ececc726cfd68f9fc22a6e6127bd6ae54907e50f6959f82ddef552e85d29007936603f4f2b66b40dd808597fcf93ecd0f76ad501b3fa6dae00
@@ -4,6 +4,113 @@ 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.1.0.beta.1 (2016-07-11)
8
+
9
+ ##### Enhancements
10
+
11
+ * Move Pods Project generation to an `Xcode` Namespace.
12
+ [Daniel Tomlinson](https://github.com/dantoml)
13
+ [#5480](https://github.com/CocoaPods/CocoaPods/pull/5480)
14
+
15
+ * Add the ability to inhibit swift warnings.
16
+ [Peter Ryszkiewicz](https://github.com/pRizz)
17
+ [#5414](https://github.com/CocoaPods/CocoaPods/pull/5414)
18
+
19
+ * Use `git ls-remote` to skip full clones for branch dependencies.
20
+ [Juan Civile](https://github.com/champo)
21
+ [#5376](https://github.com/CocoaPods/CocoaPods/issues/5376)
22
+
23
+ * [repo/push] --use-json to convert podspecs to JSON format when pushing.
24
+ [Mark Schall](https://github.com/maschall)
25
+ [#5568](https://github.com/CocoaPods/CocoaPods/pull/5568)
26
+
27
+ * Set 'Allow app extension API only' for Messages extensions.
28
+ [Boris Bügling](https://github.com/neonichu)
29
+ [#5558](https://github.com/CocoaPods/CocoaPods/issues/5558)
30
+
31
+ * Accept `pod repo push` with URL instead of only repo name.
32
+ [Mark Schall](https://github.com/maschall)
33
+ [#5572](https://github.com/CocoaPods/CocoaPods/pull/5572)
34
+
35
+ * [Installer] Set the SWIFT_VERSION for CocoaPods generated targets.
36
+ [Danielle Tomlinson](https://github.com/DanToml)
37
+ [#5540](https://github.com/CocoaPods/CocoaPods/pulls/5540)
38
+
39
+ * Print message when skipping user project integration.
40
+ [Danielle Tomlinson](https://github.com/dantoml)
41
+ [#5517](https://github.com/CocoaPods/CocoaPods/issues/5517)
42
+
43
+ * Show GitHub Issues that could be related to exceptions.
44
+ [Orta Therox](https://github.com/orta)
45
+ [#4817](https://github.com/CocoaPods/CocoaPods/issues/4817)
46
+
47
+ * Improve handling of app extensions, watch os 1 extensions
48
+ and framework targets.
49
+ [benasher44](https://github.com/benasher44)
50
+ [#4203](https://github.com/CocoaPods/CocoaPods/issues/4203)
51
+
52
+ * Add a license type to generated acknowledgements file in plist.
53
+ [Naoto Kaneko](https://github.com/naoty)
54
+ [#5436](https://github.com/CocoaPods/CocoaPods/pull/5436)
55
+
56
+ ##### Bug Fixes
57
+
58
+ * Fix local pod platform conflict error message.
59
+ [Muhammed Yavuz Nuzumlalı](https://github.com/manuyavuz)
60
+ [#5052](https://github.com/CocoaPods/CocoaPods/issues/5052)
61
+
62
+ * Avoid use of `activesupport` version 5 to stay compatible with macOS system
63
+ Ruby.
64
+ [Boris Bügling](https://github.com/neonichu)
65
+ [#5602](https://github.com/CocoaPods/CocoaPods/issues/5602)
66
+
67
+ * Fix installing pods with `use_frameworks` when deduplication is disabled.
68
+ [Samuel Giddins](https://github.com/segiddins)
69
+ [#5481](https://github.com/CocoaPods/CocoaPods/issues/5481)
70
+
71
+ * Running `pod setup --silent` will now properly silence git output while
72
+ updating the repository.
73
+ [Samuel Giddins](https://github.com/segiddins)
74
+
75
+ * Fix linting pods that depend upon `XCTest`.
76
+ [Samuel Giddins](https://github.com/segiddins)
77
+ [#5321](https://github.com/CocoaPods/CocoaPods/issues/5321)
78
+
79
+ * Use `require` instead of `autoload` to solve an issue with loading
80
+ `fourflusher`.
81
+ [Boris Bügling](https://github.com/neonichu)
82
+ [#5445](https://github.com/CocoaPods/CocoaPods/issues/5445)
83
+
84
+ * Resolve cyclic dependencies when creating pod targets.
85
+ [Juan Civile](https://github.com/champo)
86
+ [#5362](https://github.com/CocoaPods/CocoaPods/issues/5362)
87
+
88
+ * Fix embedding frameworks in UI Testing bundles.
89
+ [Daniel Tomlinson](https://github.com/dantoml)
90
+ [#5250](https://github.com/CocoaPods/CocoaPods/issues/5250)
91
+
92
+ * Ensure attempting to print a path in the error report doesn't itself error.
93
+ [Samuel Giddins](https://github.com/)
94
+ [#5541](https://github.com/CocoaPods/CocoaPods/issues/5541)
95
+
96
+ * Fix linting with Xcode 8.
97
+ [Boris Bügling](https://github.com/neonichu)
98
+ [#5529](https://github.com/CocoaPods/CocoaPods/issues/5529)
99
+
100
+ * Fix linting with Xcode 8 by disabling it entirely.
101
+ [Boris Bügling](https://github.com/neonichu)
102
+ [#5528](https://github.com/CocoaPods/CocoaPods/issues/5528)
103
+
104
+ * Error during install when there are duplicate library names.
105
+ [Daniel Tomlinson](https://github.com/dantoml)
106
+ [#4014](https://github.com/CocoaPods/CocoaPods/issues/4014)
107
+
108
+ * Make the `Check Pods Manifest.lock` script write errors to STDERR and improve
109
+ POSIX shell compatibility.
110
+ [Simon Warta](https://github.com/webmaster128)
111
+ [#5595](https://github.com/CocoaPods/CocoaPods/pull/5595)
112
+
113
+
7
114
  ## 1.0.1 (2016-06-02)
8
115
 
9
116
  ##### Enhancements
@@ -62,6 +62,7 @@ module Pod
62
62
  else
63
63
  if ENV['COCOA_PODS_ENV'] != 'development'
64
64
  puts UI::ErrorReport.report(exception)
65
+ UI::ErrorReport.search_for_exceptions(exception)
65
66
  exit 1
66
67
  else
67
68
  raise exception
@@ -31,6 +31,7 @@ module Pod
31
31
  ['--no-private', 'Lint includes checks that apply only to public repos'],
32
32
  ['--commit-message="Fix bug in pod"', 'Add custom commit message. ' \
33
33
  'Opens default editor if no commit message is specified.'],
34
+ ['--use-json', 'Push JSON spec to repo'],
34
35
  ].concat(super)
35
36
  end
36
37
 
@@ -38,20 +39,21 @@ module Pod
38
39
  @allow_warnings = argv.flag?('allow-warnings')
39
40
  @local_only = argv.flag?('local-only')
40
41
  @repo = argv.shift_argument
41
- @source = config.sources_manager.sources([@repo]).first unless @repo.nil?
42
+ @source = source_for_repo
42
43
  @source_urls = argv.option('sources', config.sources_manager.all.map(&:url).join(',')).split(',')
43
44
  @podspec = argv.shift_argument
44
45
  @use_frameworks = !argv.flag?('use-libraries')
45
46
  @private = argv.flag?('private', true)
46
47
  @message = argv.option('commit-message')
47
48
  @commit_message = argv.flag?('commit-message', false)
49
+ @use_json = argv.flag?('use-json')
48
50
  super
49
51
  end
50
52
 
51
53
  def validate!
52
54
  super
53
- help! 'A spec-repo name is required.' unless @repo
54
- unless @source.repo.directory?
55
+ help! 'A spec-repo name or url is required.' unless @repo
56
+ unless @source && @source.repo.directory?
55
57
  raise Informative,
56
58
  "Unable to find the `#{@repo}` repo. " \
57
59
  'If it has not yet been cloned, add it via `pod repo add`.'
@@ -177,9 +179,16 @@ module Pod
177
179
  else
178
180
  message = "[Add] #{spec}"
179
181
  end
180
-
181
182
  FileUtils.mkdir_p(output_path)
182
- FileUtils.cp(spec_file, output_path)
183
+
184
+ if @use_json
185
+ json_file_name = "#{spec.name}.podspec.json"
186
+ json_file = File.join(output_path, json_file_name)
187
+ File.open(json_file, 'w') { |file| file.write(spec.to_pretty_json) }
188
+ else
189
+ FileUtils.cp(spec_file, output_path)
190
+ end
191
+
183
192
  Dir.chdir(repo_dir) do
184
193
  # only commit if modified
185
194
  if git!('status', '--porcelain').include?(spec.name)
@@ -234,6 +243,18 @@ module Pod
234
243
  podspec_files.count
235
244
  end
236
245
 
246
+ # Returns source for @repo
247
+ #
248
+ # @note If URL is invalid or repo doesn't exist, validate! will throw the error
249
+ #
250
+ # @return [Source]
251
+ #
252
+ def source_for_repo
253
+ config.sources_manager.source_with_name_or_url(@repo) unless @repo.nil?
254
+ rescue
255
+ nil
256
+ end
257
+
237
258
  #---------------------------------------------------------------------#
238
259
  end
239
260
  end
@@ -59,7 +59,8 @@ module Pod
59
59
  # @return [void]
60
60
  #
61
61
  def update_master_repo
62
- config.sources_manager.update('master', true)
62
+ show_output = !config.silent?
63
+ config.sources_manager.update('master', show_output)
63
64
  end
64
65
 
65
66
  # Sets the repo to the master branch.
@@ -33,11 +33,16 @@ module Pod
33
33
  cache_path: Config.instance.cache_root + 'Pods'
34
34
  )
35
35
  can_cache &&= !Config.instance.skip_download_cache
36
+
37
+ request = preprocess_request(request)
38
+
36
39
  if can_cache
37
40
  raise ArgumentError, 'Must provide a `cache_path` when caching.' unless cache_path
38
41
  cache = Cache.new(cache_path)
39
42
  result = cache.download_pod(request)
40
43
  else
44
+ raise ArgumentError, 'Must provide a `target` when caching is disabled.' unless target
45
+
41
46
  require 'cocoapods/installer/pod_source_preparer'
42
47
  result, = download_request(request, target)
43
48
  Installer::PodSourcePreparer.new(result.spec, result.location).prepare!
@@ -110,6 +115,21 @@ module Pod
110
115
  end
111
116
  end
112
117
 
118
+ # Return a new request after preprocessing by the downloader
119
+ #
120
+ # @param [Request] request
121
+ # the request that needs preprocessing
122
+ #
123
+ # @return [Request] the preprocessed request
124
+ #
125
+ def self.preprocess_request(request)
126
+ Request.new(
127
+ :spec => request.spec,
128
+ :released => request.released_pod?,
129
+ :name => request.name,
130
+ :params => Downloader.preprocess_options(request.params))
131
+ end
132
+
113
133
  public
114
134
 
115
135
  class DownloaderError; include CLAide::InformativeError; end
@@ -124,6 +124,7 @@ module Pod
124
124
  def cached_pod(request)
125
125
  cached_spec = cached_spec(request)
126
126
  path = path_for_pod(request)
127
+
127
128
  return unless cached_spec && path.directory?
128
129
  spec = request.spec || cached_spec
129
130
  Response.new(path, spec, request.params)
@@ -1,5 +1,5 @@
1
1
  module Pod
2
2
  # The version of the CocoaPods command line tool.
3
3
  #
4
- VERSION = '1.0.1'.freeze unless defined? Pod::VERSION
4
+ VERSION = '1.1.0.beta.1'.freeze unless defined? Pod::VERSION
5
5
  end
@@ -37,6 +37,7 @@ module Pod
37
37
  :Type => 'PSGroupSpecifier',
38
38
  :Title => sanitize_encoding(spec.name),
39
39
  :FooterText => sanitize_encoding(license),
40
+ :License => sanitize_encoding(spec.license[:type]),
40
41
  }
41
42
  end
42
43
  end
@@ -4,7 +4,7 @@ module Pod
4
4
  # Generates the xcconfigs for the aggregate targets.
5
5
  #
6
6
  class AggregateXCConfig
7
- # @return [Target] the target represented by this xcconfig.
7
+ # @return [AggregateTarget] the target represented by this xcconfig.
8
8
  #
9
9
  attr_reader :target
10
10
 
@@ -61,7 +61,14 @@ module Pod
61
61
  'FRAMEWORK_SEARCH_PATHS' => '$(inherited) ',
62
62
  'LIBRARY_SEARCH_PATHS' => '$(inherited) ',
63
63
  }
64
- if pod_targets.any?(&:uses_swift?)
64
+ # For embedded targets, which live in a host target, CocoaPods
65
+ # copies all of the embedded target's pod_targets its host
66
+ # target. Therefore, this check will properly require the Swift
67
+ # libs in the host target, if the embedded target has any pod targets
68
+ # that use Swift. Setting this for the embedded target would
69
+ # cause an App Store rejection because frameworks cannot be embedded
70
+ # in embedded targets.
71
+ if !target.requires_host_target? && pod_targets.any?(&:uses_swift?)
65
72
  config['EMBEDDED_CONTENT_CONTAINS_SWIFT'] = 'YES'
66
73
  end
67
74
  @xcconfig = Xcodeproj::Config.new(config)
@@ -1,3 +1,5 @@
1
+ require 'active_support/core_ext/object/try'
2
+
1
3
  module Pod
2
4
  module Generator
3
5
  module XCConfig
@@ -283,9 +285,9 @@ module Pod
283
285
  #
284
286
  def self.add_language_specific_settings(target, xcconfig)
285
287
  if target.uses_swift?
286
- build_settings = {
287
- 'OTHER_SWIFT_FLAGS' => '$(inherited) ' + quote(%w(-D COCOAPODS)),
288
- }
288
+ other_swift_flags = ['$(inherited)', quote(%w(-D COCOAPODS))]
289
+ other_swift_flags << quote(%w(-suppress-warnings)) if target.try(:inhibit_warnings?)
290
+ build_settings = { 'OTHER_SWIFT_FLAGS' => other_swift_flags.join(' ') }
289
291
  xcconfig.merge!(build_settings)
290
292
  end
291
293
  end
@@ -314,7 +316,6 @@ module Pod
314
316
  search_paths << search_path
315
317
  end
316
318
  end
317
- search_paths
318
319
  end
319
320
  end
320
321
 
@@ -29,9 +29,7 @@ module Pod
29
29
  # source control.
30
30
  #
31
31
  class Installer
32
- autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
33
32
  autoload :Analyzer, 'cocoapods/installer/analyzer'
34
- autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer'
35
33
  autoload :InstallationOptions, 'cocoapods/installer/installation_options'
36
34
  autoload :PostInstallHooksContext, 'cocoapods/installer/post_install_hooks_context'
37
35
  autoload :PreInstallHooksContext, 'cocoapods/installer/pre_install_hooks_context'
@@ -40,9 +38,8 @@ module Pod
40
38
  autoload :PodfileValidator, 'cocoapods/installer/podfile_validator'
41
39
  autoload :PodSourceInstaller, 'cocoapods/installer/pod_source_installer'
42
40
  autoload :PodSourcePreparer, 'cocoapods/installer/pod_source_preparer'
43
- autoload :PodTargetInstaller, 'cocoapods/installer/target_installer/pod_target_installer'
44
- autoload :TargetInstaller, 'cocoapods/installer/target_installer'
45
41
  autoload :UserProjectIntegrator, 'cocoapods/installer/user_project_integrator'
42
+ autoload :Xcode, 'cocoapods/installer/xcode'
46
43
 
47
44
  include Config::Mixin
48
45
  include InstallationOptions::Mixin
@@ -113,11 +110,15 @@ module Pod
113
110
  prepare
114
111
  resolve_dependencies
115
112
  download_dependencies
116
- verify_no_duplicate_framework_names
113
+ verify_no_duplicate_framework_and_library_names
117
114
  verify_no_static_framework_transitive_dependencies
118
115
  verify_framework_usage
119
116
  generate_pods_project
120
- integrate_user_project if installation_options.integrate_targets?
117
+ if installation_options.integrate_targets?
118
+ integrate_user_project
119
+ else
120
+ UI.section 'Skipping User Project Integration'
121
+ end
121
122
  perform_post_install_actions
122
123
  end
123
124
 
@@ -163,15 +164,25 @@ module Pod
163
164
  end
164
165
  end
165
166
 
166
- def generate_pods_project
167
+ #-------------------------------------------------------------------------#
168
+
169
+ # @!group Pods Project Generation
170
+
171
+ private
172
+
173
+ def create_generator
174
+ Xcode::PodsProjectGenerator.new(aggregate_targets, sandbox, pod_targets, analysis_result, installation_options, config)
175
+ end
176
+
177
+ # Generate the 'Pods/Pods.xcodeproj' project.
178
+ #
179
+ def generate_pods_project(generator = create_generator)
167
180
  UI.section 'Generating Pods project' do
168
- prepare_pods_project
169
- install_file_references
170
- install_libraries
171
- set_target_dependencies
181
+ generator.generate!
182
+ @pods_project = generator.project
172
183
  run_podfile_post_install_hooks
173
- write_pod_project
174
- share_development_pod_schemes
184
+ generator.write
185
+ generator.share_development_pod_schemes
175
186
  write_lockfiles
176
187
  end
177
188
  end
@@ -382,23 +393,32 @@ module Pod
382
393
  end
383
394
  end
384
395
 
385
- def verify_no_duplicate_framework_names
396
+ def verify_no_duplicate_framework_and_library_names
386
397
  aggregate_targets.each do |aggregate_target|
387
398
  aggregate_target.user_build_configurations.keys.each do |config|
388
399
  pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
389
- vendored_frameworks = pod_targets.flat_map(&:file_accessors).flat_map(&:vendored_frameworks).uniq
390
- frameworks = vendored_frameworks.map { |fw| fw.basename('.framework') }
400
+ file_accessors = pod_targets.flat_map(&:file_accessors)
401
+
402
+ frameworks = file_accessors.flat_map(&:vendored_frameworks).uniq.map(&:basename)
391
403
  frameworks += pod_targets.select { |pt| pt.should_build? && pt.requires_frameworks? }.map(&:product_module_name)
404
+ verify_no_duplicate_names(frameworks, aggregate_target.label, 'frameworks')
392
405
 
393
- duplicates = frameworks.group_by { |f| f }.select { |_, v| v.size > 1 }.keys
394
- unless duplicates.empty?
395
- raise Informative, "The '#{aggregate_target.label}' target has " \
396
- "frameworks with conflicting names: #{duplicates.to_sentence}."
397
- end
406
+ libraries = file_accessors.flat_map(&:vendored_libraries).uniq.map(&:basename)
407
+ libraries += pod_targets.select { |pt| pt.should_build? && !pt.requires_frameworks? }.map(&:product_name)
408
+ verify_no_duplicate_names(libraries, aggregate_target.label, 'libraries')
398
409
  end
399
410
  end
400
411
  end
401
412
 
413
+ def verify_no_duplicate_names(names, label, type)
414
+ duplicates = names.map { |n| n.to_s.downcase }.group_by { |f| f }.select { |_, v| v.size > 1 }.keys
415
+
416
+ unless duplicates.empty?
417
+ raise Informative, "The '#{label}' target has " \
418
+ "#{type} with conflicting names: #{duplicates.to_sentence}."
419
+ end
420
+ end
421
+
402
422
  def verify_no_static_framework_transitive_dependencies
403
423
  aggregate_targets.each do |aggregate_target|
404
424
  next unless aggregate_target.requires_frameworks?
@@ -551,181 +571,6 @@ module Pod
551
571
  end
552
572
  end
553
573
 
554
- # Creates the Pods project from scratch if it doesn't exists.
555
- #
556
- # @return [void]
557
- #
558
- # @todo Clean and modify the project if it exists.
559
- #
560
- def prepare_pods_project
561
- UI.message '- Creating Pods project' do
562
- @pods_project = if object_version = aggregate_targets.map(&:user_project).compact.map { |p| p.object_version.to_i }.min
563
- Pod::Project.new(sandbox.project_path, false, object_version)
564
- else
565
- Pod::Project.new(sandbox.project_path)
566
- end
567
-
568
- analysis_result.all_user_build_configurations.each do |name, type|
569
- @pods_project.add_build_configuration(name, type)
570
- end
571
-
572
- pod_names = pod_targets.map(&:pod_name).uniq
573
- pod_names.each do |pod_name|
574
- local = sandbox.local?(pod_name)
575
- path = sandbox.pod_dir(pod_name)
576
- was_absolute = sandbox.local_path_was_absolute?(pod_name)
577
- @pods_project.add_pod_group(pod_name, path, local, was_absolute)
578
- end
579
-
580
- if config.podfile_path
581
- @pods_project.add_podfile(config.podfile_path)
582
- end
583
-
584
- sandbox.project = @pods_project
585
- platforms = aggregate_targets.map(&:platform)
586
- osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
587
- ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
588
- watchos_deployment_target = platforms.select { |p| p.name == :watchos }.map(&:deployment_target).min
589
- tvos_deployment_target = platforms.select { |p| p.name == :tvos }.map(&:deployment_target).min
590
- @pods_project.build_configurations.each do |build_configuration|
591
- build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
592
- build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
593
- build_configuration.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = watchos_deployment_target.to_s if watchos_deployment_target
594
- build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
595
- build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
596
- build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
597
- end
598
- end
599
- end
600
-
601
- # Installs the file references in the Pods project. This is done once per
602
- # Pod as the same file reference might be shared by multiple aggregate
603
- # targets.
604
- #
605
- # @return [void]
606
- #
607
- def install_file_references
608
- installer = FileReferencesInstaller.new(sandbox, pod_targets, pods_project)
609
- installer.install!
610
- end
611
-
612
- # Installs the aggregate targets of the Pods projects and generates their
613
- # support files.
614
- #
615
- # @return [void]
616
- #
617
- def install_libraries
618
- UI.message '- Installing targets' do
619
- pod_targets.sort_by(&:name).each do |pod_target|
620
- target_installer = PodTargetInstaller.new(sandbox, pod_target)
621
- target_installer.install!
622
- end
623
-
624
- aggregate_targets.sort_by(&:name).each do |target|
625
- target_installer = AggregateTargetInstaller.new(sandbox, target)
626
- target_installer.install!
627
- end
628
-
629
- # TODO: Move and add specs
630
- pod_targets.sort_by(&:name).each do |pod_target|
631
- pod_target.file_accessors.each do |file_accessor|
632
- file_accessor.spec_consumer.frameworks.each do |framework|
633
- if pod_target.should_build?
634
- pod_target.native_target.add_system_framework(framework)
635
- end
636
- end
637
- end
638
- end
639
- end
640
- end
641
-
642
- # Adds a target dependency for each pod spec to each aggregate target and
643
- # links the pod targets among each other.
644
- #
645
- # @return [void]
646
- #
647
- def set_target_dependencies
648
- frameworks_group = pods_project.frameworks_group
649
- aggregate_targets.each do |aggregate_target|
650
- is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
651
- [:app_extension, :watch_extension, :watch2_extension, :tv_extension]).empty?
652
- is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }
653
-
654
- aggregate_target.pod_targets.each do |pod_target|
655
- configure_app_extension_api_only_for_target(aggregate_target) if is_app_extension
656
-
657
- unless pod_target.should_build?
658
- pod_target.resource_bundle_targets.each do |resource_bundle_target|
659
- aggregate_target.native_target.add_dependency(resource_bundle_target)
660
- end
661
-
662
- next
663
- end
664
-
665
- aggregate_target.native_target.add_dependency(pod_target.native_target)
666
- configure_app_extension_api_only_for_target(pod_target) if is_app_extension
667
-
668
- pod_target.dependent_targets.each do |pod_dependency_target|
669
- next unless pod_dependency_target.should_build?
670
- pod_target.native_target.add_dependency(pod_dependency_target.native_target)
671
- configure_app_extension_api_only_for_target(pod_dependency_target) if is_app_extension
672
-
673
- if pod_target.requires_frameworks?
674
- product_ref = frameworks_group.files.find { |f| f.path == pod_dependency_target.product_name } ||
675
- frameworks_group.new_product_ref_for_target(pod_dependency_target.product_basename, pod_dependency_target.product_type)
676
- pod_target.native_target.frameworks_build_phase.add_file_reference(product_ref, true)
677
- end
678
- end
679
- end
680
- end
681
- end
682
-
683
- # Writes the Pods project to the disk.
684
- #
685
- # @return [void]
686
- #
687
- def write_pod_project
688
- UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
689
- pods_project.pods.remove_from_project if pods_project.pods.empty?
690
- pods_project.development_pods.remove_from_project if pods_project.development_pods.empty?
691
- pods_project.sort(:groups_position => :below)
692
- if installation_options.deterministic_uuids?
693
- UI.message('- Generating deterministic UUIDs') { pods_project.predictabilize_uuids }
694
- end
695
- pods_project.recreate_user_schemes(false)
696
- pods_project.save
697
- end
698
- end
699
-
700
- # Shares schemes of development Pods.
701
- #
702
- # @return [void]
703
- #
704
- def share_development_pod_schemes
705
- development_pod_targets.select(&:should_build?).each do |pod_target|
706
- next unless share_scheme_for_development_pod?(pod_target.pod_name)
707
- Xcodeproj::XCScheme.share_scheme(pods_project.path, pod_target.label)
708
- end
709
- end
710
-
711
- # @param [String] pod The root name of the development pod.
712
- #
713
- # @return [Bool] whether the scheme for the given development pod should be
714
- # shared.
715
- #
716
- def share_scheme_for_development_pod?(pod)
717
- case dev_pods_to_share = installation_options.share_schemes_for_development_pods
718
- when TrueClass, FalseClass, NilClass
719
- dev_pods_to_share
720
- when Array
721
- dev_pods_to_share.any? { |dev_pod| dev_pod === pod } # rubocop:disable Style/CaseEquality
722
- else
723
- raise Informative, 'Unable to handle share_schemes_for_development_pods ' \
724
- "being set to #{dev_pods_to_share.inspect} -- please set it to true, " \
725
- 'false, or an array of pods to share schemes for.'
726
- end
727
- end
728
-
729
574
  # Writes the Podfile and the lock files.
730
575
  #
731
576
  # @todo Pass the checkout options to the Lockfile.
@@ -859,15 +704,6 @@ module Pod
859
704
  analysis_result.sandbox_state
860
705
  end
861
706
 
862
- # Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
863
- # configurations of the given target
864
- #
865
- def configure_app_extension_api_only_for_target(target)
866
- target.native_target.build_configurations.each do |config|
867
- config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
868
- end
869
- end
870
-
871
707
  #-------------------------------------------------------------------------#
872
708
  end
873
709
  end