cocoapods 1.4.0 → 1.5.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 +149 -0
- data/lib/cocoapods.rb +1 -0
- data/lib/cocoapods/command/outdated.rb +2 -2
- data/lib/cocoapods/command/repo/push.rb +5 -0
- data/lib/cocoapods/command/update.rb +21 -5
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/acknowledgements.rb +6 -3
- data/lib/cocoapods/generator/constant.rb +19 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +15 -3
- data/lib/cocoapods/generator/embed_frameworks_script.rb +11 -2
- data/lib/cocoapods/generator/module_map.rb +56 -5
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +19 -13
- data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +4 -6
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +25 -2
- data/lib/cocoapods/installer.rb +17 -8
- data/lib/cocoapods/installer/analyzer.rb +48 -38
- data/lib/cocoapods/installer/analyzer/analysis_result.rb +11 -0
- data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +7 -6
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +8 -8
- data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +3 -3
- data/lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb +54 -0
- data/lib/cocoapods/installer/analyzer/specs_state.rb +16 -16
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +7 -11
- data/lib/cocoapods/installer/pod_source_installer.rb +2 -3
- data/lib/cocoapods/installer/podfile_validator.rb +11 -10
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +72 -28
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +8 -2
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +9 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +32 -24
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +97 -54
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +9 -11
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +4 -9
- data/lib/cocoapods/installer/xcode/target_validator.rb +32 -18
- data/lib/cocoapods/project.rb +32 -17
- data/lib/cocoapods/resolver.rb +59 -31
- data/lib/cocoapods/resolver/lazy_specification.rb +28 -18
- data/lib/cocoapods/sandbox.rb +2 -4
- data/lib/cocoapods/sandbox/file_accessor.rb +25 -9
- data/lib/cocoapods/sandbox/headers_store.rb +31 -6
- data/lib/cocoapods/sandbox/path_list.rb +36 -46
- data/lib/cocoapods/target.rb +7 -4
- data/lib/cocoapods/target/aggregate_target.rb +10 -8
- data/lib/cocoapods/target/pod_target.rb +87 -20
- data/lib/cocoapods/user_interface/error_report.rb +1 -1
- data/lib/cocoapods/user_interface/inspector_reporter.rb +4 -4
- data/lib/cocoapods/validator.rb +40 -29
- metadata +11 -9
@@ -153,7 +153,7 @@ module Pod
|
|
153
153
|
build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
|
154
154
|
build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
|
155
155
|
build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
|
156
|
-
build_configuration.build_settings['
|
156
|
+
build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|
@@ -165,8 +165,14 @@ module Pod
|
|
165
165
|
|
166
166
|
def install_libraries
|
167
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
|
+
|
168
173
|
pod_targets.sort_by(&:name).each do |pod_target|
|
169
174
|
target_installer = PodTargetInstaller.new(sandbox, pod_target)
|
175
|
+
target_installer.umbrella_headers_by_dir = umbrella_headers_by_dir
|
170
176
|
target_installer.install!
|
171
177
|
end
|
172
178
|
|
@@ -277,7 +283,7 @@ module Pod
|
|
277
283
|
#
|
278
284
|
def development_pod_targets
|
279
285
|
pod_targets.select do |pod_target|
|
280
|
-
sandbox.
|
286
|
+
sandbox.local?(pod_target.pod_name)
|
281
287
|
end
|
282
288
|
end
|
283
289
|
|
@@ -20,6 +20,9 @@ module Pod
|
|
20
20
|
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
|
21
21
|
create_module_map
|
22
22
|
create_umbrella_header
|
23
|
+
elsif target.uses_swift?
|
24
|
+
create_module_map
|
25
|
+
create_umbrella_header
|
23
26
|
end
|
24
27
|
# Because embedded targets live in their host target, CocoaPods
|
25
28
|
# copies all of the embedded target's pod_targets to its host
|
@@ -60,6 +63,12 @@ module Pod
|
|
60
63
|
'PODS_ROOT' => '$(SRCROOT)',
|
61
64
|
'PRODUCT_BUNDLE_IDENTIFIER' => 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}',
|
62
65
|
'SKIP_INSTALL' => 'YES',
|
66
|
+
|
67
|
+
# Needed to ensure that static libraries won't try to embed the swift stdlib,
|
68
|
+
# since there's no where to embed in for a static library.
|
69
|
+
# Not necessary for dynamic frameworks either, since the aggregate targets are never shipped
|
70
|
+
# on their own, and are always further embedded into an app target.
|
71
|
+
'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' => 'NO',
|
63
72
|
}
|
64
73
|
super.merge(settings)
|
65
74
|
end
|
@@ -58,9 +58,7 @@ module Pod
|
|
58
58
|
# @return [void]
|
59
59
|
#
|
60
60
|
def refresh_file_accessors
|
61
|
-
file_accessors.each
|
62
|
-
fa.path_list.read_file_system
|
63
|
-
end
|
61
|
+
file_accessors.map(&:path_list).uniq.each(&:read_file_system)
|
64
62
|
end
|
65
63
|
|
66
64
|
# Adds the source files of the Pods to the Pods project.
|
@@ -135,33 +133,41 @@ module Pod
|
|
135
133
|
def link_headers
|
136
134
|
UI.message '- Linking headers' do
|
137
135
|
pod_targets.each do |pod_target|
|
136
|
+
# When integrating Pod as frameworks, built Pods are built into
|
137
|
+
# frameworks, whose headers are included inside the built
|
138
|
+
# framework. Those headers do not need to be linked from the
|
139
|
+
# sandbox.
|
140
|
+
next if pod_target.requires_frameworks? && pod_target.should_build?
|
141
|
+
|
142
|
+
headers_sandbox = Pathname.new(pod_target.pod_name)
|
143
|
+
added_build_headers = false
|
144
|
+
added_public_headers = false
|
145
|
+
|
138
146
|
pod_target.file_accessors.each do |file_accessor|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
# sandbox.
|
146
|
-
unless pod_target.requires_frameworks? && pod_target.should_build?
|
147
|
-
pod_target.build_headers.add_search_path(headers_sandbox, pod_target.platform)
|
148
|
-
sandbox.public_headers.add_search_path(headers_sandbox, pod_target.platform)
|
149
|
-
|
150
|
-
header_mappings(headers_sandbox, file_accessor, file_accessor.headers).each do |namespaced_path, files|
|
151
|
-
pod_target.build_headers.add_files(namespaced_path, files.reject { |f| f.to_path =~ framework_exp })
|
152
|
-
end
|
147
|
+
# Private headers will always end up in Pods/Headers/Private/PodA/*.h
|
148
|
+
# This will allow for `""` imports to work.
|
149
|
+
header_mappings(headers_sandbox, file_accessor, file_accessor.headers).each do |namespaced_path, files|
|
150
|
+
added_build_headers = true
|
151
|
+
pod_target.build_headers.add_files(namespaced_path, files)
|
152
|
+
end
|
153
153
|
|
154
|
-
|
155
|
-
|
156
|
-
|
154
|
+
# Public headers on the other hand will be added in Pods/Headers/Public/PodA/PodA/*.h
|
155
|
+
# The extra folder is intentional in order for `<>` imports to work.
|
156
|
+
header_mappings(headers_sandbox, file_accessor, file_accessor.public_headers).each do |namespaced_path, files|
|
157
|
+
added_public_headers = true
|
158
|
+
sandbox.public_headers.add_files(namespaced_path, files)
|
157
159
|
end
|
158
160
|
|
159
161
|
unless pod_target.requires_frameworks?
|
160
162
|
vendored_frameworks_header_mappings(headers_sandbox, file_accessor).each do |namespaced_path, files|
|
163
|
+
added_public_headers = true
|
161
164
|
sandbox.public_headers.add_files(namespaced_path, files)
|
162
165
|
end
|
163
166
|
end
|
164
167
|
end
|
168
|
+
|
169
|
+
pod_target.build_headers.add_search_path(headers_sandbox, pod_target.platform) if added_build_headers
|
170
|
+
sandbox.public_headers.add_search_path(headers_sandbox, pod_target.platform) if added_public_headers
|
165
171
|
end
|
166
172
|
end
|
167
173
|
end
|
@@ -176,7 +182,7 @@ module Pod
|
|
176
182
|
# specs platform combinations.
|
177
183
|
#
|
178
184
|
def file_accessors
|
179
|
-
@file_accessors ||= pod_targets.
|
185
|
+
@file_accessors ||= pod_targets.flat_map(&:file_accessors).compact
|
180
186
|
end
|
181
187
|
|
182
188
|
# Adds file references to the list of the paths returned by the file
|
@@ -304,15 +310,17 @@ module Pod
|
|
304
310
|
#
|
305
311
|
def header_mappings(headers_sandbox, file_accessor, headers)
|
306
312
|
consumer = file_accessor.spec_consumer
|
313
|
+
header_mappings_dir = consumer.header_mappings_dir
|
307
314
|
dir = headers_sandbox
|
308
315
|
dir += consumer.header_dir if consumer.header_dir
|
309
316
|
|
310
317
|
mappings = {}
|
311
318
|
headers.each do |header|
|
319
|
+
next if header.to_s.include?('.framework/')
|
320
|
+
|
312
321
|
sub_dir = dir
|
313
|
-
if
|
314
|
-
|
315
|
-
relative_path = header.relative_path_from(header_mappings_dir)
|
322
|
+
if header_mappings_dir
|
323
|
+
relative_path = header.relative_path_from(file_accessor.path_list.root + header_mappings_dir)
|
316
324
|
sub_dir += relative_path.dirname
|
317
325
|
end
|
318
326
|
mappings[sub_dir] ||= []
|
@@ -27,11 +27,11 @@ module Pod
|
|
27
27
|
add_files_to_build_phases
|
28
28
|
create_xcconfig_file
|
29
29
|
create_test_xcconfig_files if target.contains_test_specifications?
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
|
31
|
+
if target.defines_module?
|
32
|
+
create_module_map do |generator|
|
33
|
+
generator.headers.concat module_map_additional_headers
|
33
34
|
end
|
34
|
-
create_module_map
|
35
35
|
create_umbrella_header do |generator|
|
36
36
|
file_accessors = target.file_accessors
|
37
37
|
file_accessors = file_accessors.reject { |f| f.spec.test_specification? } if target.contains_test_specifications?
|
@@ -41,13 +41,19 @@ module Pod
|
|
41
41
|
end
|
42
42
|
else
|
43
43
|
file_accessors.flat_map(&:public_headers).map(&:basename)
|
44
|
-
|
44
|
+
end
|
45
45
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
end
|
47
|
+
|
48
|
+
if target.requires_frameworks?
|
49
|
+
unless target.static_framework?
|
50
|
+
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
|
49
51
|
end
|
52
|
+
create_build_phase_to_symlink_header_folders
|
53
|
+
elsif target.uses_swift?
|
54
|
+
add_swift_static_library_compatibility_header_phase
|
50
55
|
end
|
56
|
+
|
51
57
|
unless skip_pch?(target.non_test_specs)
|
52
58
|
path = target.prefix_header_path
|
53
59
|
file_accessors = target.file_accessors.reject { |f| f.spec.test_specification? }
|
@@ -64,6 +70,11 @@ module Pod
|
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|
73
|
+
# @return [Hash<Pathname,Pathname>] A hash of all umbrella headers, grouped by the directory
|
74
|
+
# the are stored in
|
75
|
+
#
|
76
|
+
attr_accessor :umbrella_headers_by_dir
|
77
|
+
|
67
78
|
private
|
68
79
|
|
69
80
|
# @param [Array<Specification>] specs
|
@@ -87,6 +98,9 @@ module Pod
|
|
87
98
|
settings['PUBLIC_HEADERS_FOLDER_PATH'] = ''
|
88
99
|
end
|
89
100
|
|
101
|
+
settings['PRODUCT_NAME'] = target.product_basename
|
102
|
+
settings['PRODUCT_MODULE_NAME'] = target.product_module_name
|
103
|
+
|
90
104
|
settings['CODE_SIGN_IDENTITY[sdk=appletvos*]'] = ''
|
91
105
|
settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = ''
|
92
106
|
settings['CODE_SIGN_IDENTITY[sdk=watchos*]'] = ''
|
@@ -96,6 +110,7 @@ module Pod
|
|
96
110
|
if target.swift_version
|
97
111
|
settings['SWIFT_VERSION'] = target.swift_version
|
98
112
|
end
|
113
|
+
|
99
114
|
settings
|
100
115
|
end
|
101
116
|
|
@@ -164,8 +179,8 @@ module Pod
|
|
164
179
|
|
165
180
|
native_target = target.native_target_for_spec(consumer.spec)
|
166
181
|
headers = file_accessor.headers
|
167
|
-
public_headers = file_accessor.public_headers
|
168
|
-
private_headers = file_accessor.private_headers
|
182
|
+
public_headers = file_accessor.public_headers.map(&:realpath)
|
183
|
+
private_headers = file_accessor.private_headers.map(&:realpath)
|
169
184
|
other_source_files = file_accessor.source_files.reject { |sf| SOURCE_FILE_EXTENSIONS.include?(sf.extname) }
|
170
185
|
|
171
186
|
{
|
@@ -259,8 +274,15 @@ module Pod
|
|
259
274
|
# requires frameworks. For tests we always use the test target name as the product name
|
260
275
|
# irrelevant to whether we use frameworks or not.
|
261
276
|
configuration.build_settings['PRODUCT_NAME'] = name
|
277
|
+
# Use xcode default product module name, which is $(PRODUCT_NAME:c99extidentifier)
|
278
|
+
# this gives us always valid name that is distinct from the parent spec module name
|
279
|
+
# which allow tests to use either import or @testable import to access the parent framework
|
280
|
+
configuration.build_settings.delete('PRODUCT_MODULE_NAME')
|
262
281
|
# We must codesign iOS XCTest bundles that contain binary frameworks to allow them to be launchable in the simulator
|
263
|
-
|
282
|
+
unless target.platform == :osx
|
283
|
+
configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'YES'
|
284
|
+
configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'YES'
|
285
|
+
end
|
264
286
|
# For macOS we do not code sign the XCTest bundle because we do not code sign the frameworks either.
|
265
287
|
configuration.build_settings['CODE_SIGN_IDENTITY'] = '' if target.platform == :osx
|
266
288
|
end
|
@@ -269,6 +291,11 @@ module Pod
|
|
269
291
|
create_test_target_embed_frameworks_script(test_type)
|
270
292
|
create_test_target_copy_resources_script(test_type)
|
271
293
|
|
294
|
+
# Generate vanila Info.plist for test target similar to the one xcode gererates for new test target.
|
295
|
+
# This creates valid test bundle accessible at the runtime, allowing tests to load bundle resources
|
296
|
+
# defined in podspec.
|
297
|
+
create_info_plist_file(target.info_plist_path_for_test_type(test_type), native_test_target, '1.0', target.platform, :bndl)
|
298
|
+
|
272
299
|
target.test_native_targets << native_test_target
|
273
300
|
end
|
274
301
|
end
|
@@ -321,14 +348,10 @@ module Pod
|
|
321
348
|
path = target.info_plist_path
|
322
349
|
path.dirname.mkdir unless path.dirname.exist?
|
323
350
|
info_plist_path = path.dirname + "ResourceBundle-#{bundle_name}-#{path.basename}"
|
324
|
-
|
325
|
-
update_changed_file(generator, info_plist_path)
|
326
|
-
add_file_to_support_group(info_plist_path)
|
351
|
+
create_info_plist_file(info_plist_path, bundle_target, target.version, target.platform, :bndl)
|
327
352
|
|
328
353
|
bundle_target.build_configurations.each do |c|
|
329
354
|
c.build_settings['PRODUCT_NAME'] = bundle_name
|
330
|
-
relative_info_plist_path = info_plist_path.relative_path_from(sandbox.root)
|
331
|
-
c.build_settings['INFOPLIST_FILE'] = relative_info_plist_path.to_s
|
332
355
|
# Do not set the CONFIGURATION_BUILD_DIR for resource bundles that are only meant for test targets.
|
333
356
|
# This is because the test target itself also does not set this configuration build dir and it expects
|
334
357
|
# all bundles to be copied from the default path.
|
@@ -466,28 +489,6 @@ module Pod
|
|
466
489
|
eos
|
467
490
|
end
|
468
491
|
|
469
|
-
# Creates a build phase to put the static framework in the appropriate framework location
|
470
|
-
# Since Xcode does not provide template support for static library frameworks, we've built a static library
|
471
|
-
# of the form lib{LibraryName}.a. We need to move that to the framework location -
|
472
|
-
# {LibraryName}.framework/{LibraryName}.
|
473
|
-
#
|
474
|
-
# @return [void]
|
475
|
-
#
|
476
|
-
def create_build_phase_to_move_static_framework_archive
|
477
|
-
build_phase = native_target.new_shell_script_build_phase('Setup Static Framework')
|
478
|
-
build_phase.shell_script = <<-eos.strip_heredoc
|
479
|
-
mkdir -p "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules"
|
480
|
-
# The fat library archive is at a file symbolic link when archiving, so use -L option
|
481
|
-
rsync -tL "${BUILT_PRODUCTS_DIR}/lib${PRODUCT_NAME}.a" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/${PRODUCT_NAME}"
|
482
|
-
rsync -t "${MODULEMAP_FILE}" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules/module.modulemap"
|
483
|
-
# If there's a .swiftmodule, copy it into the framework's Modules folder
|
484
|
-
rsync -tr "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}".swiftmodule "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/Modules/" 2>/dev/null || :
|
485
|
-
# If archiving, Headers copy is needed
|
486
|
-
rsync -tr "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.framework/Headers" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/" 2>/dev/null || :
|
487
|
-
rsync -tr "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.framework/PrivateHeaders" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.framework/" 2>/dev/null || :
|
488
|
-
eos
|
489
|
-
end
|
490
|
-
|
491
492
|
# Creates a prefix header file which imports `UIKit` or `Cocoa` according
|
492
493
|
# to the platform of the target. This file also include any prefix header
|
493
494
|
# content reported by the specification of the pods.
|
@@ -578,20 +579,6 @@ module Pod
|
|
578
579
|
flags * ' '
|
579
580
|
end
|
580
581
|
|
581
|
-
# Adds a reference to the given file in the support group of this target.
|
582
|
-
#
|
583
|
-
# @param [Pathname] path
|
584
|
-
# The path of the file to which the reference should be added.
|
585
|
-
#
|
586
|
-
# @return [PBXFileReference] the file reference of the added file.
|
587
|
-
#
|
588
|
-
def add_file_to_support_group(path)
|
589
|
-
pod_name = target.pod_name
|
590
|
-
dir = target.support_files_dir
|
591
|
-
group = project.pod_support_files_group(pod_name, dir)
|
592
|
-
group.new_file(path)
|
593
|
-
end
|
594
|
-
|
595
582
|
def apply_xcconfig_file_ref_to_resource_bundle_targets(resource_bundle_targets, xcconfig_file_ref)
|
596
583
|
resource_bundle_targets.each do |rsrc_target|
|
597
584
|
rsrc_target.build_configurations.each do |rsrc_bc|
|
@@ -602,11 +589,15 @@ module Pod
|
|
602
589
|
|
603
590
|
def create_module_map
|
604
591
|
return super unless custom_module_map
|
592
|
+
|
605
593
|
path = target.module_map_path
|
606
594
|
UI.message "- Copying module map file to #{UI.path(path)}" do
|
607
|
-
|
608
|
-
|
595
|
+
contents = custom_module_map.read
|
596
|
+
unless target.requires_frameworks?
|
597
|
+
contents.gsub!(/^(\s*)framework\s+(module[^{}]+){/, '\1\2[system] {')
|
609
598
|
end
|
599
|
+
generator = Generator::Constant.new(contents)
|
600
|
+
update_changed_file(generator, path)
|
610
601
|
add_file_to_support_group(path)
|
611
602
|
|
612
603
|
native_target.build_configurations.each do |c|
|
@@ -616,6 +607,17 @@ module Pod
|
|
616
607
|
end
|
617
608
|
end
|
618
609
|
|
610
|
+
def module_map_additional_headers
|
611
|
+
return [] unless umbrella_headers_by_dir
|
612
|
+
|
613
|
+
other_paths = umbrella_headers_by_dir[target.module_map_path.dirname] - [target.umbrella_header_path]
|
614
|
+
other_paths.map do |module_map_path|
|
615
|
+
# exclude other targets umbrella headers, to avoid
|
616
|
+
# incomplete umbrella warnings
|
617
|
+
Generator::ModuleMap::Header.new(module_map_path.basename, nil, nil, nil, true)
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
619
621
|
def create_umbrella_header
|
620
622
|
return super unless custom_module_map
|
621
623
|
end
|
@@ -667,6 +669,47 @@ module Pod
|
|
667
669
|
end
|
668
670
|
end
|
669
671
|
|
672
|
+
def support_files_group
|
673
|
+
pod_name = target.pod_name
|
674
|
+
dir = target.support_files_dir
|
675
|
+
project.pod_support_files_group(pod_name, dir)
|
676
|
+
end
|
677
|
+
|
678
|
+
# Adds a shell script phase, intended only for static library targets that contain swift,
|
679
|
+
# to copy the ObjC compatibility header (the -Swift.h file that the swift compiler generates)
|
680
|
+
# to the built products directory. Additionally, the script phase copies the module map, appending a `.Swift`
|
681
|
+
# submodule that references the (moved) compatibility header. Since the module map has been moved, the umbrella header
|
682
|
+
# is _also_ copied, so that it is sitting next to the module map. This is necessary for a successful archive build.
|
683
|
+
#
|
684
|
+
# @return [Void]
|
685
|
+
#
|
686
|
+
def add_swift_static_library_compatibility_header_phase
|
687
|
+
build_phase = native_target.new_shell_script_build_phase('Copy generated compatibility header')
|
688
|
+
|
689
|
+
relative_module_map_path = target.module_map_path.relative_path_from(target.sandbox.root)
|
690
|
+
relative_umbrella_header_path = target.umbrella_header_path.relative_path_from(target.sandbox.root)
|
691
|
+
|
692
|
+
build_phase.shell_script = <<-SH.strip_heredoc
|
693
|
+
COMPATIBILITY_HEADER_PATH="${BUILT_PRODUCTS_DIR}/Swift Compatibility Header/${PRODUCT_MODULE_NAME}-Swift.h"
|
694
|
+
MODULE_MAP_PATH="${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap"
|
695
|
+
|
696
|
+
ditto "${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h" "${COMPATIBILITY_HEADER_PATH}"
|
697
|
+
ditto "${PODS_ROOT}/#{relative_module_map_path}" "${MODULE_MAP_PATH}"
|
698
|
+
ditto "${PODS_ROOT}/#{relative_umbrella_header_path}" "${BUILT_PRODUCTS_DIR}"
|
699
|
+
printf "\\n\\nmodule ${PRODUCT_MODULE_NAME}.Swift {\\n header \\"${COMPATIBILITY_HEADER_PATH}\\"\\n requires objc\\n}\\n" >> "${MODULE_MAP_PATH}"
|
700
|
+
SH
|
701
|
+
build_phase.input_paths = %W(
|
702
|
+
${DERIVED_SOURCES_DIR}/${PRODUCT_MODULE_NAME}-Swift.h
|
703
|
+
${PODS_ROOT}/#{relative_module_map_path}
|
704
|
+
${PODS_ROOT}/#{relative_umbrella_header_path}
|
705
|
+
)
|
706
|
+
build_phase.output_paths = %W(
|
707
|
+
${BUILT_PRODUCTS_DIR}/${PRODUCT_MODULE_NAME}.modulemap
|
708
|
+
${BUILT_PRODUCTS_DIR}/#{relative_umbrella_header_path.basename}
|
709
|
+
${BUILT_PRODUCTS_DIR}/Swift\ Compatibility\ Header/${PRODUCT_MODULE_NAME}-Swift.h
|
710
|
+
)
|
711
|
+
end
|
712
|
+
|
670
713
|
#-----------------------------------------------------------------------#
|
671
714
|
end
|
672
715
|
end
|
@@ -29,7 +29,7 @@ module Pod
|
|
29
29
|
add_copy_resources_script_phase(native_target)
|
30
30
|
UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(test_specs), native_target)
|
31
31
|
end
|
32
|
-
specs = target.
|
32
|
+
specs = target.non_test_specs
|
33
33
|
UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(specs), target.native_target)
|
34
34
|
end
|
35
35
|
end
|
@@ -58,13 +58,10 @@ module Pod
|
|
58
58
|
unless resource_paths.empty?
|
59
59
|
resource_paths_flattened = resource_paths.flatten.uniq
|
60
60
|
input_paths = [script_path, *resource_paths_flattened]
|
61
|
-
output_paths = resource_paths_flattened
|
62
|
-
base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'
|
63
|
-
output_extension = UserProjectIntegrator::TargetIntegrator.output_extension_for_resource(File.extname(input_path))
|
64
|
-
File.join(base_path, File.basename(input_path, File.extname(input_path)) + output_extension)
|
65
|
-
end
|
61
|
+
output_paths = UserProjectIntegrator::TargetIntegrator.resource_output_paths(resource_paths_flattened)
|
66
62
|
end
|
67
|
-
UserProjectIntegrator::TargetIntegrator.
|
63
|
+
UserProjectIntegrator::TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)
|
64
|
+
UserProjectIntegrator::TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
|
68
65
|
end
|
69
66
|
|
70
67
|
# Find or create a 'Embed Pods Frameworks' Copy Files Build Phase
|
@@ -78,10 +75,11 @@ module Pod
|
|
78
75
|
input_paths = []
|
79
76
|
output_paths = []
|
80
77
|
unless framework_paths.empty?
|
81
|
-
input_paths = [script_path, *framework_paths.
|
82
|
-
output_paths = framework_paths.
|
78
|
+
input_paths = [script_path, *framework_paths.flat_map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.compact]
|
79
|
+
output_paths = framework_paths.flat_map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.compact
|
83
80
|
end
|
84
|
-
UserProjectIntegrator::TargetIntegrator.
|
81
|
+
UserProjectIntegrator::TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)
|
82
|
+
UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
|
85
83
|
end
|
86
84
|
|
87
85
|
# @return [String] the message that should be displayed for the target
|
@@ -97,7 +95,7 @@ module Pod
|
|
97
95
|
# @return [Array<Hash<Symbol=>String>] an array of all combined script phases from the specs.
|
98
96
|
#
|
99
97
|
def script_phases_for_specs(specs)
|
100
|
-
specs.
|
98
|
+
specs.flat_map { |spec| spec.consumer(target.platform).script_phases }
|
101
99
|
end
|
102
100
|
end
|
103
101
|
end
|