cocoapods-dykit 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pod/command.rb +2 -0
- data/lib/pod/command/dyinstall.rb +51 -0
- data/lib/pod/command/dyupdate.rb +106 -0
- data/lib/pod/command/fmwk.rb +4 -0
- data/lib/pod/command/lib/dylint.rb +1 -0
- data/lib/pod/gem_version.rb +1 -1
- data/lib/pod/installer.rb +715 -0
- data/lib/pod/installer/analyzer.rb +934 -0
- data/lib/pod/installer/analyzer/analysis_result.rb +57 -0
- data/lib/pod/installer/analyzer/locking_dependency_analyzer.rb +95 -0
- data/lib/pod/installer/analyzer/pod_variant.rb +68 -0
- data/lib/pod/installer/analyzer/pod_variant_set.rb +157 -0
- data/lib/pod/installer/analyzer/podfile_dependency_cache.rb +54 -0
- data/lib/pod/installer/analyzer/sandbox_analyzer.rb +251 -0
- data/lib/pod/installer/analyzer/specs_state.rb +84 -0
- data/lib/pod/installer/analyzer/target_inspection_result.rb +45 -0
- data/lib/pod/installer/analyzer/target_inspector.rb +254 -0
- data/lib/pod/installer/installation_options.rb +158 -0
- data/lib/pod/installer/pod_source_installer.rb +214 -0
- data/lib/pod/installer/pod_source_preparer.rb +77 -0
- data/lib/pod/installer/podfile_validator.rb +139 -0
- data/lib/pod/installer/post_install_hooks_context.rb +107 -0
- data/lib/pod/installer/pre_install_hooks_context.rb +42 -0
- data/lib/pod/installer/source_provider_hooks_context.rb +32 -0
- data/lib/pod/installer/user_project_integrator.rb +253 -0
- data/lib/pod/installer/user_project_integrator/target_integrator.rb +462 -0
- data/lib/pod/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +146 -0
- data/lib/pod/installer/xcode.rb +8 -0
- data/lib/pod/installer/xcode/pods_project_generator.rb +353 -0
- data/lib/pod/installer/xcode/pods_project_generator/aggregate_target_installer.rb +172 -0
- data/lib/pod/installer/xcode/pods_project_generator/file_references_installer.rb +367 -0
- data/lib/pod/installer/xcode/pods_project_generator/pod_target_installer.rb +718 -0
- data/lib/pod/installer/xcode/pods_project_generator/pod_target_integrator.rb +111 -0
- data/lib/pod/installer/xcode/pods_project_generator/target_installer.rb +265 -0
- data/lib/pod/installer/xcode/target_validator.rb +141 -0
- data/lib/pod/resolver.rb +632 -0
- metadata +34 -2
@@ -0,0 +1,146 @@
|
|
1
|
+
module Pod
|
2
|
+
class DyInstaller
|
3
|
+
class UserProjectIntegrator
|
4
|
+
class TargetIntegrator
|
5
|
+
# Configures an user target to use the CocoaPods xcconfigs which allow
|
6
|
+
# lo link against the Pods.
|
7
|
+
#
|
8
|
+
class XCConfigIntegrator
|
9
|
+
# Integrates the user target.
|
10
|
+
#
|
11
|
+
# @param [Target::AggregateTarget] pod_bundle
|
12
|
+
# The Pods bundle.
|
13
|
+
#
|
14
|
+
# @param [Array<PBXNativeTarget>] targets
|
15
|
+
# The native targets associated which should be integrated
|
16
|
+
# with the Pod bundle.
|
17
|
+
#
|
18
|
+
def self.integrate(pod_bundle, targets)
|
19
|
+
targets.each do |target|
|
20
|
+
target.build_configurations.each do |config|
|
21
|
+
set_target_xcconfig(pod_bundle, target, config)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# @!group Integration steps
|
29
|
+
#-------------------------------------------------------------------#
|
30
|
+
|
31
|
+
# Creates a file reference to the xcconfig generated by
|
32
|
+
# CocoaPods (if needed) and sets it as the base configuration of
|
33
|
+
# build configuration of the user target.
|
34
|
+
#
|
35
|
+
# @param [Target::AggregateTarget] pod_bundle
|
36
|
+
# The Pods bundle.
|
37
|
+
#
|
38
|
+
# @param [PBXNativeTarget] target
|
39
|
+
# The native target.
|
40
|
+
#
|
41
|
+
# @param [Xcodeproj::XCBuildConfiguration] config
|
42
|
+
# The build configuration.
|
43
|
+
#
|
44
|
+
def self.set_target_xcconfig(pod_bundle, target, config)
|
45
|
+
path = pod_bundle.xcconfig_relative_path(config.name)
|
46
|
+
group = config.project['Pods'] || config.project.new_group('Pods')
|
47
|
+
file_ref = group.files.find { |f| f.path == path }
|
48
|
+
existing = config.base_configuration_reference
|
49
|
+
|
50
|
+
set_base_configuration_reference = ->() do
|
51
|
+
file_ref ||= group.new_file(path)
|
52
|
+
config.base_configuration_reference = file_ref
|
53
|
+
end
|
54
|
+
|
55
|
+
if existing && existing != file_ref
|
56
|
+
if existing.real_path.to_path.start_with?(pod_bundle.sandbox.root.to_path << '/')
|
57
|
+
set_base_configuration_reference.call
|
58
|
+
elsif !xcconfig_includes_target_xcconfig?(config.base_configuration_reference, path)
|
59
|
+
unless existing_config_is_identical_to_pod_config?(existing.real_path, pod_bundle.xcconfig_path(config.name))
|
60
|
+
UI.warn 'CocoaPods did not set the base configuration of your ' \
|
61
|
+
'project because your project already has a custom ' \
|
62
|
+
'config set. In order for CocoaPods integration to work at ' \
|
63
|
+
'all, please either set the base configurations of the target ' \
|
64
|
+
"`#{target.name}` to `#{path}` or include the `#{path}` in your " \
|
65
|
+
"build configuration (#{UI.path(existing.real_path)})."
|
66
|
+
end
|
67
|
+
end
|
68
|
+
elsif config.base_configuration_reference.nil? || file_ref.nil?
|
69
|
+
set_base_configuration_reference.call
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
# @!group Private helpers
|
76
|
+
#-------------------------------------------------------------------#
|
77
|
+
|
78
|
+
# Prints a warning informing the user that a build configuration of
|
79
|
+
# the integrated target is overriding the CocoaPods build settings.
|
80
|
+
#
|
81
|
+
# @param [Target::AggregateTarget] pod_bundle
|
82
|
+
# The Pods bundle.
|
83
|
+
#
|
84
|
+
# @param [XcodeProj::PBXNativeTarget] target
|
85
|
+
# The native target.
|
86
|
+
#
|
87
|
+
# @param [Xcodeproj::XCBuildConfiguration] config
|
88
|
+
# The build configuration.
|
89
|
+
#
|
90
|
+
# @param [String] key
|
91
|
+
# The key of the overridden build setting.
|
92
|
+
#
|
93
|
+
def self.print_override_warning(pod_bundle, target, config, key)
|
94
|
+
actions = [
|
95
|
+
'Use the `$(inherited)` flag, or',
|
96
|
+
'Remove the build settings from the target.',
|
97
|
+
]
|
98
|
+
message = "The `#{target.name} [#{config.name}]` " \
|
99
|
+
"target overrides the `#{key}` build setting defined in " \
|
100
|
+
"`#{pod_bundle.xcconfig_relative_path(config.name)}'. " \
|
101
|
+
'This can lead to problems with the CocoaPods installation'
|
102
|
+
UI.warn(message, actions)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Naively checks to see if a given PBXFileReference imports a given
|
106
|
+
# path.
|
107
|
+
#
|
108
|
+
# @param [PBXFileReference] base_config_ref
|
109
|
+
# A file reference to an `.xcconfig` file.
|
110
|
+
#
|
111
|
+
# @param [String] target_config_path
|
112
|
+
# The path to check for.
|
113
|
+
#
|
114
|
+
SILENCE_WARNINGS_STRING = '// @COCOAPODS_SILENCE_WARNINGS@ //'
|
115
|
+
def self.xcconfig_includes_target_xcconfig?(base_config_ref, target_config_path)
|
116
|
+
return unless base_config_ref && base_config_ref.real_path.file?
|
117
|
+
regex = %r{
|
118
|
+
^(
|
119
|
+
(\s* # Possible, but unlikely, space before include statement
|
120
|
+
\#include\s+ # Include statement
|
121
|
+
['"] # Open quote
|
122
|
+
(.*\/)? # Possible prefix to path
|
123
|
+
#{Regexp.quote(target_config_path)} # The path should end in the target_config_path
|
124
|
+
['"] # Close quote
|
125
|
+
)
|
126
|
+
|
|
127
|
+
(#{Regexp.quote(SILENCE_WARNINGS_STRING)}) # Token to treat xcconfig as good and silence pod install warnings
|
128
|
+
)
|
129
|
+
}x
|
130
|
+
base_config_ref.real_path.readlines.find { |line| line =~ regex }
|
131
|
+
end
|
132
|
+
|
133
|
+
# Checks to see if the config files at two paths exist and are identical
|
134
|
+
#
|
135
|
+
# @param The existing config path
|
136
|
+
#
|
137
|
+
# @param The pod config path
|
138
|
+
#
|
139
|
+
def self.existing_config_is_identical_to_pod_config?(existing_config_path, pod_config_path)
|
140
|
+
existing_config_path.file? && (!pod_config_path.file? || FileUtils.compare_file(existing_config_path, pod_config_path))
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,353 @@
|
|
1
|
+
module Pod
|
2
|
+
class DyInstaller
|
3
|
+
class Xcode
|
4
|
+
# The {PodsProjectGenerator} handles generation of the 'Pods/Pods.xcodeproj'
|
5
|
+
#
|
6
|
+
class PodsProjectGenerator
|
7
|
+
require File.expand_path('../pods_project_generator/pod_target_integrator', __FILE__)
|
8
|
+
require File.expand_path('../pods_project_generator/target_installer', __FILE__)
|
9
|
+
require File.expand_path('../pods_project_generator/pod_target_installer', __FILE__)
|
10
|
+
require File.expand_path('../pods_project_generator/file_references_installer', __FILE__)
|
11
|
+
require File.expand_path('../pods_project_generator/aggregate_target_installer', __FILE__)
|
12
|
+
|
13
|
+
# @return [Pod::Project] the `Pods/Pods.xcodeproj` project.
|
14
|
+
#
|
15
|
+
attr_reader :project
|
16
|
+
|
17
|
+
# @return [Array<AggregateTarget>] The model representations of an
|
18
|
+
# aggregation of pod targets generated for a target definition
|
19
|
+
# in the Podfile.
|
20
|
+
#
|
21
|
+
attr_reader :aggregate_targets
|
22
|
+
|
23
|
+
# @return [Sandbox] The sandbox where the Pods should be installed.
|
24
|
+
#
|
25
|
+
attr_reader :sandbox
|
26
|
+
|
27
|
+
# @return [Array<PodTarget>] The model representations of pod targets.
|
28
|
+
#
|
29
|
+
attr_reader :pod_targets
|
30
|
+
|
31
|
+
# @return [Analyzer] the analyzer which provides the information about what
|
32
|
+
# needs to be installed.
|
33
|
+
#
|
34
|
+
attr_reader :analysis_result
|
35
|
+
|
36
|
+
# @return [InstallationOptions] the installation options from the Podfile.
|
37
|
+
#
|
38
|
+
attr_reader :installation_options
|
39
|
+
|
40
|
+
# @return [Config] the global CocoaPods configuration.
|
41
|
+
#
|
42
|
+
attr_reader :config
|
43
|
+
|
44
|
+
# Initialize a new instance
|
45
|
+
#
|
46
|
+
# @param [Array<AggregateTarget>] aggregate_targets @see aggregate_targets
|
47
|
+
# @param [Sandbox] sandbox @see sandbox
|
48
|
+
# @param [Array<PodTarget>] pod_targets @see pod_targets
|
49
|
+
# @param [Analyzer] analysis_result @see analysis_result
|
50
|
+
# @param [InstallationOptions] installation_options @see installation_options
|
51
|
+
# @param [Config] config @see config
|
52
|
+
#
|
53
|
+
def initialize(aggregate_targets, sandbox, pod_targets, analysis_result, installation_options, config)
|
54
|
+
@aggregate_targets = aggregate_targets
|
55
|
+
@sandbox = sandbox
|
56
|
+
@pod_targets = pod_targets
|
57
|
+
@analysis_result = analysis_result
|
58
|
+
@installation_options = installation_options
|
59
|
+
@config = config
|
60
|
+
end
|
61
|
+
|
62
|
+
def generate!
|
63
|
+
prepare
|
64
|
+
install_file_references
|
65
|
+
install_libraries
|
66
|
+
integrate_targets
|
67
|
+
set_target_dependencies
|
68
|
+
end
|
69
|
+
|
70
|
+
def write
|
71
|
+
UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
|
72
|
+
project.pods.remove_from_project if project.pods.empty?
|
73
|
+
project.development_pods.remove_from_project if project.development_pods.empty?
|
74
|
+
project.sort(:groups_position => :below)
|
75
|
+
if installation_options.deterministic_uuids?
|
76
|
+
UI.message('- Generating deterministic UUIDs') { project.predictabilize_uuids }
|
77
|
+
end
|
78
|
+
library_product_types = [:framework, :dynamic_library, :static_library]
|
79
|
+
project.recreate_user_schemes(false) do |scheme, target|
|
80
|
+
next unless library_product_types.include? target.symbol_type
|
81
|
+
pod_target = pod_targets.find { |pt| pt.native_target == target }
|
82
|
+
next if pod_target.nil? || pod_target.test_native_targets.empty?
|
83
|
+
pod_target.test_native_targets.each { |test_native_target| scheme.add_test_target(test_native_target) }
|
84
|
+
end
|
85
|
+
project.save
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Shares schemes of development Pods.
|
90
|
+
#
|
91
|
+
# @return [void]
|
92
|
+
#
|
93
|
+
def share_development_pod_schemes
|
94
|
+
development_pod_targets.select(&:should_build?).each do |pod_target|
|
95
|
+
next unless share_scheme_for_development_pod?(pod_target.pod_name)
|
96
|
+
Xcodeproj::XCScheme.share_scheme(project.path, pod_target.label)
|
97
|
+
if pod_target.contains_test_specifications?
|
98
|
+
pod_target.supported_test_types.each do |test_type|
|
99
|
+
Xcodeproj::XCScheme.share_scheme(project.path, pod_target.test_target_label(test_type))
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
def create_project
|
108
|
+
if object_version = aggregate_targets.map(&:user_project).compact.map { |p| p.object_version.to_i }.min
|
109
|
+
Pod::Project.new(sandbox.project_path, false, object_version)
|
110
|
+
else
|
111
|
+
Pod::Project.new(sandbox.project_path)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Creates the Pods project from scratch if it doesn't exists.
|
116
|
+
#
|
117
|
+
# @return [void]
|
118
|
+
#
|
119
|
+
# @todo Clean and modify the project if it exists.
|
120
|
+
#
|
121
|
+
def prepare
|
122
|
+
UI.message '- Creating Pods project' do
|
123
|
+
@project = create_project
|
124
|
+
analysis_result.all_user_build_configurations.each do |name, type|
|
125
|
+
@project.add_build_configuration(name, type)
|
126
|
+
end
|
127
|
+
# Reset symroot just in case the user has added a new build configuration other than 'Debug' or 'Release'.
|
128
|
+
@project.symroot = Pod::Project::LEGACY_BUILD_ROOT
|
129
|
+
|
130
|
+
pod_names = pod_targets.map(&:pod_name).uniq
|
131
|
+
pod_names.each do |pod_name|
|
132
|
+
local = sandbox.local?(pod_name)
|
133
|
+
path = sandbox.pod_dir(pod_name)
|
134
|
+
was_absolute = sandbox.local_path_was_absolute?(pod_name)
|
135
|
+
@project.add_pod_group(pod_name, path, local, was_absolute)
|
136
|
+
end
|
137
|
+
|
138
|
+
if config.podfile_path
|
139
|
+
@project.add_podfile(config.podfile_path)
|
140
|
+
end
|
141
|
+
|
142
|
+
sandbox.project = @project
|
143
|
+
platforms = aggregate_targets.map(&:platform)
|
144
|
+
osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
|
145
|
+
ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
|
146
|
+
watchos_deployment_target = platforms.select { |p| p.name == :watchos }.map(&:deployment_target).min
|
147
|
+
tvos_deployment_target = platforms.select { |p| p.name == :tvos }.map(&:deployment_target).min
|
148
|
+
@project.build_configurations.each do |build_configuration|
|
149
|
+
build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
|
150
|
+
build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
|
151
|
+
build_configuration.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = watchos_deployment_target.to_s if watchos_deployment_target
|
152
|
+
build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
|
153
|
+
build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
|
154
|
+
build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
|
155
|
+
build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
|
156
|
+
build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def install_file_references
|
162
|
+
installer = FileReferencesInstaller.new(sandbox, pod_targets, project)
|
163
|
+
installer.install!
|
164
|
+
end
|
165
|
+
|
166
|
+
def install_libraries
|
167
|
+
UI.message '- Installing targets' do
|
168
|
+
umbrella_headers_by_dir = pod_targets.map do |pod_target|
|
169
|
+
next unless pod_target.should_build? && pod_target.defines_module?
|
170
|
+
pod_target.umbrella_header_path
|
171
|
+
end.compact.group_by(&:dirname)
|
172
|
+
|
173
|
+
pod_targets.sort_by(&:name).each do |pod_target|
|
174
|
+
target_installer = PodTargetInstaller.new(sandbox, pod_target)
|
175
|
+
target_installer.umbrella_headers_by_dir = umbrella_headers_by_dir
|
176
|
+
target_installer.install!
|
177
|
+
end
|
178
|
+
|
179
|
+
aggregate_targets.sort_by(&:name).each do |target|
|
180
|
+
target_installer = AggregateTargetInstaller.new(sandbox, target)
|
181
|
+
target_installer.install!
|
182
|
+
end
|
183
|
+
|
184
|
+
add_system_framework_dependencies
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def integrate_targets
|
189
|
+
pod_targets_to_integrate = pod_targets.select { |pt| !pt.test_native_targets.empty? || pt.contains_script_phases? }
|
190
|
+
unless pod_targets_to_integrate.empty?
|
191
|
+
UI.message '- Integrating targets' do
|
192
|
+
pod_targets_to_integrate.each do |pod_target|
|
193
|
+
PodTargetIntegrator.new(pod_target).integrate!
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def add_system_framework_dependencies
|
200
|
+
# @TODO: Add Specs
|
201
|
+
pod_targets.select(&:should_build?).sort_by(&:name).each do |pod_target|
|
202
|
+
test_file_accessors, file_accessors = pod_target.file_accessors.partition { |fa| fa.spec.test_specification? }
|
203
|
+
file_accessors.each do |file_accessor|
|
204
|
+
add_system_frameworks_to_native_target(file_accessor, pod_target.native_target)
|
205
|
+
end
|
206
|
+
test_file_accessors.each do |test_file_accessor|
|
207
|
+
native_target = pod_target.native_target_for_spec(test_file_accessor.spec)
|
208
|
+
add_system_frameworks_to_native_target(test_file_accessor, native_target)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# Adds a target dependency for each pod spec to each aggregate target and
|
214
|
+
# links the pod targets among each other.
|
215
|
+
#
|
216
|
+
# @return [void]
|
217
|
+
#
|
218
|
+
def set_target_dependencies
|
219
|
+
frameworks_group = project.frameworks_group
|
220
|
+
test_only_pod_targets = pod_targets.dup
|
221
|
+
aggregate_targets.each do |aggregate_target|
|
222
|
+
is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
|
223
|
+
[:app_extension, :watch_extension, :watch2_extension, :tv_extension, :messages_extension]).empty?
|
224
|
+
is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }
|
225
|
+
|
226
|
+
aggregate_target.search_paths_aggregate_targets.each do |search_paths_target|
|
227
|
+
aggregate_target.native_target.add_dependency(search_paths_target.native_target)
|
228
|
+
end
|
229
|
+
|
230
|
+
aggregate_target.pod_targets.each do |pod_target|
|
231
|
+
test_only_pod_targets.delete(pod_target)
|
232
|
+
configure_app_extension_api_only_for_target(aggregate_target) if is_app_extension
|
233
|
+
|
234
|
+
unless pod_target.should_build?
|
235
|
+
add_resource_bundles_to_native_target(pod_target, aggregate_target.native_target)
|
236
|
+
add_pod_target_test_dependencies(pod_target, frameworks_group)
|
237
|
+
next
|
238
|
+
end
|
239
|
+
|
240
|
+
aggregate_target.native_target.add_dependency(pod_target.native_target)
|
241
|
+
configure_app_extension_api_only_for_target(pod_target) if is_app_extension
|
242
|
+
|
243
|
+
add_dependent_targets_to_native_target(pod_target.dependent_targets,
|
244
|
+
pod_target.native_target, is_app_extension,
|
245
|
+
pod_target.requires_frameworks? && !pod_target.static_framework?,
|
246
|
+
frameworks_group)
|
247
|
+
unless pod_target.static_framework?
|
248
|
+
add_pod_target_test_dependencies(pod_target, frameworks_group)
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
# Wire up remaining pod targets used only by tests and are not used by any aggregate target.
|
253
|
+
test_only_pod_targets.each do |pod_target|
|
254
|
+
unless pod_target.should_build?
|
255
|
+
add_pod_target_test_dependencies(pod_target, frameworks_group)
|
256
|
+
next
|
257
|
+
end
|
258
|
+
unless pod_target.static_framework?
|
259
|
+
add_dependent_targets_to_native_target(pod_target.dependent_targets,
|
260
|
+
pod_target.native_target, false,
|
261
|
+
pod_target.requires_frameworks?, frameworks_group)
|
262
|
+
add_pod_target_test_dependencies(pod_target, frameworks_group)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
# @param [String] pod The root name of the development pod.
|
268
|
+
#
|
269
|
+
# @return [Bool] whether the scheme for the given development pod should be
|
270
|
+
# shared.
|
271
|
+
#
|
272
|
+
def share_scheme_for_development_pod?(pod)
|
273
|
+
case dev_pods_to_share = installation_options.share_schemes_for_development_pods
|
274
|
+
when TrueClass, FalseClass, NilClass
|
275
|
+
dev_pods_to_share
|
276
|
+
when Array
|
277
|
+
dev_pods_to_share.any? { |dev_pod| dev_pod === pod } # rubocop:disable Style/CaseEquality
|
278
|
+
else
|
279
|
+
raise Informative, 'Unable to handle share_schemes_for_development_pods ' \
|
280
|
+
"being set to #{dev_pods_to_share.inspect} -- please set it to true, " \
|
281
|
+
'false, or an array of pods to share schemes for.'
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
# @return [Array<Library>] The targets of the development pods generated by
|
286
|
+
# the installation process.
|
287
|
+
#
|
288
|
+
def development_pod_targets
|
289
|
+
pod_targets.select do |pod_target|
|
290
|
+
sandbox.local?(pod_target.pod_name)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
#------------------------------------------------------------------------#
|
295
|
+
|
296
|
+
# @! group Private Helpers
|
297
|
+
|
298
|
+
private
|
299
|
+
|
300
|
+
def add_pod_target_test_dependencies(pod_target, frameworks_group)
|
301
|
+
test_dependent_targets = pod_target.all_dependent_targets
|
302
|
+
pod_target.test_specs_by_native_target.each do |test_native_target, test_specs|
|
303
|
+
test_dependent_targets.reject(&:should_build?).each do |test_dependent_target|
|
304
|
+
add_resource_bundles_to_native_target(test_dependent_target, test_native_target)
|
305
|
+
end
|
306
|
+
add_dependent_targets_to_native_target(test_dependent_targets, test_native_target, false, pod_target.requires_frameworks?, frameworks_group)
|
307
|
+
test_spec_consumers = test_specs.map { |test_spec| test_spec.consumer(pod_target.platform) }
|
308
|
+
if test_spec_consumers.any?(&:requires_app_host?)
|
309
|
+
app_host_target = project.targets.find { |t| t.name == pod_target.app_host_label(test_specs.first.test_type) }
|
310
|
+
test_native_target.add_dependency(app_host_target)
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
def add_dependent_targets_to_native_target(dependent_targets, native_target, is_app_extension, requires_frameworks, frameworks_group)
|
316
|
+
dependent_targets.each do |pod_dependency_target|
|
317
|
+
next unless pod_dependency_target.should_build?
|
318
|
+
native_target.add_dependency(pod_dependency_target.native_target)
|
319
|
+
configure_app_extension_api_only_for_target(pod_dependency_target) if is_app_extension
|
320
|
+
|
321
|
+
if requires_frameworks
|
322
|
+
product_ref = frameworks_group.files.find { |f| f.path == pod_dependency_target.product_name } ||
|
323
|
+
frameworks_group.new_product_ref_for_target(pod_dependency_target.product_basename, pod_dependency_target.product_type)
|
324
|
+
native_target.frameworks_build_phase.add_file_reference(product_ref, true)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
def add_system_frameworks_to_native_target(file_accessor, native_target)
|
330
|
+
file_accessor.spec_consumer.frameworks.each do |framework|
|
331
|
+
native_target.add_system_framework(framework)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
def add_resource_bundles_to_native_target(dependent_target, native_target)
|
336
|
+
resource_bundle_targets = dependent_target.resource_bundle_targets + dependent_target.test_resource_bundle_targets
|
337
|
+
resource_bundle_targets.each do |resource_bundle_target|
|
338
|
+
native_target.add_dependency(resource_bundle_target)
|
339
|
+
end
|
340
|
+
end
|
341
|
+
|
342
|
+
# Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
|
343
|
+
# configurations of the given target
|
344
|
+
#
|
345
|
+
def configure_app_extension_api_only_for_target(target)
|
346
|
+
target.native_target.build_configurations.each do |config|
|
347
|
+
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|