xcocoapods 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +6303 -0
- data/LICENSE +28 -0
- data/README.md +80 -0
- data/bin/pod +56 -0
- data/bin/sandbox-pod +168 -0
- data/lib/cocoapods.rb +73 -0
- data/lib/cocoapods/command.rb +175 -0
- data/lib/cocoapods/command/cache.rb +28 -0
- data/lib/cocoapods/command/cache/clean.rb +90 -0
- data/lib/cocoapods/command/cache/list.rb +69 -0
- data/lib/cocoapods/command/env.rb +66 -0
- data/lib/cocoapods/command/init.rb +128 -0
- data/lib/cocoapods/command/install.rb +45 -0
- data/lib/cocoapods/command/ipc.rb +19 -0
- data/lib/cocoapods/command/ipc/list.rb +40 -0
- data/lib/cocoapods/command/ipc/podfile.rb +31 -0
- data/lib/cocoapods/command/ipc/podfile_json.rb +30 -0
- data/lib/cocoapods/command/ipc/repl.rb +51 -0
- data/lib/cocoapods/command/ipc/spec.rb +29 -0
- data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
- data/lib/cocoapods/command/lib.rb +11 -0
- data/lib/cocoapods/command/lib/create.rb +105 -0
- data/lib/cocoapods/command/lib/lint.rb +121 -0
- data/lib/cocoapods/command/list.rb +39 -0
- data/lib/cocoapods/command/options/project_directory.rb +36 -0
- data/lib/cocoapods/command/options/repo_update.rb +34 -0
- data/lib/cocoapods/command/outdated.rb +140 -0
- data/lib/cocoapods/command/repo.rb +29 -0
- data/lib/cocoapods/command/repo/add.rb +103 -0
- data/lib/cocoapods/command/repo/lint.rb +82 -0
- data/lib/cocoapods/command/repo/list.rb +93 -0
- data/lib/cocoapods/command/repo/push.rb +281 -0
- data/lib/cocoapods/command/repo/remove.rb +36 -0
- data/lib/cocoapods/command/repo/update.rb +28 -0
- data/lib/cocoapods/command/setup.rb +103 -0
- data/lib/cocoapods/command/spec.rb +112 -0
- data/lib/cocoapods/command/spec/cat.rb +51 -0
- data/lib/cocoapods/command/spec/create.rb +283 -0
- data/lib/cocoapods/command/spec/edit.rb +87 -0
- data/lib/cocoapods/command/spec/env_spec.rb +53 -0
- data/lib/cocoapods/command/spec/lint.rb +137 -0
- data/lib/cocoapods/command/spec/which.rb +43 -0
- data/lib/cocoapods/command/update.rb +101 -0
- data/lib/cocoapods/config.rb +347 -0
- data/lib/cocoapods/core_overrides.rb +1 -0
- data/lib/cocoapods/downloader.rb +190 -0
- data/lib/cocoapods/downloader/cache.rb +233 -0
- data/lib/cocoapods/downloader/request.rb +86 -0
- data/lib/cocoapods/downloader/response.rb +16 -0
- data/lib/cocoapods/executable.rb +222 -0
- data/lib/cocoapods/external_sources.rb +57 -0
- data/lib/cocoapods/external_sources/abstract_external_source.rb +205 -0
- data/lib/cocoapods/external_sources/downloader_source.rb +30 -0
- data/lib/cocoapods/external_sources/path_source.rb +55 -0
- data/lib/cocoapods/external_sources/podspec_source.rb +54 -0
- data/lib/cocoapods/gem_version.rb +5 -0
- data/lib/cocoapods/generator/acknowledgements.rb +107 -0
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +44 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +94 -0
- data/lib/cocoapods/generator/app_target_helper.rb +244 -0
- data/lib/cocoapods/generator/bridge_support.rb +22 -0
- data/lib/cocoapods/generator/constant.rb +19 -0
- data/lib/cocoapods/generator/copy_resources_script.rb +230 -0
- data/lib/cocoapods/generator/dummy_source.rb +31 -0
- data/lib/cocoapods/generator/embed_frameworks_script.rb +215 -0
- data/lib/cocoapods/generator/header.rb +103 -0
- data/lib/cocoapods/generator/info_plist_file.rb +116 -0
- data/lib/cocoapods/generator/module_map.rb +99 -0
- data/lib/cocoapods/generator/prefix_header.rb +60 -0
- data/lib/cocoapods/generator/umbrella_header.rb +46 -0
- data/lib/cocoapods/hooks_manager.rb +132 -0
- data/lib/cocoapods/installer.rb +703 -0
- data/lib/cocoapods/installer/analyzer.rb +972 -0
- data/lib/cocoapods/installer/analyzer/analysis_result.rb +87 -0
- data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +98 -0
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +67 -0
- data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +157 -0
- data/lib/cocoapods/installer/analyzer/podfile_dependency_cache.rb +54 -0
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +240 -0
- data/lib/cocoapods/installer/analyzer/specs_state.rb +84 -0
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +53 -0
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +260 -0
- data/lib/cocoapods/installer/installation_options.rb +158 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +202 -0
- data/lib/cocoapods/installer/pod_source_preparer.rb +77 -0
- data/lib/cocoapods/installer/podfile_validator.rb +139 -0
- data/lib/cocoapods/installer/post_install_hooks_context.rb +132 -0
- data/lib/cocoapods/installer/pre_install_hooks_context.rb +51 -0
- data/lib/cocoapods/installer/source_provider_hooks_context.rb +34 -0
- data/lib/cocoapods/installer/user_project_integrator.rb +250 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +463 -0
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +146 -0
- data/lib/cocoapods/installer/xcode.rb +8 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +416 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +181 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +84 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +334 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +777 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +116 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +86 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +256 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +68 -0
- data/lib/cocoapods/installer/xcode/target_validator.rb +147 -0
- data/lib/cocoapods/open-uri.rb +33 -0
- data/lib/cocoapods/project.rb +414 -0
- data/lib/cocoapods/resolver.rb +585 -0
- data/lib/cocoapods/resolver/lazy_specification.rb +79 -0
- data/lib/cocoapods/sandbox.rb +404 -0
- data/lib/cocoapods/sandbox/file_accessor.rb +444 -0
- data/lib/cocoapods/sandbox/headers_store.rb +146 -0
- data/lib/cocoapods/sandbox/path_list.rb +220 -0
- data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +85 -0
- data/lib/cocoapods/sandbox/podspec_finder.rb +23 -0
- data/lib/cocoapods/sources_manager.rb +157 -0
- data/lib/cocoapods/target.rb +261 -0
- data/lib/cocoapods/target/aggregate_target.rb +338 -0
- data/lib/cocoapods/target/build_settings.rb +1075 -0
- data/lib/cocoapods/target/pod_target.rb +559 -0
- data/lib/cocoapods/user_interface.rb +459 -0
- data/lib/cocoapods/user_interface/error_report.rb +187 -0
- data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
- data/lib/cocoapods/validator.rb +981 -0
- metadata +533 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
class BridgeSupport
|
4
|
+
extend Executable
|
5
|
+
executable :gen_bridge_metadata
|
6
|
+
|
7
|
+
attr_reader :headers
|
8
|
+
|
9
|
+
def initialize(headers)
|
10
|
+
@headers = headers
|
11
|
+
end
|
12
|
+
|
13
|
+
def search_paths
|
14
|
+
@headers.map { |header| "-I '#{header.dirname}'" }.uniq
|
15
|
+
end
|
16
|
+
|
17
|
+
def save_as(pathname)
|
18
|
+
gen_bridge_metadata('-c', search_paths.join(' '), '-o', pathname, *headers)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
# Generates a constant file.
|
4
|
+
#
|
5
|
+
class Constant
|
6
|
+
def initialize(contents)
|
7
|
+
@generate = contents
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :generate
|
11
|
+
|
12
|
+
def save_as(path)
|
13
|
+
path.open('w') do |f|
|
14
|
+
f.write(generate)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,230 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
class CopyResourcesScript
|
4
|
+
# @return [Hash{String, Array{String}] A list of files relative to the
|
5
|
+
# project pods root, keyed by build configuration.
|
6
|
+
#
|
7
|
+
attr_reader :resources_by_config
|
8
|
+
|
9
|
+
# @return [Platform] The platform of the library for which the copy
|
10
|
+
# resources script is needed.
|
11
|
+
#
|
12
|
+
attr_reader :platform
|
13
|
+
|
14
|
+
# Initialize a new instance
|
15
|
+
#
|
16
|
+
# @param [Hash<String, Array<String>>] resources_by_config
|
17
|
+
# @see resources_by_config
|
18
|
+
#
|
19
|
+
# @param [Platform] platform
|
20
|
+
# @see platform
|
21
|
+
#
|
22
|
+
def initialize(resources_by_config, platform)
|
23
|
+
@resources_by_config = resources_by_config
|
24
|
+
@platform = platform
|
25
|
+
end
|
26
|
+
|
27
|
+
# Saves the resource script to the given pathname.
|
28
|
+
#
|
29
|
+
# @param [Pathname] pathname
|
30
|
+
# The path where the copy resources script should be saved.
|
31
|
+
#
|
32
|
+
# @return [void]
|
33
|
+
#
|
34
|
+
def save_as(pathname)
|
35
|
+
pathname.open('w') do |file|
|
36
|
+
file.puts(script)
|
37
|
+
end
|
38
|
+
File.chmod(0755, pathname.to_s)
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String] The contents of the copy resources script.
|
42
|
+
#
|
43
|
+
def generate
|
44
|
+
script
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
# @!group Private Helpers
|
50
|
+
|
51
|
+
# @return [Hash{Symbol=>Version}] The minimum deployment target which
|
52
|
+
# supports the `--reference-external-strings-file` option for
|
53
|
+
# the `ibtool` command.
|
54
|
+
#
|
55
|
+
EXTERNAL_STRINGS_FILE_MIMINUM_DEPLOYMENT_TARGET = {
|
56
|
+
:ios => Version.new('6.0'),
|
57
|
+
:osx => Version.new('10.8'),
|
58
|
+
:watchos => Version.new('2.0'),
|
59
|
+
:tvos => Version.new('9.0'),
|
60
|
+
}
|
61
|
+
|
62
|
+
# @return [Bool] Whether the external strings file is supported by the
|
63
|
+
# `ibtool` according to the deployment target of the platform.
|
64
|
+
#
|
65
|
+
def use_external_strings_file?
|
66
|
+
minimum_deployment_target = EXTERNAL_STRINGS_FILE_MIMINUM_DEPLOYMENT_TARGET[platform.name]
|
67
|
+
platform.deployment_target >= minimum_deployment_target
|
68
|
+
end
|
69
|
+
|
70
|
+
# @return [String] The install resources shell function.
|
71
|
+
#
|
72
|
+
def install_resources_function
|
73
|
+
if use_external_strings_file?
|
74
|
+
INSTALL_RESOURCES_FUNCTION
|
75
|
+
else
|
76
|
+
INSTALL_RESOURCES_FUNCTION.gsub(' --reference-external-strings-file', '')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [String] The contents of the copy resources script.
|
81
|
+
#
|
82
|
+
def script
|
83
|
+
# Define install function
|
84
|
+
script = install_resources_function
|
85
|
+
|
86
|
+
# Call function for each configuration-dependent resource
|
87
|
+
resources_by_config.each do |config, resources|
|
88
|
+
unless resources.empty?
|
89
|
+
script += %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
|
90
|
+
resources.each do |resource|
|
91
|
+
script += %( install_resource "#{resource}"\n)
|
92
|
+
end
|
93
|
+
script += "fi\n"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
script += RSYNC_CALL
|
98
|
+
script += XCASSETS_COMPILE
|
99
|
+
script
|
100
|
+
end
|
101
|
+
|
102
|
+
INSTALL_RESOURCES_FUNCTION = <<EOS
|
103
|
+
#!/bin/sh
|
104
|
+
set -e
|
105
|
+
set -u
|
106
|
+
set -o pipefail
|
107
|
+
|
108
|
+
if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
|
109
|
+
# If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
|
110
|
+
# resources to, so exit 0 (signalling the script phase was successful).
|
111
|
+
exit 0
|
112
|
+
fi
|
113
|
+
|
114
|
+
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
115
|
+
|
116
|
+
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
|
117
|
+
> "$RESOURCES_TO_COPY"
|
118
|
+
|
119
|
+
XCASSET_FILES=()
|
120
|
+
|
121
|
+
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
122
|
+
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
123
|
+
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
124
|
+
|
125
|
+
case "${TARGETED_DEVICE_FAMILY:-}" in
|
126
|
+
1,2)
|
127
|
+
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
|
128
|
+
;;
|
129
|
+
1)
|
130
|
+
TARGET_DEVICE_ARGS="--target-device iphone"
|
131
|
+
;;
|
132
|
+
2)
|
133
|
+
TARGET_DEVICE_ARGS="--target-device ipad"
|
134
|
+
;;
|
135
|
+
3)
|
136
|
+
TARGET_DEVICE_ARGS="--target-device tv"
|
137
|
+
;;
|
138
|
+
4)
|
139
|
+
TARGET_DEVICE_ARGS="--target-device watch"
|
140
|
+
;;
|
141
|
+
*)
|
142
|
+
TARGET_DEVICE_ARGS="--target-device mac"
|
143
|
+
;;
|
144
|
+
esac
|
145
|
+
|
146
|
+
install_resource()
|
147
|
+
{
|
148
|
+
if [[ "$1" = /* ]] ; then
|
149
|
+
RESOURCE_PATH="$1"
|
150
|
+
else
|
151
|
+
RESOURCE_PATH="${PODS_ROOT}/$1"
|
152
|
+
fi
|
153
|
+
if [[ ! -e "$RESOURCE_PATH" ]] ; then
|
154
|
+
cat << EOM
|
155
|
+
error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
|
156
|
+
EOM
|
157
|
+
exit 1
|
158
|
+
fi
|
159
|
+
case $RESOURCE_PATH in
|
160
|
+
*\.storyboard)
|
161
|
+
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$RESOURCE_PATH\\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
|
162
|
+
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$RESOURCE_PATH\\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
163
|
+
;;
|
164
|
+
*\.xib)
|
165
|
+
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$RESOURCE_PATH\\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
|
166
|
+
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\"$RESOURCE_PATH\\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
|
167
|
+
;;
|
168
|
+
*.framework)
|
169
|
+
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
170
|
+
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
171
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
|
172
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
173
|
+
;;
|
174
|
+
*.xcdatamodel)
|
175
|
+
echo "xcrun momc \\"$RESOURCE_PATH\\" \\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\\"" || true
|
176
|
+
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
|
177
|
+
;;
|
178
|
+
*.xcdatamodeld)
|
179
|
+
echo "xcrun momc \\"$RESOURCE_PATH\\" \\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\\"" || true
|
180
|
+
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
|
181
|
+
;;
|
182
|
+
*.xcmappingmodel)
|
183
|
+
echo "xcrun mapc \\"$RESOURCE_PATH\\" \\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\\"" || true
|
184
|
+
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
|
185
|
+
;;
|
186
|
+
*.xcassets)
|
187
|
+
ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
|
188
|
+
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
|
189
|
+
;;
|
190
|
+
*)
|
191
|
+
echo "$RESOURCE_PATH" || true
|
192
|
+
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
|
193
|
+
;;
|
194
|
+
esac
|
195
|
+
}
|
196
|
+
EOS
|
197
|
+
|
198
|
+
RSYNC_CALL = <<EOS
|
199
|
+
|
200
|
+
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
201
|
+
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
202
|
+
if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
|
203
|
+
mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
204
|
+
rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
205
|
+
fi
|
206
|
+
rm -f "$RESOURCES_TO_COPY"
|
207
|
+
EOS
|
208
|
+
|
209
|
+
XCASSETS_COMPILE = <<EOS
|
210
|
+
|
211
|
+
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ]
|
212
|
+
then
|
213
|
+
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
|
214
|
+
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
|
215
|
+
while read line; do
|
216
|
+
if [[ $line != "${PODS_ROOT}*" ]]; then
|
217
|
+
XCASSET_FILES+=("$line")
|
218
|
+
fi
|
219
|
+
done <<<"$OTHER_XCASSETS"
|
220
|
+
|
221
|
+
if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then
|
222
|
+
printf "%s\\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
|
223
|
+
else
|
224
|
+
printf "%s\\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist"
|
225
|
+
fi
|
226
|
+
fi
|
227
|
+
EOS
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
class DummySource
|
4
|
+
attr_reader :class_name
|
5
|
+
|
6
|
+
def initialize(class_name_identifier)
|
7
|
+
validated_class_name_identifier = class_name_identifier.gsub(/[^0-9a-z_]/i, '_')
|
8
|
+
@class_name = "PodsDummy_#{validated_class_name_identifier}"
|
9
|
+
end
|
10
|
+
|
11
|
+
# @return [String] the string contents of the dummy source file.
|
12
|
+
#
|
13
|
+
def generate
|
14
|
+
result = <<-source.strip_heredoc
|
15
|
+
#import <Foundation/Foundation.h>
|
16
|
+
@interface #{class_name} : NSObject
|
17
|
+
@end
|
18
|
+
@implementation #{class_name}
|
19
|
+
@end
|
20
|
+
source
|
21
|
+
result
|
22
|
+
end
|
23
|
+
|
24
|
+
def save_as(pathname)
|
25
|
+
pathname.open('w') do |source|
|
26
|
+
source.write(generate)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,215 @@
|
|
1
|
+
module Pod
|
2
|
+
module Generator
|
3
|
+
class EmbedFrameworksScript
|
4
|
+
# @return [Hash{String => Array<String>}] Multiple lists of frameworks per
|
5
|
+
# configuration.
|
6
|
+
#
|
7
|
+
attr_reader :frameworks_by_config
|
8
|
+
|
9
|
+
# @param [Hash{String => Array<String>] frameworks_by_config
|
10
|
+
# @see #frameworks_by_config
|
11
|
+
#
|
12
|
+
def initialize(frameworks_by_config)
|
13
|
+
@frameworks_by_config = frameworks_by_config
|
14
|
+
end
|
15
|
+
|
16
|
+
# Saves the resource script to the given pathname.
|
17
|
+
#
|
18
|
+
# @param [Pathname] pathname
|
19
|
+
# The path where the embed frameworks script should be saved.
|
20
|
+
#
|
21
|
+
# @return [void]
|
22
|
+
#
|
23
|
+
def save_as(pathname)
|
24
|
+
pathname.open('w') do |file|
|
25
|
+
file.puts(script)
|
26
|
+
end
|
27
|
+
File.chmod(0755, pathname.to_s)
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [String] The contents of the embed frameworks script.
|
31
|
+
#
|
32
|
+
def generate
|
33
|
+
script
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# @!group Private Helpers
|
39
|
+
|
40
|
+
# @return [String] The contents of the embed frameworks script.
|
41
|
+
#
|
42
|
+
def script
|
43
|
+
script = <<-SH.strip_heredoc
|
44
|
+
#!/bin/sh
|
45
|
+
set -e
|
46
|
+
set -u
|
47
|
+
set -o pipefail
|
48
|
+
|
49
|
+
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
|
50
|
+
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
|
51
|
+
# frameworks to, so exit 0 (signalling the script phase was successful).
|
52
|
+
exit 0
|
53
|
+
fi
|
54
|
+
|
55
|
+
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
56
|
+
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
57
|
+
|
58
|
+
COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
|
59
|
+
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
|
60
|
+
|
61
|
+
# Used as a return value for each invocation of `strip_invalid_archs` function.
|
62
|
+
STRIP_BINARY_RETVAL=0
|
63
|
+
|
64
|
+
# This protects against multiple targets copying the same framework dependency at the same time. The solution
|
65
|
+
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
|
66
|
+
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
|
67
|
+
|
68
|
+
# Copies and strips a vendored framework
|
69
|
+
install_framework()
|
70
|
+
{
|
71
|
+
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
|
72
|
+
local source="${BUILT_PRODUCTS_DIR}/$1"
|
73
|
+
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
|
74
|
+
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
|
75
|
+
elif [ -r "$1" ]; then
|
76
|
+
local source="$1"
|
77
|
+
fi
|
78
|
+
|
79
|
+
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
|
80
|
+
|
81
|
+
if [ -L "${source}" ]; then
|
82
|
+
echo "Symlinked..."
|
83
|
+
source="$(readlink "${source}")"
|
84
|
+
fi
|
85
|
+
|
86
|
+
# Use filter instead of exclude so missing patterns don't throw errors.
|
87
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${destination}\\""
|
88
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
|
89
|
+
|
90
|
+
local basename
|
91
|
+
basename="$(basename -s .framework "$1")"
|
92
|
+
binary="${destination}/${basename}.framework/${basename}"
|
93
|
+
|
94
|
+
if ! [ -r "$binary" ]; then
|
95
|
+
binary="${destination}/${basename}"
|
96
|
+
elif [ -L "${binary}" ]; then
|
97
|
+
echo "Destination binary is symlinked..."
|
98
|
+
dirname="$(dirname "${binary}")"
|
99
|
+
binary="${dirname}/$(readlink "${binary}")"
|
100
|
+
fi
|
101
|
+
|
102
|
+
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
103
|
+
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
|
104
|
+
strip_invalid_archs "$binary"
|
105
|
+
fi
|
106
|
+
|
107
|
+
# Resign the code if required by the build settings to avoid unstable apps
|
108
|
+
code_sign_if_enabled "${destination}/$(basename "$1")"
|
109
|
+
|
110
|
+
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
|
111
|
+
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
|
112
|
+
local swift_runtime_libs
|
113
|
+
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u && exit ${PIPESTATUS[0]})
|
114
|
+
for lib in $swift_runtime_libs; do
|
115
|
+
echo "rsync -auv \\"${SWIFT_STDLIB_PATH}/${lib}\\" \\"${destination}\\""
|
116
|
+
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
|
117
|
+
code_sign_if_enabled "${destination}/${lib}"
|
118
|
+
done
|
119
|
+
fi
|
120
|
+
}
|
121
|
+
|
122
|
+
# Copies and strips a vendored dSYM
|
123
|
+
install_dsym() {
|
124
|
+
local source="$1"
|
125
|
+
if [ -r "$source" ]; then
|
126
|
+
# Copy the dSYM into a the targets temp dir.
|
127
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${source}\\" \\"${DERIVED_FILES_DIR}\\""
|
128
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
|
129
|
+
|
130
|
+
local basename
|
131
|
+
basename="$(basename -s .framework.dSYM "$source")"
|
132
|
+
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
|
133
|
+
|
134
|
+
# Strip invalid architectures so "fat" simulator / device frameworks work on device
|
135
|
+
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
|
136
|
+
strip_invalid_archs "$binary"
|
137
|
+
fi
|
138
|
+
|
139
|
+
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
|
140
|
+
# Move the stripped file into its final destination.
|
141
|
+
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \\"- CVS/\\" --filter \\"- .svn/\\" --filter \\"- .git/\\" --filter \\"- .hg/\\" --filter \\"- Headers\\" --filter \\"- PrivateHeaders\\" --filter \\"- Modules\\" \\"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\\" \\"${DWARF_DSYM_FOLDER_PATH}\\""
|
142
|
+
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
|
143
|
+
else
|
144
|
+
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
|
145
|
+
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
|
146
|
+
fi
|
147
|
+
fi
|
148
|
+
}
|
149
|
+
|
150
|
+
# Signs a framework with the provided identity
|
151
|
+
code_sign_if_enabled() {
|
152
|
+
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
|
153
|
+
# Use the current code_sign_identity
|
154
|
+
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
|
155
|
+
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
|
156
|
+
|
157
|
+
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
158
|
+
code_sign_cmd="$code_sign_cmd &"
|
159
|
+
fi
|
160
|
+
echo "$code_sign_cmd"
|
161
|
+
eval "$code_sign_cmd"
|
162
|
+
fi
|
163
|
+
}
|
164
|
+
|
165
|
+
# Strip invalid architectures
|
166
|
+
strip_invalid_archs() {
|
167
|
+
binary="$1"
|
168
|
+
# Get architectures for current target binary
|
169
|
+
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
|
170
|
+
# Intersect them with the architectures we are building for
|
171
|
+
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\\n' | sort | uniq -d)"
|
172
|
+
# If there are no archs supported by this binary then warn the user
|
173
|
+
if [[ -z "$intersected_archs" ]]; then
|
174
|
+
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
|
175
|
+
STRIP_BINARY_RETVAL=0
|
176
|
+
return
|
177
|
+
fi
|
178
|
+
stripped=""
|
179
|
+
for arch in $binary_archs; do
|
180
|
+
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
|
181
|
+
# Strip non-valid architectures in-place
|
182
|
+
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
|
183
|
+
stripped="$stripped $arch"
|
184
|
+
fi
|
185
|
+
done
|
186
|
+
if [[ "$stripped" ]]; then
|
187
|
+
echo "Stripped $binary of architectures:$stripped"
|
188
|
+
fi
|
189
|
+
STRIP_BINARY_RETVAL=1
|
190
|
+
}
|
191
|
+
|
192
|
+
SH
|
193
|
+
script << "\n" unless frameworks_by_config.values.all?(&:empty?)
|
194
|
+
frameworks_by_config.each do |config, frameworks_with_dsyms|
|
195
|
+
unless frameworks_with_dsyms.empty?
|
196
|
+
script << %(if [[ "$CONFIGURATION" == "#{config}" ]]; then\n)
|
197
|
+
frameworks_with_dsyms.each do |framework_with_dsym|
|
198
|
+
script << %( install_framework "#{framework_with_dsym[:input_path]}"\n)
|
199
|
+
# Vendored frameworks might have a dSYM file next to them so ensure its copied. Frameworks built from
|
200
|
+
# sources will have their dSYM generated and copied by Xcode.
|
201
|
+
script << %( install_dsym "#{framework_with_dsym[:dsym_input_path]}"\n) unless framework_with_dsym[:dsym_input_path].nil?
|
202
|
+
end
|
203
|
+
script << "fi\n"
|
204
|
+
end
|
205
|
+
end
|
206
|
+
script << <<-SH.strip_heredoc
|
207
|
+
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
|
208
|
+
wait
|
209
|
+
fi
|
210
|
+
SH
|
211
|
+
script
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|