cocoapods 1.0.1 → 1.1.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +107 -0
- data/lib/cocoapods/command.rb +1 -0
- data/lib/cocoapods/command/repo/push.rb +26 -5
- data/lib/cocoapods/command/setup.rb +2 -1
- data/lib/cocoapods/downloader.rb +20 -0
- data/lib/cocoapods/downloader/cache.rb +1 -0
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/acknowledgements/plist.rb +1 -0
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +9 -2
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +5 -4
- data/lib/cocoapods/installer.rb +41 -205
- data/lib/cocoapods/installer/analyzer.rb +65 -1
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +9 -3
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +24 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +23 -6
- data/lib/cocoapods/installer/xcode.rb +7 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +265 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +202 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +314 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +397 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +214 -0
- data/lib/cocoapods/resolver.rb +1 -2
- data/lib/cocoapods/target/aggregate_target.rb +19 -0
- data/lib/cocoapods/target/pod_target.rb +15 -2
- data/lib/cocoapods/user_interface.rb +6 -1
- data/lib/cocoapods/user_interface/error_report.rb +7 -0
- data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
- data/lib/cocoapods/validator.rb +15 -7
- metadata +42 -19
- data/lib/cocoapods/installer/file_references_installer.rb +0 -310
- data/lib/cocoapods/installer/target_installer.rb +0 -210
- data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +0 -191
- data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +0 -389
@@ -226,6 +226,61 @@ module Pod
|
|
226
226
|
|
227
227
|
private
|
228
228
|
|
229
|
+
# Copies the pod_targets of any of the app embedded aggregate targets into
|
230
|
+
# their potential host aggregate target, if that potential host aggregate target's
|
231
|
+
# user_target hosts any of the app embedded aggregate targets' user_targets
|
232
|
+
#
|
233
|
+
# @param [AggregateTarget] aggregate_target the aggregate target whose user_target
|
234
|
+
# might host one or more of the embedded aggregate targets' user_targets
|
235
|
+
#
|
236
|
+
# @param [Array<AggregateTarget>] embedded_aggregate_targets the aggregate targets
|
237
|
+
# representing the embedded targets to be integrated
|
238
|
+
#
|
239
|
+
def copy_embedded_target_pod_targets_to_host(aggregate_target, embedded_aggregate_targets)
|
240
|
+
return if aggregate_target.requires_host_target?
|
241
|
+
# Get the uuids of the aggregate_target's user_targets' embedded targets if any
|
242
|
+
embedded_uuids = Set.new(aggregate_target.user_targets.map do |target|
|
243
|
+
aggregate_target.user_project.embedded_targets_in_native_target(target).map(&:uuid)
|
244
|
+
end.flatten)
|
245
|
+
return if embedded_uuids.empty?
|
246
|
+
embedded_aggregate_targets.each do |embedded_target|
|
247
|
+
next unless embedded_target.user_targets.map(&:uuid).any? do |embedded_uuid|
|
248
|
+
embedded_uuids.include? embedded_uuid
|
249
|
+
end
|
250
|
+
raise Informative, "#{aggregate_target.name} must call use_frameworks! because it is hosting an embedded target that calls use_frameworks!." unless aggregate_target.requires_frameworks?
|
251
|
+
pod_target_names = aggregate_target.pod_targets.map(&:name)
|
252
|
+
# This embedded target is hosted by the aggregate target's user_target; copy over the non-duplicate pod_targets
|
253
|
+
aggregate_target.pod_targets = aggregate_target.pod_targets + embedded_target.pod_targets.select do |pod_target|
|
254
|
+
!pod_target_names.include? pod_target.name
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# Raises an error if there are embedded targets in the Podfile, but
|
260
|
+
# their host targets have not been declared in the Podfile
|
261
|
+
#
|
262
|
+
# @param [Array<AggregateTarget>] aggregate_targets the generated
|
263
|
+
# aggregate targets
|
264
|
+
#
|
265
|
+
# @param [Array<AggregateTarget>] embedded_aggregate_targets the aggregate targets
|
266
|
+
# representing the embedded targets to be integrated
|
267
|
+
#
|
268
|
+
def verify_host_targets_in_podfile(aggregate_targets, embedded_aggregate_targets)
|
269
|
+
aggregate_target_uuids = Set.new aggregate_targets.map(&:user_targets).flatten.map(&:uuid)
|
270
|
+
embedded_targets_missing_hosts = []
|
271
|
+
embedded_aggregate_targets.each do |target|
|
272
|
+
host_uuids = target.user_targets.map do |user_target|
|
273
|
+
target.user_project.host_targets_for_embedded_target(user_target).map(&:uuid)
|
274
|
+
end.flatten
|
275
|
+
embedded_targets_missing_hosts << target unless host_uuids.any? do |uuid|
|
276
|
+
aggregate_target_uuids.include? uuid
|
277
|
+
end
|
278
|
+
end
|
279
|
+
unless embedded_targets_missing_hosts.empty?
|
280
|
+
raise Informative, "Unable to find host target for #{embedded_targets_missing_hosts.map(&:name).join(', ')}. Please add the host targets for the embedded targets to the Podfile."
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
229
284
|
# Creates the models that represent the targets generated by CocoaPods.
|
230
285
|
#
|
231
286
|
# @return [Array<AggregateTarget>]
|
@@ -236,6 +291,14 @@ module Pod
|
|
236
291
|
aggregate_targets = specs_by_target.keys.map do |target_definition|
|
237
292
|
generate_target(target_definition, pod_targets)
|
238
293
|
end
|
294
|
+
if installation_options.integrate_targets?
|
295
|
+
# Copy embedded target pods that cannot have their pods embedded as frameworks to their host targets
|
296
|
+
embedded_targets = aggregate_targets.select(&:requires_host_target?).select(&:requires_frameworks?)
|
297
|
+
verify_host_targets_in_podfile(aggregate_targets, embedded_targets)
|
298
|
+
aggregate_targets.each do |target|
|
299
|
+
copy_embedded_target_pod_targets_to_host(target, embedded_targets)
|
300
|
+
end
|
301
|
+
end
|
239
302
|
aggregate_targets.each do |target|
|
240
303
|
target.search_paths_aggregate_targets = aggregate_targets.select do |aggregate_target|
|
241
304
|
target.target_definition.targets_to_inherit_search_paths.include?(aggregate_target.target_definition)
|
@@ -277,6 +340,7 @@ module Pod
|
|
277
340
|
target.pod_targets = pod_targets.select do |pod_target|
|
278
341
|
pod_target.target_definitions.include?(target_definition)
|
279
342
|
end
|
343
|
+
|
280
344
|
target
|
281
345
|
end
|
282
346
|
|
@@ -294,7 +358,7 @@ module Pod
|
|
294
358
|
distinct_targets = specs_by_target.each_with_object({}) do |dependency, hash|
|
295
359
|
target_definition, dependent_specs = *dependency
|
296
360
|
dependent_specs.group_by(&:root).each do |root_spec, specs|
|
297
|
-
pod_variant = PodVariant.new(specs, target_definition.platform, target_definition.uses_frameworks
|
361
|
+
pod_variant = PodVariant.new(specs, target_definition.platform, target_definition.uses_frameworks?, target_definition.swift_version)
|
298
362
|
hash[root_spec] ||= {}
|
299
363
|
(hash[root_spec][pod_variant] ||= []) << target_definition
|
300
364
|
end
|
@@ -16,6 +16,10 @@ module Pod
|
|
16
16
|
attr_accessor :requires_frameworks
|
17
17
|
alias_method :requires_frameworks?, :requires_frameworks
|
18
18
|
|
19
|
+
# @return [String] the Swift version
|
20
|
+
#
|
21
|
+
attr_accessor :swift_version
|
22
|
+
|
19
23
|
# @return [Specification] the root specification
|
20
24
|
#
|
21
25
|
def root_spec
|
@@ -28,10 +32,11 @@ module Pod
|
|
28
32
|
# @param [Platform] platform @see #platform
|
29
33
|
# @param [Bool] requires_frameworks @see #requires_frameworks?
|
30
34
|
#
|
31
|
-
def initialize(specs, platform, requires_frameworks = false)
|
35
|
+
def initialize(specs, platform, requires_frameworks = false, swift_version = nil)
|
32
36
|
self.specs = specs
|
33
37
|
self.platform = platform
|
34
38
|
self.requires_frameworks = requires_frameworks
|
39
|
+
self.swift_version = swift_version
|
35
40
|
end
|
36
41
|
|
37
42
|
# @return [Bool] whether the {PodVariant} is equal to another taking all
|
@@ -41,7 +46,8 @@ module Pod
|
|
41
46
|
self.class == other.class &&
|
42
47
|
specs == other.specs &&
|
43
48
|
platform == other.platform &&
|
44
|
-
requires_frameworks == other.requires_frameworks
|
49
|
+
requires_frameworks == other.requires_frameworks &&
|
50
|
+
swift_version == other.swift_version
|
45
51
|
end
|
46
52
|
alias_method :eql?, :==
|
47
53
|
|
@@ -51,7 +57,7 @@ module Pod
|
|
51
57
|
#
|
52
58
|
# @!visibility private
|
53
59
|
def hash
|
54
|
-
[specs, platform, requires_frameworks].hash
|
60
|
+
[specs, platform, requires_frameworks, swift_version].hash
|
55
61
|
end
|
56
62
|
end
|
57
63
|
end
|
@@ -44,6 +44,7 @@ module Pod
|
|
44
44
|
result.platform = compute_platform(targets)
|
45
45
|
result.archs = compute_archs(targets)
|
46
46
|
result.project = user_project
|
47
|
+
result.target_definition.swift_version = compute_swift_version_from_targets(targets)
|
47
48
|
result
|
48
49
|
end
|
49
50
|
|
@@ -205,6 +206,29 @@ module Pod
|
|
205
206
|
end
|
206
207
|
end
|
207
208
|
end
|
209
|
+
|
210
|
+
# Compute the Swift version for the target build configurations. If more
|
211
|
+
# than one Swift version is defined for a given target, then it will raise.
|
212
|
+
#
|
213
|
+
# @param [Array<PBXNativeTarget>] targets
|
214
|
+
# the targets that are checked for Swift versions.
|
215
|
+
#
|
216
|
+
# @return [String] the targets Swift version or nil
|
217
|
+
#
|
218
|
+
def compute_swift_version_from_targets(targets)
|
219
|
+
versions = targets.flat_map(&:build_configurations).
|
220
|
+
flat_map { |config| config.build_settings['SWIFT_VERSION'] }.
|
221
|
+
compact.
|
222
|
+
uniq
|
223
|
+
case versions.count
|
224
|
+
when 0
|
225
|
+
nil
|
226
|
+
when 1
|
227
|
+
versions.first
|
228
|
+
else
|
229
|
+
raise Informative, 'There may only be up to 1 unique SWIFT_VERSION per target.'
|
230
|
+
end
|
231
|
+
end
|
208
232
|
end
|
209
233
|
end
|
210
234
|
end
|
@@ -20,7 +20,10 @@ module Pod
|
|
20
20
|
# @return [Array<Symbol>] the symbol types, which require that the pod
|
21
21
|
# frameworks are embedded in the output directory / product bundle.
|
22
22
|
#
|
23
|
-
|
23
|
+
# @note This does not include :app_extension or :watch_extension because
|
24
|
+
# these types must have their frameworks embedded in their host targets
|
25
|
+
#
|
26
|
+
EMBED_FRAMEWORK_TARGET_TYPES = [:application, :unit_test_bundle, :ui_test_bundle, :watch2_extension].freeze
|
24
27
|
|
25
28
|
# @return [String] the name of the embed frameworks phase
|
26
29
|
#
|
@@ -54,6 +57,7 @@ module Pod
|
|
54
57
|
|
55
58
|
add_pods_library
|
56
59
|
add_embed_frameworks_script_phase
|
60
|
+
remove_embed_frameworks_script_phase_from_embedded_targets
|
57
61
|
add_copy_resources_script_phase
|
58
62
|
add_check_manifest_lock_script_phase
|
59
63
|
end
|
@@ -110,6 +114,20 @@ module Pod
|
|
110
114
|
end
|
111
115
|
end
|
112
116
|
|
117
|
+
# Removes the embed frameworks build phase from embedded targets
|
118
|
+
#
|
119
|
+
# @note Older versions of CocoaPods would add this build phase to embedded
|
120
|
+
# targets. They should be removed on upgrade because embedded targets
|
121
|
+
# will have their frameworks embedded in their host targets.
|
122
|
+
#
|
123
|
+
def remove_embed_frameworks_script_phase_from_embedded_targets
|
124
|
+
native_targets.each do |native_target|
|
125
|
+
if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type
|
126
|
+
remove_embed_frameworks_script_phase(native_target)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
113
131
|
def add_embed_frameworks_script_phase_to_target(native_target)
|
114
132
|
phase = create_or_update_build_phase(native_target, EMBED_FRAMEWORK_PHASE_NAME)
|
115
133
|
script_path = target.embed_frameworks_script_relative_path
|
@@ -121,7 +139,7 @@ module Pod
|
|
121
139
|
# @param [PBXNativeTarget] native_target
|
122
140
|
#
|
123
141
|
def remove_embed_frameworks_script_phase(native_target)
|
124
|
-
embed_build_phase = native_target.shell_script_build_phases.find { |bp| bp.name
|
142
|
+
embed_build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(EMBED_FRAMEWORK_PHASE_NAME) }
|
125
143
|
return unless embed_build_phase.present?
|
126
144
|
native_target.build_phases.delete(embed_build_phase)
|
127
145
|
end
|
@@ -157,10 +175,9 @@ module Pod
|
|
157
175
|
native_target.build_phases.unshift(phase).uniq! unless native_target.build_phases.first == phase
|
158
176
|
phase.shell_script = <<-SH.strip_heredoc
|
159
177
|
diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
|
160
|
-
if [
|
161
|
-
|
162
|
-
|
163
|
-
EOM
|
178
|
+
if [ $? != 0 ] ; then
|
179
|
+
# print error to STDERR
|
180
|
+
echo "error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation." >&2
|
164
181
|
exit 1
|
165
182
|
fi
|
166
183
|
SH
|
@@ -0,0 +1,265 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class Xcode
|
4
|
+
# The {PodsProjectGenerator} handles generation of the 'Pods/Pods.xcodeproj'
|
5
|
+
#
|
6
|
+
class PodsProjectGenerator
|
7
|
+
require 'cocoapods/installer/xcode/pods_project_generator/target_installer'
|
8
|
+
require 'cocoapods/installer/xcode/pods_project_generator/pod_target_installer'
|
9
|
+
require 'cocoapods/installer/xcode/pods_project_generator/file_references_installer'
|
10
|
+
require 'cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer'
|
11
|
+
|
12
|
+
# @return [Pod::Project] the `Pods/Pods.xcodeproj` project.
|
13
|
+
#
|
14
|
+
attr_reader :project
|
15
|
+
|
16
|
+
# @return [Array<AggregateTarget>] The model representations of an
|
17
|
+
# aggregation of pod targets generated for a target definition
|
18
|
+
# in the Podfile.
|
19
|
+
#
|
20
|
+
attr_reader :aggregate_targets
|
21
|
+
|
22
|
+
# @return [Sandbox] The sandbox where the Pods should be installed.
|
23
|
+
#
|
24
|
+
attr_reader :sandbox
|
25
|
+
|
26
|
+
# @return [Array<PodTarget>] The model representations of pod targets.
|
27
|
+
#
|
28
|
+
attr_reader :pod_targets
|
29
|
+
|
30
|
+
# @return [Analyzer] the analyzer which provides the information about what
|
31
|
+
# needs to be installed.
|
32
|
+
#
|
33
|
+
attr_reader :analysis_result
|
34
|
+
|
35
|
+
# @return [InstallationOptions] the installation options from the Podfile.
|
36
|
+
#
|
37
|
+
attr_reader :installation_options
|
38
|
+
|
39
|
+
# @return [Config] the global CocoaPods configuration.
|
40
|
+
#
|
41
|
+
attr_reader :config
|
42
|
+
|
43
|
+
# Initialize a new instance
|
44
|
+
#
|
45
|
+
# @param [Array<AggregateTarget>] aggregate_targets @see aggregate_targets
|
46
|
+
# @param [Sandbox] sandbox @see sandbox
|
47
|
+
# @param [Array<PodTarget>] pod_targets @see pod_targets
|
48
|
+
# @param [Analyzer] analysis_result @see analysis_result
|
49
|
+
# @param [InstallationOptions] installation_options @see installation_options
|
50
|
+
# @param [Config] config @see config
|
51
|
+
#
|
52
|
+
def initialize(aggregate_targets, sandbox, pod_targets, analysis_result, installation_options, config)
|
53
|
+
@aggregate_targets = aggregate_targets
|
54
|
+
@sandbox = sandbox
|
55
|
+
@pod_targets = pod_targets
|
56
|
+
@analysis_result = analysis_result
|
57
|
+
@installation_options = installation_options
|
58
|
+
@config = config
|
59
|
+
end
|
60
|
+
|
61
|
+
def generate!
|
62
|
+
prepare
|
63
|
+
install_file_references
|
64
|
+
install_libraries
|
65
|
+
set_target_dependencies
|
66
|
+
end
|
67
|
+
|
68
|
+
def write
|
69
|
+
UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
|
70
|
+
project.pods.remove_from_project if project.pods.empty?
|
71
|
+
project.development_pods.remove_from_project if project.development_pods.empty?
|
72
|
+
project.sort(:groups_position => :below)
|
73
|
+
if installation_options.deterministic_uuids?
|
74
|
+
UI.message('- Generating deterministic UUIDs') { project.predictabilize_uuids }
|
75
|
+
end
|
76
|
+
project.recreate_user_schemes(false)
|
77
|
+
project.save
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Shares schemes of development Pods.
|
82
|
+
#
|
83
|
+
# @return [void]
|
84
|
+
#
|
85
|
+
def share_development_pod_schemes
|
86
|
+
development_pod_targets.select(&:should_build?).each do |pod_target|
|
87
|
+
next unless share_scheme_for_development_pod?(pod_target.pod_name)
|
88
|
+
Xcodeproj::XCScheme.share_scheme(project.path, pod_target.label)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def create_project
|
95
|
+
if object_version = aggregate_targets.map(&:user_project).compact.map { |p| p.object_version.to_i }.min
|
96
|
+
Pod::Project.new(sandbox.project_path, false, object_version)
|
97
|
+
else
|
98
|
+
Pod::Project.new(sandbox.project_path)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Creates the Pods project from scratch if it doesn't exists.
|
103
|
+
#
|
104
|
+
# @return [void]
|
105
|
+
#
|
106
|
+
# @todo Clean and modify the project if it exists.
|
107
|
+
#
|
108
|
+
def prepare
|
109
|
+
UI.message '- Creating Pods project' do
|
110
|
+
@project = create_project
|
111
|
+
analysis_result.all_user_build_configurations.each do |name, type|
|
112
|
+
@project.add_build_configuration(name, type)
|
113
|
+
end
|
114
|
+
|
115
|
+
pod_names = pod_targets.map(&:pod_name).uniq
|
116
|
+
pod_names.each do |pod_name|
|
117
|
+
local = sandbox.local?(pod_name)
|
118
|
+
path = sandbox.pod_dir(pod_name)
|
119
|
+
was_absolute = sandbox.local_path_was_absolute?(pod_name)
|
120
|
+
@project.add_pod_group(pod_name, path, local, was_absolute)
|
121
|
+
end
|
122
|
+
|
123
|
+
if config.podfile_path
|
124
|
+
@project.add_podfile(config.podfile_path)
|
125
|
+
end
|
126
|
+
|
127
|
+
sandbox.project = @project
|
128
|
+
platforms = aggregate_targets.map(&:platform)
|
129
|
+
osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
|
130
|
+
ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
|
131
|
+
watchos_deployment_target = platforms.select { |p| p.name == :watchos }.map(&:deployment_target).min
|
132
|
+
tvos_deployment_target = platforms.select { |p| p.name == :tvos }.map(&:deployment_target).min
|
133
|
+
@project.build_configurations.each do |build_configuration|
|
134
|
+
build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
|
135
|
+
build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
|
136
|
+
build_configuration.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = watchos_deployment_target.to_s if watchos_deployment_target
|
137
|
+
build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
|
138
|
+
build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
|
139
|
+
build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
|
140
|
+
build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
|
141
|
+
build_configuration.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = 'NO_SIGNING/'
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def install_file_references
|
147
|
+
installer = FileReferencesInstaller.new(sandbox, pod_targets, project)
|
148
|
+
installer.install!
|
149
|
+
end
|
150
|
+
|
151
|
+
def install_libraries
|
152
|
+
UI.message '- Installing targets' do
|
153
|
+
pod_targets.sort_by(&:name).each do |pod_target|
|
154
|
+
target_installer = PodTargetInstaller.new(sandbox, pod_target)
|
155
|
+
target_installer.install!
|
156
|
+
end
|
157
|
+
|
158
|
+
aggregate_targets.sort_by(&:name).each do |target|
|
159
|
+
target_installer = AggregateTargetInstaller.new(sandbox, target)
|
160
|
+
target_installer.install!
|
161
|
+
end
|
162
|
+
|
163
|
+
add_system_framework_dependencies
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def add_system_framework_dependencies
|
168
|
+
# @TODO: Add Specs
|
169
|
+
pod_targets.sort_by(&:name).each do |pod_target|
|
170
|
+
pod_target.file_accessors.each do |file_accessor|
|
171
|
+
file_accessor.spec_consumer.frameworks.each do |framework|
|
172
|
+
if pod_target.should_build?
|
173
|
+
pod_target.native_target.add_system_framework(framework)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Adds a target dependency for each pod spec to each aggregate target and
|
181
|
+
# links the pod targets among each other.
|
182
|
+
#
|
183
|
+
# @return [void]
|
184
|
+
#
|
185
|
+
def set_target_dependencies
|
186
|
+
frameworks_group = project.frameworks_group
|
187
|
+
aggregate_targets.each do |aggregate_target|
|
188
|
+
is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
|
189
|
+
[:app_extension, :watch_extension, :watch2_extension, :tv_extension, :messages_extension]).empty?
|
190
|
+
is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }
|
191
|
+
|
192
|
+
aggregate_target.pod_targets.each do |pod_target|
|
193
|
+
configure_app_extension_api_only_for_target(aggregate_target) if is_app_extension
|
194
|
+
|
195
|
+
unless pod_target.should_build?
|
196
|
+
pod_target.resource_bundle_targets.each do |resource_bundle_target|
|
197
|
+
aggregate_target.native_target.add_dependency(resource_bundle_target)
|
198
|
+
end
|
199
|
+
|
200
|
+
next
|
201
|
+
end
|
202
|
+
|
203
|
+
aggregate_target.native_target.add_dependency(pod_target.native_target)
|
204
|
+
configure_app_extension_api_only_for_target(pod_target) if is_app_extension
|
205
|
+
|
206
|
+
pod_target.dependent_targets.each do |pod_dependency_target|
|
207
|
+
next unless pod_dependency_target.should_build?
|
208
|
+
pod_target.native_target.add_dependency(pod_dependency_target.native_target)
|
209
|
+
configure_app_extension_api_only_for_target(pod_dependency_target) if is_app_extension
|
210
|
+
|
211
|
+
if pod_target.requires_frameworks?
|
212
|
+
product_ref = frameworks_group.files.find { |f| f.path == pod_dependency_target.product_name } ||
|
213
|
+
frameworks_group.new_product_ref_for_target(pod_dependency_target.product_basename, pod_dependency_target.product_type)
|
214
|
+
pod_target.native_target.frameworks_build_phase.add_file_reference(product_ref, true)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
# @param [String] pod The root name of the development pod.
|
222
|
+
#
|
223
|
+
# @return [Bool] whether the scheme for the given development pod should be
|
224
|
+
# shared.
|
225
|
+
#
|
226
|
+
def share_scheme_for_development_pod?(pod)
|
227
|
+
case dev_pods_to_share = installation_options.share_schemes_for_development_pods
|
228
|
+
when TrueClass, FalseClass, NilClass
|
229
|
+
dev_pods_to_share
|
230
|
+
when Array
|
231
|
+
dev_pods_to_share.any? { |dev_pod| dev_pod === pod } # rubocop:disable Style/CaseEquality
|
232
|
+
else
|
233
|
+
raise Informative, 'Unable to handle share_schemes_for_development_pods ' \
|
234
|
+
"being set to #{dev_pods_to_share.inspect} -- please set it to true, " \
|
235
|
+
'false, or an array of pods to share schemes for.'
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# @return [Array<Library>] The targets of the development pods generated by
|
240
|
+
# the installation process.
|
241
|
+
#
|
242
|
+
def development_pod_targets
|
243
|
+
pod_targets.select do |pod_target|
|
244
|
+
sandbox.development_pods.keys.include?(pod_target.pod_name)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
#------------------------------------------------------------------------#
|
249
|
+
|
250
|
+
# @! group Private Helpers
|
251
|
+
|
252
|
+
private
|
253
|
+
|
254
|
+
# Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
|
255
|
+
# configurations of the given target
|
256
|
+
#
|
257
|
+
def configure_app_extension_api_only_for_target(target)
|
258
|
+
target.native_target.build_configurations.each do |config|
|
259
|
+
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|