cocoapods 1.3.0.beta.2 → 1.3.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +43 -0
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +8 -4
- data/lib/cocoapods/generator/embed_frameworks_script.rb +9 -5
- data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +2 -2
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +6 -3
- data/lib/cocoapods/installer.rb +8 -0
- data/lib/cocoapods/installer/pods_project_integrator/pod_target_integrator.rb +85 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +124 -54
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +40 -8
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +5 -5
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +25 -1
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +73 -17
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +39 -5
- data/lib/cocoapods/installer/xcode/target_validator.rb +1 -1
- data/lib/cocoapods/project.rb +21 -7
- data/lib/cocoapods/sandbox.rb +2 -3
- data/lib/cocoapods/target/aggregate_target.rb +7 -37
- data/lib/cocoapods/target/pod_target.rb +87 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 010a300e0d6351f5abbc7c2e9afe809565464c6f
|
4
|
+
data.tar.gz: 00b50e9d429fd07a81110a69dfe446fc41aedd98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 595776d077642917cc5ccd59586b899cef84ede1a8e1a03f84ad6965e09ea2427053f6ab33ee70baacaf41e40876f794f2284a40b2e63c086bee87803db2ccc6
|
7
|
+
data.tar.gz: 5b09a2b7b4a9ea17f2b12fa5eba83308257e28c9701b2c9786e23d7341214e8e323074f817fdbabd800e1ebef38757f43099c06097280bb0bd7a858be750f847
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,49 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
|
|
4
4
|
|
5
5
|
To install release candidates run `[sudo] gem install cocoapods --pre`
|
6
6
|
|
7
|
+
## 1.3.0.beta.3 (2017-07-19)
|
8
|
+
|
9
|
+
##### Enhancements
|
10
|
+
|
11
|
+
* Protect rsync tmp files from being deleted if two targets sync at the same time
|
12
|
+
[Justin Martin](https://github.com/justinseanmartin)
|
13
|
+
[#6873](https://github.com/CocoaPods/CocoaPods/pull/6873)
|
14
|
+
|
15
|
+
* Include test schemes within library schemes
|
16
|
+
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
|
17
|
+
[#6765](https://github.com/CocoaPods/CocoaPods/issues/6765)
|
18
|
+
|
19
|
+
* Truncate extra groups in Development Pods when they are parents of all files
|
20
|
+
[Eric Amorde](https://github.com/amorde)
|
21
|
+
[#6814](https://github.com/CocoaPods/CocoaPods/pull/6814)
|
22
|
+
|
23
|
+
* Do not re-write generated files that have not changed
|
24
|
+
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
|
25
|
+
[dingjingpisces2015](https://github.com/dingjingpisces2015)
|
26
|
+
[#6825](https://github.com/CocoaPods/CocoaPods/pull/6825)
|
27
|
+
|
28
|
+
##### Bug Fixes
|
29
|
+
|
30
|
+
* Set the test xcconfig file to resource bundles used only by tests
|
31
|
+
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
|
32
|
+
[#6886](https://github.com/CocoaPods/CocoaPods/pull/6886)
|
33
|
+
|
34
|
+
* Integrate test targets to embed frameworks and resources
|
35
|
+
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
|
36
|
+
[#6828](https://github.com/CocoaPods/CocoaPods/pull/6828)
|
37
|
+
|
38
|
+
* Ensure resource bundle and test dependencies are set for test native targets
|
39
|
+
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
|
40
|
+
[#6829](https://github.com/CocoaPods/CocoaPods/pull/6829)
|
41
|
+
|
42
|
+
* Provide a better error message when references are missing for non-source files
|
43
|
+
[David Airapetyan](https://github.com/davidair)
|
44
|
+
[#4887](https://github.com/CocoaPods/CocoaPods/issues/4887)
|
45
|
+
|
46
|
+
* Select unique module_name(s) across host target's and embedded targets' pod targets
|
47
|
+
[Anand Biligiri](https://github.com/abiligiri)
|
48
|
+
[#6711](https://github.com/CocoaPods/CocoaPods/issues/6711)
|
49
|
+
|
7
50
|
## 1.3.0.beta.2 (2017-06-22)
|
8
51
|
|
9
52
|
##### Enhancements
|
@@ -104,6 +104,10 @@ RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
|
|
104
104
|
|
105
105
|
XCASSET_FILES=()
|
106
106
|
|
107
|
+
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
108
|
+
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
109
|
+
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
110
|
+
|
107
111
|
case "${TARGETED_DEVICE_FAMILY}" in
|
108
112
|
1,2)
|
109
113
|
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
|
@@ -150,8 +154,8 @@ EOM
|
|
150
154
|
*.framework)
|
151
155
|
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
152
156
|
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
153
|
-
echo "rsync --delete -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
154
|
-
rsync --delete -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
157
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
158
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
155
159
|
;;
|
156
160
|
*.xcdatamodel)
|
157
161
|
echo "xcrun momc \\"$RESOURCE_PATH\\" \\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\\"" || true
|
@@ -180,10 +184,10 @@ EOS
|
|
180
184
|
RSYNC_CALL = <<EOS
|
181
185
|
|
182
186
|
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
183
|
-
rsync --delete -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
187
|
+
rsync --delete -avr --copy-links --no-relative "${RSYNC_PROTECT_TMP_FILES[@]}" --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
184
188
|
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
|
185
189
|
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
186
|
-
rsync --delete -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
190
|
+
rsync --delete -avr --copy-links --no-relative "${RSYNC_PROTECT_TMP_FILES[@]}" --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
187
191
|
fi
|
188
192
|
rm -f "$RESOURCES_TO_COPY"
|
189
193
|
EOS
|
@@ -43,6 +43,10 @@ module Pod
|
|
43
43
|
|
44
44
|
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
45
45
|
|
46
|
+
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
47
|
+
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
48
|
+
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
49
|
+
|
46
50
|
install_framework()
|
47
51
|
{
|
48
52
|
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
@@ -60,9 +64,9 @@ module Pod
|
|
60
64
|
source="$(readlink "${source}")"
|
61
65
|
fi
|
62
66
|
|
63
|
-
#
|
64
|
-
echo "rsync --delete -av --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${destination}\\""
|
65
|
-
rsync --delete -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
67
|
+
# Use filter instead of exclude so missing patterns don't throw errors.
|
68
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${destination}\\""
|
69
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
66
70
|
|
67
71
|
local basename
|
68
72
|
basename="$(basename -s .framework "$1")"
|
@@ -95,8 +99,8 @@ module Pod
|
|
95
99
|
install_dsym() {
|
96
100
|
local source="$1"
|
97
101
|
if [ -r "$source" ]; then
|
98
|
-
echo "rsync --delete -av --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DWARF_DSYM_FOLDER_PATH}\\""
|
99
|
-
rsync --delete -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
|
102
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DWARF_DSYM_FOLDER_PATH}\\""
|
103
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
|
100
104
|
fi
|
101
105
|
}
|
102
106
|
|
@@ -70,10 +70,10 @@ module Pod
|
|
70
70
|
end
|
71
71
|
XCConfigHelper.add_target_specific_settings(target, @xcconfig)
|
72
72
|
recursive_dependent_targets = target.recursive_dependent_targets
|
73
|
-
@xcconfig.merge! XCConfigHelper.settings_for_dependent_targets(target, recursive_dependent_targets)
|
73
|
+
@xcconfig.merge! XCConfigHelper.settings_for_dependent_targets(target, recursive_dependent_targets, @test_xcconfig)
|
74
74
|
if @test_xcconfig
|
75
75
|
test_dependent_targets = [target, *target.test_dependent_targets]
|
76
|
-
@xcconfig.merge! XCConfigHelper.settings_for_dependent_targets(target, test_dependent_targets - recursive_dependent_targets)
|
76
|
+
@xcconfig.merge! XCConfigHelper.settings_for_dependent_targets(target, test_dependent_targets - recursive_dependent_targets, @test_xcconfig)
|
77
77
|
XCConfigHelper.generate_vendored_build_settings(nil, test_dependent_targets, @xcconfig)
|
78
78
|
XCConfigHelper.generate_other_ld_flags(nil, test_dependent_targets, @xcconfig)
|
79
79
|
XCConfigHelper.generate_ld_runpath_search_paths(target, false, true, @xcconfig)
|
@@ -265,9 +265,12 @@ module Pod
|
|
265
265
|
# @param [Array<PodTarget>] dependent_targets
|
266
266
|
# The pod targets the given target depends on.
|
267
267
|
#
|
268
|
+
# @param [Boolean] test_xcconfig
|
269
|
+
# Whether the settings for dependent targets are being generated for a test xcconfig or not.
|
270
|
+
#
|
268
271
|
# @return [Hash<String, String>] the settings
|
269
272
|
#
|
270
|
-
def self.settings_for_dependent_targets(target, dependent_targets)
|
273
|
+
def self.settings_for_dependent_targets(target, dependent_targets, test_xcconfig = false)
|
271
274
|
dependent_targets = dependent_targets.select(&:should_build?)
|
272
275
|
|
273
276
|
# Alias build dirs to avoid recursive definitions for pod targets and depending
|
@@ -277,8 +280,8 @@ module Pod
|
|
277
280
|
CONFIGURATION_BUILD_DIR_VARIABLE[1..-1] => "#{BUILD_DIR_VARIABLE}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
|
278
281
|
}
|
279
282
|
|
280
|
-
# Scope pod targets
|
281
|
-
if target.respond_to?(:configuration_build_dir)
|
283
|
+
# Scope pod targets as long as they are not test targets.
|
284
|
+
if !test_xcconfig && target.respond_to?(:configuration_build_dir)
|
282
285
|
build_settings['CONFIGURATION_BUILD_DIR'] = target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
283
286
|
end
|
284
287
|
|
data/lib/cocoapods/installer.rb
CHANGED
@@ -279,10 +279,18 @@ module Pod
|
|
279
279
|
#
|
280
280
|
def clean_sandbox
|
281
281
|
sandbox.public_headers.implode!
|
282
|
+
target_support_dirs = sandbox.target_support_files_root.children.select(&:directory?)
|
282
283
|
pod_targets.each do |pod_target|
|
283
284
|
pod_target.build_headers.implode!
|
285
|
+
target_support_dirs.delete(pod_target.support_files_dir)
|
284
286
|
end
|
285
287
|
|
288
|
+
aggregate_targets.each do |aggregate_target|
|
289
|
+
target_support_dirs.delete(aggregate_target.support_files_dir)
|
290
|
+
end
|
291
|
+
|
292
|
+
target_support_dirs.each { |dir| FileUtils.rm_rf(dir) }
|
293
|
+
|
286
294
|
unless sandbox_state.deleted.empty?
|
287
295
|
title_options = { :verbose_prefix => '-> '.red }
|
288
296
|
sandbox_state.deleted.each do |pod_name|
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
# This class is responsible for integrating a pod target. This includes integrating
|
4
|
+
# the test targets included by each pod target.
|
5
|
+
#
|
6
|
+
class PodTargetIntegrator
|
7
|
+
# @return [PodTarget] the target that should be integrated.
|
8
|
+
#
|
9
|
+
attr_reader :target
|
10
|
+
|
11
|
+
# Init a new PodTargetIntegrator.
|
12
|
+
#
|
13
|
+
# @param [PodTarget] target @see #target
|
14
|
+
#
|
15
|
+
def initialize(target)
|
16
|
+
@target = target
|
17
|
+
end
|
18
|
+
|
19
|
+
# Integrates the pod target.
|
20
|
+
#
|
21
|
+
# @return [void]
|
22
|
+
#
|
23
|
+
def integrate!
|
24
|
+
UI.section(integration_message) do
|
25
|
+
target.test_native_targets.each do |native_target|
|
26
|
+
add_embed_frameworks_script_phase(native_target)
|
27
|
+
add_copy_resources_script_phase(native_target)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [String] a string representation suitable for debugging.
|
33
|
+
#
|
34
|
+
def inspect
|
35
|
+
"#<#{self.class} for target `#{target.label}'>"
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
# @!group Integration steps
|
41
|
+
#---------------------------------------------------------------------#
|
42
|
+
|
43
|
+
# Find or create a 'Copy Pods Resources' build phase
|
44
|
+
#
|
45
|
+
# @return [void]
|
46
|
+
#
|
47
|
+
def add_copy_resources_script_phase(native_target)
|
48
|
+
test_type = target.test_type_for_product_type(native_target.symbol_type)
|
49
|
+
script_path = "${PODS_ROOT}/#{target.copy_resources_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
|
50
|
+
resource_paths = [target, *target.test_dependent_targets].flat_map(&:resource_paths)
|
51
|
+
input_paths = []
|
52
|
+
output_paths = []
|
53
|
+
unless resource_paths.empty?
|
54
|
+
input_paths = [script_path, *resource_paths.flatten.uniq]
|
55
|
+
output_paths = ['${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}']
|
56
|
+
end
|
57
|
+
Pod::Installer::UserProjectIntegrator::TargetIntegrator.add_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Find or create a 'Embed Pods Frameworks' Copy Files Build Phase
|
61
|
+
#
|
62
|
+
# @return [void]
|
63
|
+
#
|
64
|
+
def add_embed_frameworks_script_phase(native_target)
|
65
|
+
test_type = target.test_type_for_product_type(native_target.symbol_type)
|
66
|
+
script_path = "${PODS_ROOT}/#{target.embed_frameworks_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
|
67
|
+
framework_paths = [target, *target.test_dependent_targets].flat_map(&:framework_paths)
|
68
|
+
input_paths = []
|
69
|
+
output_paths = []
|
70
|
+
unless framework_paths.empty?
|
71
|
+
input_paths = [script_path, *framework_paths.map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.flatten.compact]
|
72
|
+
output_paths = framework_paths.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact
|
73
|
+
end
|
74
|
+
Pod::Installer::UserProjectIntegrator::TargetIntegrator.add_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
|
75
|
+
end
|
76
|
+
|
77
|
+
# @return [String] the message that should be displayed for the target
|
78
|
+
# integration.
|
79
|
+
#
|
80
|
+
def integration_message
|
81
|
+
"Integrating target `#{target.name}`"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -9,7 +9,7 @@ module Pod
|
|
9
9
|
class TargetIntegrator
|
10
10
|
autoload :XCConfigIntegrator, 'cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator'
|
11
11
|
|
12
|
-
# @return [String] the PACKAGE emoji to use as prefix for every build phase
|
12
|
+
# @return [String] the PACKAGE emoji to use as prefix for every build phase added to the user project
|
13
13
|
#
|
14
14
|
BUILD_PHASE_PREFIX = '[CP] '.freeze
|
15
15
|
|
@@ -47,6 +47,104 @@ module Pod
|
|
47
47
|
@target = target
|
48
48
|
end
|
49
49
|
|
50
|
+
class << self
|
51
|
+
# Adds a shell script build phase responsible to copy (embed) the frameworks
|
52
|
+
# generated by the TargetDefinition to the bundle of the product of the
|
53
|
+
# targets.
|
54
|
+
#
|
55
|
+
# @param [PBXNativeTarget] native_target
|
56
|
+
# The native target to add the script phase into.
|
57
|
+
#
|
58
|
+
# @param [String] script_path
|
59
|
+
# The script path to execute as part of this script phase.
|
60
|
+
#
|
61
|
+
# @param [Array<String>] input_paths
|
62
|
+
# The input paths (if any) to include for this script phase.
|
63
|
+
#
|
64
|
+
# @param [Array<String>] output_paths
|
65
|
+
# The output paths (if any) to include for this script phase.
|
66
|
+
#
|
67
|
+
# @return [void]
|
68
|
+
#
|
69
|
+
def add_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths = [], output_paths = [])
|
70
|
+
phase = TargetIntegrator.create_or_update_build_phase(native_target, EMBED_FRAMEWORK_PHASE_NAME)
|
71
|
+
phase.shell_script = %("#{script_path}"\n)
|
72
|
+
unless input_paths.empty?
|
73
|
+
phase.input_paths = input_paths
|
74
|
+
end
|
75
|
+
unless output_paths.empty?
|
76
|
+
phase.output_paths = output_paths
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Delete a 'Embed Pods Frameworks' Copy Files Build Phase if present
|
81
|
+
#
|
82
|
+
# @param [PBXNativeTarget] native_target
|
83
|
+
# The native target to remove the script phase from.
|
84
|
+
#
|
85
|
+
def remove_embed_frameworks_script_phase_from_target(native_target)
|
86
|
+
embed_build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(EMBED_FRAMEWORK_PHASE_NAME) }
|
87
|
+
return unless embed_build_phase.present?
|
88
|
+
native_target.build_phases.delete(embed_build_phase)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Adds a shell script build phase responsible to copy the resources
|
92
|
+
# generated by the TargetDefinition to the bundle of the product of the
|
93
|
+
# targets.
|
94
|
+
#
|
95
|
+
# @param [PBXNativeTarget] native_target
|
96
|
+
# The native target to add the script phase into.
|
97
|
+
#
|
98
|
+
# @param [String] script_path
|
99
|
+
# The script path to execute as part of this script phase.
|
100
|
+
#
|
101
|
+
# @param [Array<String>] input_paths
|
102
|
+
# The input paths (if any) to include for this script phase.
|
103
|
+
#
|
104
|
+
# @param [Array<String>] output_paths
|
105
|
+
# The output paths (if any) to include for this script phase.
|
106
|
+
#
|
107
|
+
# @return [void]
|
108
|
+
#
|
109
|
+
def add_copy_resources_script_phase_to_target(native_target, script_path, input_paths = [], output_paths = [])
|
110
|
+
phase_name = COPY_PODS_RESOURCES_PHASE_NAME
|
111
|
+
phase = TargetIntegrator.create_or_update_build_phase(native_target, phase_name)
|
112
|
+
phase.shell_script = %("#{script_path}"\n)
|
113
|
+
unless input_paths.empty?
|
114
|
+
phase.input_paths = input_paths
|
115
|
+
end
|
116
|
+
unless output_paths.empty?
|
117
|
+
phase.output_paths = output_paths
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# Creates or update a shell script build phase for the given target.
|
122
|
+
#
|
123
|
+
# @param [PBXNativeTarget] native_target
|
124
|
+
# The native target to add the script phase into.
|
125
|
+
#
|
126
|
+
# @param [String] phase_name
|
127
|
+
# The name of the phase to use.
|
128
|
+
#
|
129
|
+
# @param [Class] phase_class
|
130
|
+
# The class of the phase to use.
|
131
|
+
#
|
132
|
+
# @return [void]
|
133
|
+
#
|
134
|
+
def create_or_update_build_phase(native_target, phase_name, phase_class = Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
|
135
|
+
prefixed_phase_name = BUILD_PHASE_PREFIX + phase_name
|
136
|
+
build_phases = native_target.build_phases.grep(phase_class)
|
137
|
+
build_phases.find { |phase| phase.name && phase.name.end_with?(phase_name) }.tap { |p| p.name = prefixed_phase_name if p } ||
|
138
|
+
native_target.project.new(phase_class).tap do |phase|
|
139
|
+
UI.message("Adding Build Phase '#{prefixed_phase_name}' to project.") do
|
140
|
+
phase.name = prefixed_phase_name
|
141
|
+
phase.show_env_vars_in_log = '0'
|
142
|
+
native_target.build_phases << phase
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
50
148
|
# Integrates the user project targets. Only the targets that do **not**
|
51
149
|
# already have the Pods library in their frameworks build phase are
|
52
150
|
# processed.
|
@@ -106,13 +204,21 @@ module Pod
|
|
106
204
|
end
|
107
205
|
end
|
108
206
|
|
109
|
-
# Find or create a '
|
207
|
+
# Find or create a 'Copy Pods Resources' build phase
|
110
208
|
#
|
111
209
|
# @return [void]
|
112
210
|
#
|
113
|
-
def
|
114
|
-
|
115
|
-
|
211
|
+
def add_copy_resources_script_phase
|
212
|
+
native_targets.each do |native_target|
|
213
|
+
script_path = target.copy_resources_script_relative_path
|
214
|
+
resource_paths_by_config = target.resource_paths_by_config
|
215
|
+
input_paths = []
|
216
|
+
output_paths = []
|
217
|
+
unless resource_paths_by_config.values.all?(&:empty?)
|
218
|
+
input_paths = [target.copy_resources_script_relative_path, *resource_paths_by_config.values.flatten.uniq]
|
219
|
+
output_paths = ['${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}']
|
220
|
+
end
|
221
|
+
TargetIntegrator.add_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
|
116
222
|
end
|
117
223
|
end
|
118
224
|
|
@@ -126,49 +232,26 @@ module Pod
|
|
126
232
|
return unless target.requires_host_target?
|
127
233
|
native_targets.each do |native_target|
|
128
234
|
if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type
|
129
|
-
|
235
|
+
TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)
|
130
236
|
end
|
131
237
|
end
|
132
238
|
end
|
133
239
|
|
134
|
-
|
135
|
-
phase = create_or_update_build_phase(native_target, EMBED_FRAMEWORK_PHASE_NAME)
|
136
|
-
script_path = target.embed_frameworks_script_relative_path
|
137
|
-
phase.shell_script = %("#{script_path}"\n)
|
138
|
-
framework_paths_by_config = target.framework_paths_by_config.values.flatten.uniq
|
139
|
-
unless framework_paths_by_config.all?(&:empty?)
|
140
|
-
phase.input_paths = [target.embed_frameworks_script_relative_path, *framework_paths_by_config.map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.flatten.compact]
|
141
|
-
phase.output_paths = framework_paths_by_config.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
# Delete a 'Embed Pods Frameworks' Copy Files Build Phase if present
|
146
|
-
#
|
147
|
-
# @param [PBXNativeTarget] native_target
|
148
|
-
#
|
149
|
-
def remove_embed_frameworks_script_phase(native_target)
|
150
|
-
embed_build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(EMBED_FRAMEWORK_PHASE_NAME) }
|
151
|
-
return unless embed_build_phase.present?
|
152
|
-
native_target.build_phases.delete(embed_build_phase)
|
153
|
-
end
|
154
|
-
|
155
|
-
# Adds a shell script build phase responsible to copy the resources
|
156
|
-
# generated by the TargetDefinition to the bundle of the product of the
|
157
|
-
# targets.
|
240
|
+
# Find or create a 'Embed Pods Frameworks' Copy Files Build Phase
|
158
241
|
#
|
159
242
|
# @return [void]
|
160
243
|
#
|
161
|
-
def
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
phase.output_paths = ['${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}']
|
244
|
+
def add_embed_frameworks_script_phase
|
245
|
+
native_targets_to_embed_in.each do |native_target|
|
246
|
+
script_path = target.embed_frameworks_script_relative_path
|
247
|
+
framework_paths_by_config = target.framework_paths_by_config.values.flatten.uniq
|
248
|
+
input_paths = []
|
249
|
+
output_paths = []
|
250
|
+
unless framework_paths_by_config.all?(&:empty?)
|
251
|
+
input_paths = [target.embed_frameworks_script_relative_path, *framework_paths_by_config.map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.flatten.compact]
|
252
|
+
output_paths = framework_paths_by_config.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact
|
171
253
|
end
|
254
|
+
TargetIntegrator.add_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
|
172
255
|
end
|
173
256
|
end
|
174
257
|
|
@@ -184,7 +267,7 @@ module Pod
|
|
184
267
|
def add_check_manifest_lock_script_phase
|
185
268
|
phase_name = CHECK_MANIFEST_PHASE_NAME
|
186
269
|
native_targets.each do |native_target|
|
187
|
-
phase = create_or_update_build_phase(native_target, phase_name)
|
270
|
+
phase = TargetIntegrator.create_or_update_build_phase(native_target, phase_name)
|
188
271
|
native_target.build_phases.unshift(phase).uniq! unless native_target.build_phases.first == phase
|
189
272
|
phase.shell_script = <<-SH.strip_heredoc
|
190
273
|
diff "${PODS_PODFILE_DIR_PATH}/Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null
|
@@ -246,19 +329,6 @@ module Pod
|
|
246
329
|
"Integrating target `#{target.name}` " \
|
247
330
|
"(#{UI.path target.user_project_path} project)"
|
248
331
|
end
|
249
|
-
|
250
|
-
def create_or_update_build_phase(target, phase_name, phase_class = Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
|
251
|
-
prefixed_phase_name = BUILD_PHASE_PREFIX + phase_name
|
252
|
-
build_phases = target.build_phases.grep(phase_class)
|
253
|
-
build_phases.find { |phase| phase.name && phase.name.end_with?(phase_name) }.tap { |p| p.name = prefixed_phase_name if p } ||
|
254
|
-
target.project.new(phase_class).tap do |phase|
|
255
|
-
UI.message("Adding Build Phase '#{prefixed_phase_name}' to project.") do
|
256
|
-
phase.name = prefixed_phase_name
|
257
|
-
phase.show_env_vars_in_log = '0'
|
258
|
-
target.build_phases << phase
|
259
|
-
end
|
260
|
-
end
|
261
|
-
end
|
262
332
|
end
|
263
333
|
end
|
264
334
|
end
|