cocoapods 1.6.2 → 1.7.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +101 -7
  3. data/README.md +9 -9
  4. data/lib/cocoapods.rb +2 -0
  5. data/lib/cocoapods/command.rb +1 -1
  6. data/lib/cocoapods/command/init.rb +2 -12
  7. data/lib/cocoapods/command/install.rb +3 -0
  8. data/lib/cocoapods/command/lib/create.rb +1 -1
  9. data/lib/cocoapods/command/lib/lint.rb +5 -1
  10. data/lib/cocoapods/command/list.rb +3 -5
  11. data/lib/cocoapods/command/repo.rb +1 -0
  12. data/lib/cocoapods/command/repo/add.rb +4 -5
  13. data/lib/cocoapods/command/repo/add_cdn.rb +58 -0
  14. data/lib/cocoapods/command/repo/list.rb +5 -6
  15. data/lib/cocoapods/command/repo/push.rb +6 -5
  16. data/lib/cocoapods/command/spec/create.rb +12 -12
  17. data/lib/cocoapods/command/spec/lint.rb +1 -1
  18. data/lib/cocoapods/command/update.rb +3 -0
  19. data/lib/cocoapods/config.rb +1 -0
  20. data/lib/cocoapods/executable.rb +32 -7
  21. data/lib/cocoapods/gem_version.rb +1 -1
  22. data/lib/cocoapods/generator/app_target_helper.rb +1 -1
  23. data/lib/cocoapods/generator/embed_frameworks_script.rb +13 -0
  24. data/lib/cocoapods/generator/file_list.rb +39 -0
  25. data/lib/cocoapods/generator/module_map.rb +1 -1
  26. data/lib/cocoapods/installer.rb +188 -46
  27. data/lib/cocoapods/installer/analyzer.rb +64 -39
  28. data/lib/cocoapods/installer/analyzer/pod_variant.rb +14 -9
  29. data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +11 -2
  30. data/lib/cocoapods/installer/installation_options.rb +70 -44
  31. data/lib/cocoapods/installer/pod_source_installer.rb +9 -4
  32. data/lib/cocoapods/installer/podfile_validator.rb +9 -0
  33. data/lib/cocoapods/installer/post_install_hooks_context.rb +5 -2
  34. data/lib/cocoapods/installer/project_cache/project_cache.rb +11 -0
  35. data/lib/cocoapods/installer/project_cache/project_cache_analysis_result.rb +53 -0
  36. data/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb +156 -0
  37. data/lib/cocoapods/installer/project_cache/project_cache_version.rb +43 -0
  38. data/lib/cocoapods/installer/project_cache/project_installation_cache.rb +77 -0
  39. data/lib/cocoapods/installer/project_cache/project_metadata_cache.rb +63 -0
  40. data/lib/cocoapods/installer/project_cache/target_cache_key.rb +134 -0
  41. data/lib/cocoapods/installer/project_cache/target_metadata.rb +70 -0
  42. data/lib/cocoapods/installer/sandbox_dir_cleaner.rb +89 -0
  43. data/lib/cocoapods/installer/sandbox_header_paths_installer.rb +45 -0
  44. data/lib/cocoapods/installer/target_uuid_generator.rb +32 -0
  45. data/lib/cocoapods/installer/user_project_integrator.rb +8 -6
  46. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +128 -63
  47. data/lib/cocoapods/installer/xcode.rb +3 -0
  48. data/lib/cocoapods/installer/xcode/multi_pods_project_generator.rb +72 -0
  49. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +102 -218
  50. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_dependency_installer.rb +75 -0
  51. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +1 -1
  52. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +29 -17
  53. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +31 -65
  54. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +155 -0
  55. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +265 -110
  56. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +70 -43
  57. data/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb +75 -0
  58. data/lib/cocoapods/installer/xcode/pods_project_generator/project_generator.rb +119 -0
  59. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +44 -7
  60. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +5 -7
  61. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +32 -0
  62. data/lib/cocoapods/installer/xcode/pods_project_generator_result.rb +35 -0
  63. data/lib/cocoapods/installer/xcode/single_pods_project_generator.rb +38 -0
  64. data/lib/cocoapods/installer/xcode/target_validator.rb +32 -25
  65. data/lib/cocoapods/native_target_extension.rb +54 -0
  66. data/lib/cocoapods/open-uri.rb +1 -1
  67. data/lib/cocoapods/podfile.rb +13 -0
  68. data/lib/cocoapods/project.rb +88 -10
  69. data/lib/cocoapods/resolver.rb +11 -8
  70. data/lib/cocoapods/resolver/resolver_specification.rb +7 -7
  71. data/lib/cocoapods/sandbox.rb +38 -9
  72. data/lib/cocoapods/sandbox/file_accessor.rb +21 -0
  73. data/lib/cocoapods/sandbox/headers_store.rb +18 -3
  74. data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +1 -14
  75. data/lib/cocoapods/sources_manager.rb +11 -3
  76. data/lib/cocoapods/target.rb +67 -7
  77. data/lib/cocoapods/target/aggregate_target.rb +70 -8
  78. data/lib/cocoapods/target/build_settings.rb +124 -65
  79. data/lib/cocoapods/target/build_type.rb +139 -0
  80. data/lib/cocoapods/target/framework_paths.rb +12 -7
  81. data/lib/cocoapods/target/pod_target.rb +322 -65
  82. data/lib/cocoapods/user_interface.rb +2 -2
  83. data/lib/cocoapods/user_interface/error_report.rb +3 -0
  84. data/lib/cocoapods/user_interface/inspector_reporter.rb +1 -1
  85. data/lib/cocoapods/validator.rb +74 -39
  86. data/lib/cocoapods/version_metadata.rb +7 -0
  87. metadata +30 -6
@@ -1,3 +1,5 @@
1
+ require 'cocoapods/podfile'
2
+
1
3
  module Pod
2
4
  class Installer
3
5
  # Analyzes the Podfile, the Lockfile, and the sandbox manifest to generate
@@ -5,9 +7,6 @@ module Pod
5
7
  #
6
8
  class Analyzer
7
9
  include Config::Mixin
8
- include InstallationOptions::Mixin
9
-
10
- delegate_installation_options { podfile }
11
10
 
12
11
  autoload :AnalysisResult, 'cocoapods/installer/analyzer/analysis_result'
13
12
  autoload :LockingDependencyAnalyzer, 'cocoapods/installer/analyzer/locking_dependency_analyzer'
@@ -56,6 +55,10 @@ module Pod
56
55
  #
57
56
  attr_reader :pods_to_update
58
57
 
58
+ # @return [InstallationOptions] the installation options specified by the Podfile
59
+ #
60
+ attr_reader :installation_options
61
+
59
62
  # Initialize a new instance
60
63
  #
61
64
  # @param [Sandbox] sandbox @see #sandbox
@@ -73,6 +76,7 @@ module Pod
73
76
  @plugin_sources = plugin_sources
74
77
  @has_dependencies = has_dependencies
75
78
  @pods_to_update = pods_to_update
79
+ @installation_options = podfile.installation_options
76
80
  @podfile_dependency_cache = PodfileDependencyCache.from_podfile(podfile)
77
81
  @result = nil
78
82
  end
@@ -114,7 +118,7 @@ module Pod
114
118
  resolver_specs_by_target = resolve_dependencies(locked_dependencies)
115
119
  validate_platforms(resolver_specs_by_target)
116
120
  specifications = generate_specifications(resolver_specs_by_target)
117
- targets = generate_targets(resolver_specs_by_target, target_inspections)
121
+ targets = generate_aggregate_targets(resolver_specs_by_target, target_inspections)
118
122
  pod_targets = calculate_pod_targets(targets)
119
123
  sandbox_state = generate_sandbox_state(specifications)
120
124
  specs_by_target = resolver_specs_by_target.each_with_object({}) do |rspecs_by_target, hash|
@@ -160,7 +164,7 @@ module Pod
160
164
  if all_dependencies_have_sources
161
165
  sources = dependency_sources
162
166
  elsif has_dependencies? && sources.empty? && plugin_sources.empty?
163
- sources = ['https://github.com/CocoaPods/Specs.git']
167
+ sources = ['https://github.com/CocoaPods/Specs.git'] + dependency_sources
164
168
  else
165
169
  sources += dependency_sources
166
170
  end
@@ -303,7 +307,7 @@ module Pod
303
307
  pod_target.name
304
308
  end
305
309
  end
306
- embedded_pod_targets_by_build_config[configuration_name] += embedded_pod_targets
310
+ embedded_pod_targets_by_build_config[configuration_name] = embedded_pod_targets
307
311
  end
308
312
  end
309
313
  embedded_pod_targets_by_build_config
@@ -401,11 +405,11 @@ module Pod
401
405
  #
402
406
  # @return [Array<AggregateTarget>] the list of aggregate targets generated.
403
407
  #
404
- def generate_targets(resolver_specs_by_target, target_inspections)
408
+ def generate_aggregate_targets(resolver_specs_by_target, target_inspections)
405
409
  resolver_specs_by_target = resolver_specs_by_target.reject { |td, _| td.abstract? }
406
410
  pod_targets = generate_pod_targets(resolver_specs_by_target, target_inspections)
407
411
  aggregate_targets = resolver_specs_by_target.keys.map do |target_definition|
408
- generate_target(target_definition, target_inspections, pod_targets, resolver_specs_by_target)
412
+ generate_aggregate_target(target_definition, target_inspections, pod_targets, resolver_specs_by_target)
409
413
  end
410
414
  aggregate_targets.each do |target|
411
415
  search_paths_aggregate_targets = aggregate_targets.select do |aggregate_target|
@@ -419,13 +423,13 @@ module Pod
419
423
  embedded_targets = aggregate_targets.select(&:requires_host_target?)
420
424
  analyze_host_targets_in_podfile(aggregate_targets, embedded_targets)
421
425
 
422
- use_frameworks_embedded_targets, non_use_frameworks_embedded_targets = embedded_targets.partition(&:requires_frameworks?)
426
+ use_frameworks_embedded_targets, non_use_frameworks_embedded_targets = embedded_targets.partition(&:host_requires_frameworks?)
423
427
  aggregate_targets = aggregate_targets.map do |aggregate_target|
424
- # For targets that require frameworks, we always have to copy their pods to their
428
+ # For targets that require dynamic frameworks, we always have to copy their pods to their
425
429
  # host targets because those frameworks will all be loaded from the host target's bundle
426
430
  embedded_pod_targets = embedded_target_pod_targets_by_host(aggregate_target, use_frameworks_embedded_targets, false)
427
431
 
428
- # For targets that don't require frameworks, we only have to consider library-type
432
+ # For targets that don't require dynamic frameworks, we only have to consider library-type
429
433
  # targets because their host targets will still need to link their pods
430
434
  embedded_pod_targets.merge!(embedded_target_pod_targets_by_host(aggregate_target, non_use_frameworks_embedded_targets, true))
431
435
 
@@ -452,7 +456,7 @@ module Pod
452
456
  #
453
457
  # @return [AggregateTarget]
454
458
  #
455
- def generate_target(target_definition, target_inspections, pod_targets, resolver_specs_by_target)
459
+ def generate_aggregate_target(target_definition, target_inspections, pod_targets, resolver_specs_by_target)
456
460
  if installation_options.integrate_targets?
457
461
  target_inspection = target_inspections[target_definition]
458
462
  raise "missing inspection: #{target_definition.name}" unless target_inspection
@@ -475,9 +479,11 @@ module Pod
475
479
  pod_targets_for_build_configuration = filter_pod_targets_for_target_definition(target_definition, pod_targets,
476
480
  resolver_specs_by_target,
477
481
  build_configurations)
482
+
483
+ build_type = target_definition.uses_frameworks? ? Target::BuildType.static_framework : Target::BuildType.static_library
478
484
  AggregateTarget.new(sandbox, target_definition.uses_frameworks?, user_build_configurations, archs, platform,
479
485
  target_definition, client_root, user_project, user_target_uuids,
480
- pod_targets_for_build_configuration)
486
+ pod_targets_for_build_configuration, :build_type => build_type)
481
487
  end
482
488
 
483
489
  # @return [Array<PodTarget>] The model representations of pod targets.
@@ -489,7 +495,12 @@ module Pod
489
495
  pod_target.recursive_test_dependent_targets(test_spec)
490
496
  end
491
497
  end
492
- (aggregate_target_pod_targets + test_dependent_targets).uniq
498
+ app_dependent_targets = aggregate_target_pod_targets.flat_map do |pod_target|
499
+ pod_target.app_specs.flat_map do |app_spec|
500
+ pod_target.recursive_app_dependent_targets(app_spec)
501
+ end
502
+ end
503
+ (aggregate_target_pod_targets + test_dependent_targets + app_dependent_targets).uniq
493
504
  end
494
505
 
495
506
  # Returns a filtered list of pod targets that should or should not be part of the target definition. Pod targets
@@ -517,7 +528,7 @@ module Pod
517
528
  pod_targets.each do |pod_target|
518
529
  next unless pod_target.target_definitions.include?(target_definition)
519
530
  next unless resolver_specs_by_target[target_definition].any? do |resolver_spec|
520
- !resolver_spec.used_by_tests_only? && pod_target.specs.include?(resolver_spec.spec)
531
+ !resolver_spec.used_by_non_library_targets_only? && pod_target.specs.include?(resolver_spec.spec)
521
532
  end
522
533
 
523
534
  pod_name = pod_target.pod_name
@@ -566,54 +577,71 @@ module Pod
566
577
  target_definition, dependent_specs = *dependency
567
578
  dependent_specs.group_by(&:root).each do |root_spec, resolver_specs|
568
579
  all_specs = resolver_specs.map(&:spec)
569
- test_specs, specs = all_specs.partition(&:test_specification?)
570
- pod_variant = PodVariant.new(specs, test_specs, target_definition.platform, target_definition.uses_frameworks?)
580
+ all_specs_by_type = all_specs.group_by(&:spec_type)
581
+ library_specs = all_specs_by_type[:library] || []
582
+ test_specs = all_specs_by_type[:test] || []
583
+ app_specs = all_specs_by_type[:app] || []
584
+ target_type = Target::BuildType.infer_from_spec(root_spec, :host_requires_frameworks => target_definition.uses_frameworks?)
585
+ pod_variant = PodVariant.new(library_specs, test_specs, app_specs, target_definition.platform, target_type)
571
586
  hash[root_spec] ||= {}
572
587
  (hash[root_spec][pod_variant] ||= []) << target_definition
573
- hash[root_spec].keys.find { |k| k == pod_variant }.test_specs.concat(test_specs).uniq!
588
+ pod_variant_spec = hash[root_spec].keys.find { |k| k == pod_variant }
589
+ pod_variant_spec.test_specs.concat(test_specs).uniq!
590
+ pod_variant_spec.app_specs.concat(app_specs).uniq!
574
591
  end
575
592
  end
576
593
 
577
594
  pod_targets = distinct_targets.flat_map do |_root, target_definitions_by_variant|
578
595
  suffixes = PodVariantSet.new(target_definitions_by_variant.keys).scope_suffixes
579
- target_definitions_by_variant.flat_map do |variant, target_definitions|
580
- generate_pod_target(target_definitions, target_inspections, variant.specs + variant.test_specs, :scope_suffix => suffixes[variant])
596
+ target_definitions_by_variant.map do |variant, target_definitions|
597
+ generate_pod_target(target_definitions, target_inspections, variant.specs + variant.test_specs + variant.app_specs, :build_type => variant.build_type, :scope_suffix => suffixes[variant])
581
598
  end
582
599
  end
583
600
 
584
- all_resolver_specs = resolver_specs_by_target.values.flatten.map(&:spec).uniq
585
601
  pod_targets_by_name = pod_targets.group_by(&:pod_name).each_with_object({}) do |(name, values), hash|
586
602
  # Sort the target by the number of activated subspecs, so that
587
603
  # we prefer a minimal target as transitive dependency.
588
604
  hash[name] = values.sort_by { |pt| pt.specs.count }
589
605
  end
606
+ all_specs = resolver_specs_by_target.values.flatten.map(&:spec).uniq.group_by(&:name)
590
607
  pod_targets.each do |target|
591
- all_specs = all_resolver_specs.group_by(&:name)
592
- dependencies = dependencies_for_specs(target.non_test_specs.to_set, target.platform, all_specs.dup).group_by(&:root)
608
+ dependencies = dependencies_for_specs(target.library_specs.to_set, target.platform, all_specs.dup).group_by(&:root)
593
609
  target.dependent_targets = filter_dependencies(dependencies, pod_targets_by_name, target)
594
610
  target.test_dependent_targets_by_spec_name = target.test_specs.each_with_object({}) do |test_spec, hash|
595
611
  test_dependencies = dependencies_for_specs([test_spec], target.platform, all_specs).group_by(&:root)
596
612
  test_dependencies.delete_if { |k| dependencies.key? k }
597
613
  hash[test_spec.name] = filter_dependencies(test_dependencies, pod_targets_by_name, target)
598
614
  end
615
+
616
+ target.app_dependent_targets_by_spec_name = target.app_specs.each_with_object({}) do |app_spec, hash|
617
+ app_dependencies = dependencies_for_specs([app_spec], target.platform, all_specs).group_by(&:root)
618
+ app_dependencies.delete_if { |k| dependencies.key? k }
619
+ hash[app_spec.name] = filter_dependencies(app_dependencies, pod_targets_by_name, target)
620
+ end
599
621
  end
600
622
  else
601
623
  dedupe_cache = {}
602
624
  resolver_specs_by_target.flat_map do |target_definition, specs|
603
625
  grouped_specs = specs.group_by(&:root).values.uniq
604
626
  pod_targets = grouped_specs.flat_map do |pod_specs|
605
- generate_pod_target([target_definition], target_inspections, pod_specs.map(&:spec)).scoped(dedupe_cache)
627
+ target_type = Target::BuildType.infer_from_spec(pod_specs.first, :host_requires_frameworks => target_definition.uses_frameworks?)
628
+ generate_pod_target([target_definition], target_inspections, pod_specs.map(&:spec), :build_type => target_type).scoped(dedupe_cache)
606
629
  end
607
630
 
608
631
  pod_targets.each do |target|
609
632
  all_specs = specs.map(&:spec).group_by(&:name)
610
- dependencies = dependencies_for_specs(target.non_test_specs.to_set, target.platform, all_specs.dup).group_by(&:root)
633
+ dependencies = dependencies_for_specs(target.library_specs.to_set, target.platform, all_specs.dup).group_by(&:root)
611
634
  target.dependent_targets = pod_targets.reject { |t| dependencies[t.root_spec].nil? }
612
635
  target.test_dependent_targets_by_spec_name = target.test_specs.each_with_object({}) do |test_spec, hash|
613
636
  test_dependencies = dependencies_for_specs(target.test_specs.to_set, target.platform, all_specs.dup).group_by(&:root)
614
637
  test_dependencies.delete_if { |k| dependencies.key? k }
615
638
  hash[test_spec.name] = pod_targets.reject { |t| test_dependencies[t.root_spec].nil? }
616
639
  end
640
+ target.app_dependent_targets_by_spec_name = target.app_specs.each_with_object({}) do |app_spec, hash|
641
+ app_dependencies = dependencies_for_specs(target.app_specs.to_set, target.platform, all_specs.dup).group_by(&:root)
642
+ app_dependencies.delete_if { |k| dependencies.key? k }
643
+ hash[app_spec.name] = pod_targets.reject { |t| app_dependencies[t.root_spec].nil? }
644
+ end
617
645
  end
618
646
  end
619
647
  end
@@ -623,7 +651,7 @@ module Pod
623
651
  dependencies.map do |root_spec, deps|
624
652
  pod_targets_by_name[root_spec.name].find do |t|
625
653
  next false if t.platform.symbolic_name != target.platform.symbolic_name ||
626
- t.requires_frameworks? != target.requires_frameworks?
654
+ t.host_requires_frameworks? != target.host_requires_frameworks? # rather than target type or requires_frameworks? since we want to group by what was specified in that _target definition_
627
655
  spec_names = t.specs.map(&:name)
628
656
  deps.all? { |dep| spec_names.include?(dep.name) }
629
657
  end
@@ -678,7 +706,7 @@ module Pod
678
706
  #
679
707
  # @return [PodTarget]
680
708
  #
681
- def generate_pod_target(target_definitions, target_inspections, specs, scope_suffix: nil)
709
+ def generate_pod_target(target_definitions, target_inspections, specs, scope_suffix: nil, build_type: nil)
682
710
  object_version = target_inspections.values.map { |ti| ti.project.object_version }.min
683
711
  target_requires_64_bit = target_definitions.all? { |td| Analyzer.requires_64_bit_archs?(td.platform, object_version) }
684
712
  if installation_options.integrate_targets?
@@ -697,7 +725,7 @@ module Pod
697
725
  platform = determine_platform(specs, target_definitions, host_requires_frameworks)
698
726
  file_accessors = create_file_accessors(specs, platform)
699
727
  PodTarget.new(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, specs,
700
- target_definitions, file_accessors, scope_suffix)
728
+ target_definitions, file_accessors, scope_suffix, :build_type => build_type)
701
729
  end
702
730
 
703
731
  # Creates the file accessors for a given pod.
@@ -869,8 +897,9 @@ module Pod
869
897
  end
870
898
 
871
899
  def store_existing_checkout_options
900
+ return unless lockfile
872
901
  podfile_dependencies.select(&:external_source).each do |dep|
873
- if checkout_options = lockfile && lockfile.checkout_options_for_pod_named(dep.root_name)
902
+ if checkout_options = lockfile.checkout_options_for_pod_named(dep.root_name)
874
903
  sandbox.store_checkout_source(dep.root_name, checkout_options)
875
904
  end
876
905
  end
@@ -914,12 +943,9 @@ module Pod
914
943
 
915
944
  # Warns for any specification that is incompatible with its target.
916
945
  #
917
- # @param [Hash{TargetDefinition => Array<Spec>}] resolver_specs_by_target
946
+ # @param [Hash{TargetDefinition => Array<Specification>}] resolver_specs_by_target
918
947
  # the resolved specifications grouped by target.
919
948
  #
920
- # @return [Hash{TargetDefinition => Array<Spec>}] the specifications
921
- # grouped by target.
922
- #
923
949
  def validate_platforms(resolver_specs_by_target)
924
950
  resolver_specs_by_target.each do |target, specs|
925
951
  specs.map(&:spec).each do |spec|
@@ -935,7 +961,7 @@ module Pod
935
961
 
936
962
  # Returns the list of all the resolved specifications.
937
963
  #
938
- # @param [Hash{TargetDefinition => Array<Spec>}] resolver_specs_by_target
964
+ # @param [Hash{TargetDefinition => Array<Specification>}] resolver_specs_by_target
939
965
  # the resolved specifications grouped by target.
940
966
  #
941
967
  # @return [Array<Specification>] the list of the specifications.
@@ -997,11 +1023,10 @@ module Pod
997
1023
  # @return [void]
998
1024
  #
999
1025
  def verify_platforms_specified!
1000
- unless installation_options.integrate_targets?
1001
- @podfile_dependency_cache.target_definition_list.each do |target_definition|
1002
- if !target_definition.empty? && target_definition.platform.nil?
1003
- raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
1004
- end
1026
+ return if installation_options.integrate_targets?
1027
+ @podfile_dependency_cache.target_definition_list.each do |target_definition|
1028
+ if !target_definition.empty? && target_definition.platform.nil?
1029
+ raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
1005
1030
  end
1006
1031
  end
1007
1032
  end
@@ -11,14 +11,17 @@ module Pod
11
11
  #
12
12
  attr_reader :test_specs
13
13
 
14
+ # @return [Array<Specification>] the app specs for the target
15
+ #
16
+ attr_reader :app_specs
17
+
14
18
  # @return [Platform] the platform
15
19
  #
16
20
  attr_reader :platform
17
21
 
18
- # @return [Bool] whether this pod should be built as framework
22
+ # @return [Target::BuildType] the build type of the target
19
23
  #
20
- attr_reader :requires_frameworks
21
- alias_method :requires_frameworks?, :requires_frameworks
24
+ attr_reader :build_type
22
25
 
23
26
  # @return [Specification] the root specification
24
27
  #
@@ -30,26 +33,28 @@ module Pod
30
33
  #
31
34
  # @param [Array<Specification>] specs @see #specs
32
35
  # @param [Array<Specification>] test_specs @see #test_specs
36
+ # @param [Array<Specification>] app_specs @see #app_specs
33
37
  # @param [Platform] platform @see #platform
34
- # @param [Bool] requires_frameworks @see #requires_frameworks?
38
+ # @param [Target::BuildType] build_type @see #build_type
35
39
  #
36
- def initialize(specs, test_specs, platform, requires_frameworks = false)
40
+ def initialize(specs, test_specs, app_specs, platform, build_type = Target::BuildType.static_library)
37
41
  @specs = specs
38
42
  @test_specs = test_specs
43
+ @app_specs = app_specs
39
44
  @platform = platform
40
- @requires_frameworks = requires_frameworks
41
- @hash = [specs, platform, requires_frameworks].hash
45
+ @build_type = build_type
46
+ @hash = [specs, platform, build_type].hash
42
47
  end
43
48
 
44
49
  # @note Test specs are intentionally not included as part of the equality for pod variants since a
45
- # pod variant should not be affected by the number of test specs included.
50
+ # pod variant should not be affected by the number of test nor app specs included.
46
51
  #
47
52
  # @return [Bool] whether the {PodVariant} is equal to another taking all
48
53
  # all their attributes into account
49
54
  #
50
55
  def ==(other)
51
56
  self.class == other.class &&
52
- requires_frameworks == other.requires_frameworks &&
57
+ build_type == other.build_type &&
53
58
  platform == other.platform &&
54
59
  specs == other.specs
55
60
  end
@@ -71,8 +71,17 @@ module Pod
71
71
  # @return [Hash<PodVariant, String>]
72
72
  #
73
73
  def scope_by_build_type
74
- scope_if_necessary(group_by(&:requires_frameworks).map(&:scope_by_platform)) do |variant|
75
- variant.requires_frameworks? ? 'framework' : 'library'
74
+ scope_if_necessary(group_by { |v| v.build_type.packaging }.map(&:scope_by_linkage)) do |variant|
75
+ variant.build_type.packaging
76
+ end
77
+ end
78
+
79
+ # @private
80
+ # @return [Hash<PodVariant, String>]
81
+ #
82
+ def scope_by_linkage
83
+ scope_if_necessary(group_by { |v| v.build_type.linkage }.map(&:scope_by_platform)) do |variant|
84
+ variant.build_type.linkage
76
85
  end
77
86
  end
78
87
 
@@ -38,7 +38,7 @@ module Pod
38
38
  #
39
39
  # @note this option defaults to $2.
40
40
  #
41
- # @return the $1 $0 for installation.
41
+ # @return [Boolean] the $1 $0 for installation.
42
42
  #
43
43
  def self.option(name, default, boolean: true)
44
44
  name = name.to_s
@@ -101,60 +101,86 @@ module Pod
101
101
  to_h.hash
102
102
  end
103
103
 
104
+ # Whether to clean the sources of the pods during installation
105
+ #
106
+ # Cleaning removes any files not used by the pod as specified by the podspec and the platforms
107
+ # that the project supports
108
+ #
109
+ # @see {PodSourceInstaller#clean!}
110
+ #
104
111
  option :clean, true
112
+
113
+ # Whether to deduplicate pod targets
114
+ #
115
+ # Target deduplication adds suffixes to pod targets for the cases where a pod is included
116
+ # in multiple targets that have different requirements. For example, a pod named 'MyPod' with a subspec 'SubA'
117
+ # that is included in two targets as follows:
118
+ #
119
+ # target 'MyTargetA' do
120
+ # pod 'MyPod/SubA'
121
+ # end
122
+ #
123
+ # target 'MyTargetB' do
124
+ # pod 'MyPod'
125
+ # end
126
+ #
127
+ # will result in two Pod targets: `MyPod` and `MyPod-SubA`
128
+ #
105
129
  option :deduplicate_targets, true
130
+
131
+ # Whether to generate deterministic UUIDs when creating the Pods project
132
+ #
133
+ # @see {Xcodeproj#generate_uuid}
134
+ #
106
135
  option :deterministic_uuids, true
136
+
137
+ # Whether to integrate the installed pods into the user project
138
+ #
139
+ # If set to false, Pods will be downloaded and installed to the `Pods/` directory
140
+ # but they will not be integrated into your project.
141
+ #
107
142
  option :integrate_targets, true
143
+
144
+ # Whether to lock the source files of pods. Xcode will prompt to unlock the files when attempting to modify
145
+ # their contents
146
+ #
147
+ # @note There is a performance penalty to locking the pods during installation. If this is significantly
148
+ # impacting the duration of `pod install` for your project, you can try setting this to `false`
149
+ #
108
150
  option :lock_pod_sources, true
151
+
152
+ # Whether to emit a warning when multiple sources contain a Pod with the same name and version
153
+ #
109
154
  option :warn_for_multiple_pod_sources, true
155
+
156
+ # Whether to share Xcode schemes for development pods.
157
+ #
158
+ # Schemes for development pods are created automatically but are not shared by default.
159
+ #
110
160
  option :share_schemes_for_development_pods, false
161
+
162
+ # Whether to disable the input & output paths of the CocoaPods script phases (Copy Frameworks & Copy Resources)
163
+ #
164
+ # @see https://github.com/CocoaPods/CocoaPods/issues/8073
165
+ #
111
166
  option :disable_input_output_paths, false
112
- option :preserve_pod_file_structure, false
113
167
 
114
- module Mixin
115
- module ClassMethods
116
- # Delegates the creation of {#installation_options} to the `Podfile`
117
- # returned by the given block.
118
- #
119
- # @param blk a block that returns the `Podfile` to create
120
- # installation options from.
121
- #
122
- # @return [Void]
123
- #
124
- def delegate_installation_options(&blk)
125
- define_method(:installation_options) do
126
- @installation_options ||= InstallationOptions.from_podfile(instance_eval(&blk))
127
- end
128
- end
129
-
130
- # Delegates the installation options attributes directly to
131
- # {#installation_options}.
132
- #
133
- # @return [Void]
134
- #
135
- def delegate_installation_option_attributes!
136
- define_method(:respond_to_missing?) do |name, *args|
137
- installation_options.respond_to?(name, *args) || super
138
- end
139
-
140
- define_method(:method_missing) do |name, *args, &blk|
141
- if installation_options.respond_to?(name)
142
- installation_options.send(name, *args, &blk)
143
- else
144
- super
145
- end
146
- end
147
- end
148
- end
168
+ # Whether to preserve the file structure of all Pods, including externally sourced pods.
169
+ #
170
+ # By default, the file structure of Pod sources is preserved only for development pods. Setting
171
+ # `:preserve_pod_file_structure` to `true` will _always_ preserve the file structure.
172
+ #
173
+ option :preserve_pod_file_structure, false
149
174
 
150
- # @return [InstallationOptions] The installation options.
151
- #
152
- attr_accessor :installation_options
175
+ # Whether to generate a project per pod target. Instead of creating 1 `Pods.xcodeproj`, this option will generate
176
+ # a project for every pod target that will be nested under the `Pods.xcodeproj`.
177
+ #
178
+ option :generate_multiple_pod_projects, false
153
179
 
154
- def self.included(mod)
155
- mod.extend(ClassMethods)
156
- end
157
- end
180
+ # Whether to enable only regenerating targets and their associate projects that have changed
181
+ # since the previous installation.
182
+ #
183
+ option :incremental_installation, false
158
184
  end
159
185
  end
160
186
  end