Commit 1e9dae9f authored by Samuel E. Giddins's avatar Samuel E. Giddins Committed by Marius Rackwitz

[EmbedFrameworksScript] Ensure that the swift runtime libraries are copied to…

[EmbedFrameworksScript] Ensure that the swift runtime libraries are copied to the application target

This is necessary because they are not copied if the main application target itself does not use swift. Using EMBEDDED_CONTENT_CONTAINS_SWIFT was not used because that would cause the runtime, which is in the realm of 10-20MB, to be copied multiple times, once for each framework that uses swift.
parent 1b114894
...@@ -50,6 +50,8 @@ module Pod ...@@ -50,6 +50,8 @@ module Pod
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
install_framework() install_framework()
{ {
local source="${BUILT_PRODUCTS_DIR}/#{target_definition.label}/$1" local source="${BUILT_PRODUCTS_DIR}/#{target_definition.label}/$1"
...@@ -67,6 +69,14 @@ module Pod ...@@ -67,6 +69,14 @@ module Pod
if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then
code_sign "${destination}/$1" code_sign "${destination}/$1"
fi fi
# Embed linked Swift runtime libraries
local basename=$(echo $1 | sed -E s/\\\\..+//)
local swift_runtime_libs=$(otool -LX "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/$1/$BASENAME" | grep libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u)
for lib in $swift_runtime_libs; do
echo "rsync -av \\"${SWIFT_STDLIB_PATH}/${lib}\\" \\"${destination}\\""
rsync -av "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
done
} }
# Signs a framework with the provided identity # Signs a framework with the provided identity
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment