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
@@ -2,6 +2,9 @@ module Pod
2
2
  class Installer
3
3
  class Xcode
4
4
  autoload :PodsProjectGenerator, 'cocoapods/installer/xcode/pods_project_generator'
5
+ autoload :SinglePodsProjectGenerator, 'cocoapods/installer/xcode/single_pods_project_generator'
6
+ autoload :MultiPodsProjectGenerator, 'cocoapods/installer/xcode/multi_pods_project_generator'
7
+ autoload :PodsProjectWriter, 'cocoapods/installer/xcode/pods_project_generator/pods_project_writer'
5
8
  autoload :TargetValidator, 'cocoapods/installer/xcode/target_validator'
6
9
  end
7
10
  end
@@ -0,0 +1,72 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ # The {MultiPodsProjectGenerator} handles generation of the 'Pods/Pods.xcodeproj' and Xcode projects
5
+ # for every {PodTarget}. All Pod Target projects are nested under the 'Pods.xcodeproj'.
6
+ #
7
+ class MultiPodsProjectGenerator < PodsProjectGenerator
8
+ # Generates `Pods/Pods.xcodeproj` and all pod target subprojects.
9
+ #
10
+ # @return [PodsProjectGeneratorResult]
11
+ #
12
+ def generate!
13
+ # Generate container Pods.xcodeproj.
14
+ container_project = create_container_project(aggregate_targets, sandbox.project_path)
15
+
16
+ project_paths_by_pod_targets = pod_targets.group_by { |pod_target| sandbox.pod_target_project_path(pod_target.pod_name) }
17
+ projects_by_pod_targets = Hash[project_paths_by_pod_targets.map do |project_path, pod_targets|
18
+ project = create_pods_project(pod_targets, project_path, container_project)
19
+ [project, pod_targets]
20
+ end]
21
+
22
+ # Note: We must call `install_file_references` on all pod targets before installing them.
23
+ pod_target_installation_results = install_all_pod_targets(projects_by_pod_targets)
24
+ aggregate_target_installation_results = install_aggregate_targets_into_project(container_project, aggregate_targets)
25
+ target_installation_results = InstallationResults.new(pod_target_installation_results, aggregate_target_installation_results)
26
+
27
+ integrate_targets(target_installation_results.pod_target_installation_results)
28
+ wire_target_dependencies(target_installation_results)
29
+ PodsProjectGeneratorResult.new(container_project, projects_by_pod_targets, target_installation_results)
30
+ end
31
+
32
+ private
33
+
34
+ def create_container_project(aggregate_targets, path)
35
+ return unless aggregate_targets
36
+ platforms = aggregate_targets.map(&:platform)
37
+ ProjectGenerator.new(sandbox, path, [], build_configurations, platforms,
38
+ project_object_version, config.podfile_path).generate!
39
+ end
40
+
41
+ def create_pods_project(pod_targets, path, parent_project)
42
+ platforms = pod_targets.map(&:platform)
43
+ project = ProjectGenerator.new(sandbox, path,
44
+ pod_targets, build_configurations, platforms,
45
+ project_object_version, false, :pod_target_subproject => true).generate!
46
+ # Instead of saving every subproject to disk, we can optimize this by creating a temporary folder
47
+ # the file reference can use so that we only have to call `save` once for all projects.
48
+ project.path.mkpath
49
+ if parent_project
50
+ parent_project.add_subproject_reference(project, parent_project.dependencies_group)
51
+ end
52
+
53
+ install_file_references(project, pod_targets)
54
+ project
55
+ end
56
+
57
+ def install_all_pod_targets(projects_by_pod_targets)
58
+ UI.message '- Installing Pod Targets' do
59
+ projects_by_pod_targets.each_with_object({}) do |(project, pod_targets), target_installation_results|
60
+ target_installation_results.merge!(install_pod_targets(project, pod_targets))
61
+ end
62
+ end
63
+ end
64
+
65
+ def install_aggregate_targets_into_project(project, aggregate_targets)
66
+ return {} unless project
67
+ install_aggregate_targets(project, aggregate_targets)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -1,7 +1,7 @@
1
1
  module Pod
2
2
  class Installer
3
3
  class Xcode
4
- # The {PodsProjectGenerator} handles generation of the 'Pods/Pods.xcodeproj'
4
+ # The {PodsProjectGenerator} handles generation of CocoaPods Xcode projects.
5
5
  #
6
6
  class PodsProjectGenerator
7
7
  require 'cocoapods/installer/xcode/pods_project_generator/target_installer_helper'
@@ -11,15 +11,16 @@ module Pod
11
11
  require 'cocoapods/installer/xcode/pods_project_generator/pod_target_installer'
12
12
  require 'cocoapods/installer/xcode/pods_project_generator/file_references_installer'
13
13
  require 'cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer'
14
+ require 'cocoapods/installer/xcode/pods_project_generator/project_generator'
15
+ require 'cocoapods/installer/xcode/pods_project_generator_result'
16
+ require 'cocoapods/installer/xcode/pods_project_generator/aggregate_target_dependency_installer'
17
+ require 'cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer'
18
+ require 'cocoapods/native_target_extension.rb'
14
19
 
15
20
  # @return [Sandbox] The sandbox where the Pods should be installed.
16
21
  #
17
22
  attr_reader :sandbox
18
23
 
19
- # @return [Pod::Project] the `Pods/Pods.xcodeproj` project.
20
- #
21
- attr_reader :project
22
-
23
24
  # @return [Array<AggregateTarget>] The model representations of an
24
25
  # aggregation of pod targets generated for a target definition
25
26
  # in the Podfile.
@@ -30,10 +31,9 @@ module Pod
30
31
  #
31
32
  attr_reader :pod_targets
32
33
 
33
- # @return [Analyzer] the analyzer which provides the information about what
34
- # needs to be installed.
34
+ # @return [Hash{String => Symbol}] The build configurations that need to be installed.
35
35
  #
36
- attr_reader :analysis_result
36
+ attr_reader :build_configurations
37
37
 
38
38
  # @return [InstallationOptions] the installation options from the Podfile.
39
39
  #
@@ -43,175 +43,113 @@ module Pod
43
43
  #
44
44
  attr_reader :config
45
45
 
46
- # Initialize a new instance
46
+ # @return [String] the object version for the projects we will generate.
47
47
  #
48
- # @param [Sandbox] sandbox @see #sandbox
49
- # @param [Array<AggregateTarget>] aggregate_targets @see #aggregate_targets
50
- # @param [Array<PodTarget>] pod_targets @see #pod_targets
51
- # @param [Analyzer] analysis_result @see #analysis_result
52
- # @param [InstallationOptions] installation_options @see #installation_options
53
- # @param [Config] config @see #config
48
+ attr_reader :project_object_version
49
+
50
+ # @return [ProjectMetadataCache] the metadata cache used to reconstruct target dependencies.
54
51
  #
55
- def initialize(sandbox, aggregate_targets, pod_targets, analysis_result, installation_options, config)
52
+ attr_reader :metadata_cache
53
+
54
+ # Initialize a new instance
55
+ #
56
+ # @param [Sandbox] sandbox @see #sandbox
57
+ # @param [Array<AggregateTarget>] aggregate_targets @see #aggregate_targets
58
+ # @param [Array<PodTarget>] pod_targets @see #pod_targets
59
+ # @param [Hash{String => Symbol}] build_configurations @see #build_configurations
60
+ # @param [InstallationOptions] installation_options @see #installation_options
61
+ # @param [Config] config @see #config
62
+ # @param [String] project_object_version @see #project_object_version
63
+ # @param [ProjectMetadataCache] metadata_cache @see #metadata_cache
64
+ #
65
+ def initialize(sandbox, aggregate_targets, pod_targets, build_configurations, installation_options, config,
66
+ project_object_version, metadata_cache = nil)
56
67
  @sandbox = sandbox
57
68
  @aggregate_targets = aggregate_targets
58
69
  @pod_targets = pod_targets
59
- @analysis_result = analysis_result
70
+ @build_configurations = build_configurations
60
71
  @installation_options = installation_options
61
72
  @config = config
62
- end
63
-
64
- def generate!
65
- prepare
66
- install_file_references
67
- @target_installation_results = install_targets
68
- integrate_targets(@target_installation_results.pod_target_installation_results)
69
- wire_target_dependencies(@target_installation_results)
70
- @target_installation_results
71
- end
72
-
73
- def write
74
- UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
75
- project.pods.remove_from_project if project.pods.empty?
76
- project.development_pods.remove_from_project if project.development_pods.empty?
77
- project.sort(:groups_position => :below)
78
- if installation_options.deterministic_uuids?
79
- UI.message('- Generating deterministic UUIDs') { project.predictabilize_uuids }
80
- end
81
- library_product_types = [:framework, :dynamic_library, :static_library]
82
-
83
- pod_target_installation_results = @target_installation_results.pod_target_installation_results
84
- results_by_native_target = Hash[pod_target_installation_results.map do |_, result|
85
- [result.native_target, result]
86
- end]
87
- project.recreate_user_schemes(false) do |scheme, target|
88
- next unless target.respond_to?(:symbol_type)
89
- next unless library_product_types.include? target.symbol_type
90
- installation_result = results_by_native_target[target]
91
- next unless installation_result
92
- installation_result.test_native_targets.each do |test_native_target|
93
- scheme.add_test_target(test_native_target)
94
- end
95
- end
96
- project.save
97
- end
73
+ @project_object_version = project_object_version
74
+ @metadata_cache = metadata_cache
98
75
  end
99
76
 
100
77
  # Shares schemes of development Pods.
101
78
  #
102
79
  # @return [void]
103
80
  #
104
- def share_development_pod_schemes
105
- development_pod_targets.select(&:should_build?).each do |pod_target|
106
- next unless share_scheme_for_development_pod?(pod_target.pod_name)
107
- Xcodeproj::XCScheme.share_scheme(project.path, pod_target.label)
108
- if pod_target.contains_test_specifications?
109
- pod_target.test_specs.each do |test_spec|
110
- Xcodeproj::XCScheme.share_scheme(project.path, pod_target.test_target_label(test_spec))
111
- end
112
- end
81
+ def share_development_pod_schemes(project, development_pod_targets = [])
82
+ targets = development_pod_targets.select do |target|
83
+ target.should_build? && share_scheme_for_development_pod?(target.pod_name)
84
+ end
85
+ targets.each do |pod_target|
86
+ configure_schemes_for_pod_target(project, pod_target)
113
87
  end
114
88
  end
115
89
 
116
- private
117
-
90
+ # @!attribute [Hash{String => TargetInstallationResult}] pod_target_installation_results
91
+ # @!attribute [Hash{String => TargetInstallationResult}] aggregate_target_installation_results
118
92
  InstallationResults = Struct.new(:pod_target_installation_results, :aggregate_target_installation_results)
119
93
 
120
- def create_project
121
- if object_version = aggregate_targets.map(&:user_project).compact.map { |p| p.object_version.to_i }.min
122
- Pod::Project.new(sandbox.project_path, false, object_version)
123
- else
124
- Pod::Project.new(sandbox.project_path)
94
+ private
95
+
96
+ def install_file_references(project, pod_targets)
97
+ UI.message "- Installing files into #{project.project_name} project" do
98
+ installer = FileReferencesInstaller.new(sandbox, pod_targets, project, installation_options.preserve_pod_file_structure)
99
+ installer.install!
125
100
  end
126
101
  end
127
102
 
128
- # Creates the Pods project from scratch if it doesn't exists.
129
- #
130
- # @return [void]
131
- #
132
- # @todo Clean and modify the project if it exists.
133
- #
134
- def prepare
135
- UI.message '- Creating Pods project' do
136
- @project = create_project
137
- analysis_result.all_user_build_configurations.each do |name, type|
138
- @project.add_build_configuration(name, type)
139
- end
140
- # Reset symroot just in case the user has added a new build configuration other than 'Debug' or 'Release'.
141
- @project.symroot = Pod::Project::LEGACY_BUILD_ROOT
142
-
143
- pod_names = pod_targets.map(&:pod_name).uniq
144
- pod_names.each do |pod_name|
145
- local = sandbox.local?(pod_name)
146
- path = sandbox.pod_dir(pod_name)
147
- was_absolute = sandbox.local_path_was_absolute?(pod_name)
148
- @project.add_pod_group(pod_name, path, local, was_absolute)
149
- end
103
+ def install_pod_targets(project, pod_targets)
104
+ umbrella_headers_by_dir = pod_targets.map do |pod_target|
105
+ next unless pod_target.should_build? && pod_target.defines_module?
106
+ pod_target.umbrella_header_path
107
+ end.compact.group_by(&:dirname)
150
108
 
151
- if config.podfile_path
152
- @project.add_podfile(config.podfile_path)
153
- end
109
+ pod_target_installation_results = Hash[pod_targets.sort_by(&:name).map do |pod_target|
110
+ umbrella_headers_in_header_dir = umbrella_headers_by_dir[pod_target.module_map_path.dirname]
111
+ target_installer = PodTargetInstaller.new(sandbox, project, pod_target, umbrella_headers_in_header_dir)
112
+ [pod_target.name, target_installer.install!]
113
+ end]
154
114
 
155
- sandbox.project = @project
156
- platforms = aggregate_targets.map(&:platform)
157
- osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
158
- ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
159
- watchos_deployment_target = platforms.select { |p| p.name == :watchos }.map(&:deployment_target).min
160
- tvos_deployment_target = platforms.select { |p| p.name == :tvos }.map(&:deployment_target).min
161
- @project.build_configurations.each do |build_configuration|
162
- build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
163
- build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
164
- build_configuration.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = watchos_deployment_target.to_s if watchos_deployment_target
165
- build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
166
- build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
167
- build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
168
- end
115
+ # Hook up system framework dependencies for the pod targets that were just installed.
116
+ pod_target_installation_result_values = pod_target_installation_results.values.compact
117
+ unless pod_target_installation_result_values.empty?
118
+ add_system_framework_dependencies(pod_target_installation_result_values)
169
119
  end
170
- end
171
120
 
172
- def install_file_references
173
- installer = FileReferencesInstaller.new(sandbox, pod_targets, project, installation_options.preserve_pod_file_structure)
174
- installer.install!
121
+ pod_target_installation_results
175
122
  end
176
123
 
177
- def install_targets
178
- UI.message '- Installing targets' do
179
- umbrella_headers_by_dir = pod_targets.map do |pod_target|
180
- next unless pod_target.should_build? && pod_target.defines_module?
181
- pod_target.umbrella_header_path
182
- end.compact.group_by(&:dirname)
183
-
184
- pod_target_installation_results = Hash[pod_targets.sort_by(&:name).map do |pod_target|
185
- umbrella_headers_in_header_dir = umbrella_headers_by_dir[pod_target.module_map_path.dirname]
186
- target_installer = PodTargetInstaller.new(sandbox, @project, pod_target, umbrella_headers_in_header_dir)
187
- [pod_target.name, target_installer.install!]
188
- end]
189
-
190
- # Hook up system framework dependencies for the pod targets that were just installed.
191
- pod_target_installation_result_values = pod_target_installation_results.values.compact
192
- unless pod_target_installation_result_values.empty?
193
- add_system_framework_dependencies(pod_target_installation_result_values)
194
- end
195
-
124
+ def install_aggregate_targets(project, aggregate_targets)
125
+ UI.message '- Installing Aggregate Targets' do
196
126
  aggregate_target_installation_results = Hash[aggregate_targets.sort_by(&:name).map do |target|
197
- target_installer = AggregateTargetInstaller.new(sandbox, @project, target)
127
+ target_installer = AggregateTargetInstaller.new(sandbox, project, target)
198
128
  [target.name, target_installer.install!]
199
129
  end]
200
130
 
201
- InstallationResults.new(pod_target_installation_results, aggregate_target_installation_results)
131
+ aggregate_target_installation_results
202
132
  end
203
133
  end
204
134
 
135
+ # @param [Hash{String => InstallationResult}] pod_target_installation_results
136
+ # the installations to integrate
137
+ #
138
+ # @return [void]
139
+ #
205
140
  def integrate_targets(pod_target_installation_results)
206
141
  pod_installations_to_integrate = pod_target_installation_results.values.select do |pod_target_installation_result|
207
142
  pod_target = pod_target_installation_result.target
208
- !pod_target_installation_result.test_native_targets.empty? || pod_target.contains_script_phases?
143
+ !pod_target_installation_result.test_native_targets.empty? ||
144
+ !pod_target_installation_result.app_native_targets.empty? ||
145
+ pod_target.contains_script_phases?
209
146
  end
210
- unless pod_installations_to_integrate.empty?
211
- UI.message '- Integrating targets' do
212
- pod_installations_to_integrate.each do |pod_target_installation_result|
213
- PodTargetIntegrator.new(pod_target_installation_result, installation_options).integrate!
214
- end
147
+ return if pod_installations_to_integrate.empty?
148
+
149
+ UI.message '- Integrating targets' do
150
+ use_input_output_paths = !installation_options.disable_input_output_paths
151
+ pod_installations_to_integrate.each do |pod_target_installation_result|
152
+ PodTargetIntegrator.new(pod_target_installation_result, :use_input_output_paths => use_input_output_paths).integrate!
215
153
  end
216
154
  end
217
155
  end
@@ -223,7 +161,7 @@ module Pod
223
161
  sorted_installation_results.each do |target_installation_result|
224
162
  pod_target = target_installation_result.target
225
163
  next unless pod_target.should_build?
226
- next if !pod_target.requires_frameworks? || pod_target.static_framework?
164
+ next if pod_target.build_as_static?
227
165
  pod_target.file_accessors.each do |file_accessor|
228
166
  native_target = target_installation_result.native_target_for_spec(file_accessor.spec)
229
167
  add_system_frameworks_to_native_target(native_target, file_accessor)
@@ -241,65 +179,13 @@ module Pod
241
179
  # @return [void]
242
180
  #
243
181
  def wire_target_dependencies(target_installation_results)
244
- frameworks_group = project.frameworks_group
245
182
  pod_target_installation_results_hash = target_installation_results.pod_target_installation_results
246
183
  aggregate_target_installation_results_hash = target_installation_results.aggregate_target_installation_results
247
184
 
248
- # Wire up aggregate targets
249
- aggregate_target_installation_results_hash.values.each do |aggregate_target_installation_result|
250
- aggregate_target = aggregate_target_installation_result.target
251
- aggregate_native_target = aggregate_target_installation_result.native_target
252
- is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
253
- [:app_extension, :watch_extension, :watch2_extension, :tv_extension, :messages_extension]).empty?
254
- is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }
255
- configure_app_extension_api_only_to_native_target(aggregate_native_target) if is_app_extension
256
- # Wire up dependencies that are part of inherit search paths for this aggregate target.
257
- aggregate_target.search_paths_aggregate_targets.each do |search_paths_target|
258
- aggregate_native_target.add_dependency(aggregate_target_installation_results_hash[search_paths_target.name].native_target)
259
- end
260
- # Wire up all pod target dependencies to aggregate target.
261
- aggregate_target.pod_targets.each do |pod_target|
262
- pod_target_native_target = pod_target_installation_results_hash[pod_target.name].native_target
263
- aggregate_native_target.add_dependency(pod_target_native_target)
264
- configure_app_extension_api_only_to_native_target(pod_target_native_target) if is_app_extension
265
- end
266
- end
185
+ AggregateTargetDependencyInstaller.new(aggregate_target_installation_results_hash,
186
+ pod_target_installation_results_hash, metadata_cache).install!
267
187
 
268
- # Wire up pod targets
269
- pod_target_installation_results_hash.values.each do |pod_target_installation_result|
270
- pod_target = pod_target_installation_result.target
271
- native_target = pod_target_installation_result.native_target
272
- # First, wire up all resource bundles.
273
- pod_target_installation_result.resource_bundle_targets.each do |resource_bundle_target|
274
- native_target.add_dependency(resource_bundle_target)
275
- if pod_target.requires_frameworks? && pod_target.should_build?
276
- native_target.add_resources([resource_bundle_target.product_reference])
277
- end
278
- end
279
- # Wire up all dependencies to this pod target, if any.
280
- dependent_targets = pod_target.dependent_targets
281
- dependent_targets.each do |dependent_target|
282
- native_target.add_dependency(pod_target_installation_results_hash[dependent_target.name].native_target)
283
- add_framework_file_reference_to_native_target(native_target, pod_target, dependent_target, frameworks_group)
284
- end
285
- # Wire up test native targets.
286
- unless pod_target_installation_result.test_native_targets.empty?
287
- pod_target_installation_result.test_specs_by_native_target.each do |test_native_target, test_specs|
288
- test_dependent_targets = test_specs.flat_map { |s| pod_target.test_dependent_targets_by_spec_name[s.name] }.compact.unshift(pod_target).uniq
289
- test_dependent_targets.each do |test_dependent_target|
290
- dependency_installation_result = pod_target_installation_results_hash[test_dependent_target.name]
291
- resource_bundle_native_targets = dependency_installation_result.test_resource_bundle_targets[test_specs.first.name]
292
- unless resource_bundle_native_targets.nil?
293
- resource_bundle_native_targets.each do |test_resource_bundle_target|
294
- test_native_target.add_dependency(test_resource_bundle_target)
295
- end
296
- end
297
- test_native_target.add_dependency(dependency_installation_result.native_target)
298
- add_framework_file_reference_to_native_target(test_native_target, pod_target, test_dependent_target, frameworks_group)
299
- end
300
- end
301
- end
302
- end
188
+ PodTargetDependencyInstaller.new(pod_target_installation_results_hash, metadata_cache).install!
303
189
  end
304
190
 
305
191
  # @param [String] pod The root name of the development pod.
@@ -320,15 +206,6 @@ module Pod
320
206
  end
321
207
  end
322
208
 
323
- # @return [Array<Library>] The targets of the development pods generated by
324
- # the installation process.
325
- #
326
- def development_pod_targets
327
- pod_targets.select do |pod_target|
328
- sandbox.local?(pod_target.pod_name)
329
- end
330
- end
331
-
332
209
  #------------------------------------------------------------------------#
333
210
 
334
211
  # @! group Private Helpers
@@ -339,20 +216,27 @@ module Pod
339
216
  end
340
217
  end
341
218
 
342
- def add_framework_file_reference_to_native_target(native_target, pod_target, dependent_target, frameworks_group)
343
- if pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework? && dependent_target.should_build?
344
- product_ref = frameworks_group.files.find { |f| f.path == dependent_target.product_name } ||
345
- frameworks_group.new_product_ref_for_target(dependent_target.product_basename, dependent_target.product_type)
346
- native_target.frameworks_build_phase.add_file_reference(product_ref, true)
347
- end
348
- end
349
-
350
- # Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
351
- # configurations of the given native target.
352
- #
353
- def configure_app_extension_api_only_to_native_target(native_target)
354
- native_target.build_configurations.each do |config|
355
- config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
219
+ def configure_schemes_for_pod_target(project, pod_target)
220
+ specs = [pod_target.root_spec] + pod_target.test_specs + pod_target.app_specs
221
+ specs.each do |spec|
222
+ scheme_name = spec.spec_type == :library ? pod_target.label : pod_target.non_library_spec_label(spec)
223
+ scheme_configuration = pod_target.scheme_for_spec(spec)
224
+ unless scheme_configuration.empty?
225
+ scheme_path = Xcodeproj::XCScheme.user_data_dir(project.path) + "#{scheme_name}.xcscheme"
226
+ scheme = Xcodeproj::XCScheme.new(scheme_path)
227
+ command_line_arguments = scheme.launch_action.command_line_arguments
228
+ scheme_configuration.fetch(:launch_arguments, []).each do |launch_arg|
229
+ command_line_arguments.assign_argument(:argument => launch_arg, :enabled => true)
230
+ end
231
+ scheme.launch_action.command_line_arguments = command_line_arguments
232
+ environment_variables = scheme.launch_action.environment_variables
233
+ scheme_configuration.fetch(:environment_variables, {}).each do |k, v|
234
+ environment_variables.assign_variable(:key => k, :value => v)
235
+ end
236
+ scheme.launch_action.environment_variables = environment_variables
237
+ scheme.save!
238
+ end
239
+ Xcodeproj::XCScheme.share_scheme(project.path, scheme_name)
356
240
  end
357
241
  end
358
242
  end