Commit 31df15e9 authored by Kyle Fuller's avatar Kyle Fuller

Merge pull request #3405 from CocoaPods/kylef/xcasset-resources

[Copy Resources] Resolve various problems with xcasset bundles
parents daf86e38 e0629684
......@@ -26,6 +26,13 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
* Fixes an issue showing the URL to remote resources in `pod repo list`.
[Kyle Fuller](https://github.com/kylef)
* Fixes various problems with Pods that use xcasset bundles. Pods that
use xcassets can now be used with the `pod :path` option.
[Kyle Fuller](https://github.com/kylef)
[#1549](https://github.com/CocoaPods/CocoaPods/issues/1549)
[#3384](https://github.com/CocoaPods/CocoaPods/pull/3383)
[#3358](https://github.com/CocoaPods/CocoaPods/pull/3358)
## 0.36.3
......
# rubocop:disable LineLength
module Pod
module Generator
class CopyResourcesScript
......@@ -96,7 +98,13 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
> "$RESOURCES_TO_COPY"
XCASSET_FILES=""
XCASSET_FILES=()
realpath() {
DIRECTORY=$(cd "${1%/*}" && pwd)
FILENAME="${1##*/}"
echo "$DIRECTORY/$FILENAME"
}
install_resource()
{
......@@ -128,7 +136,8 @@ install_resource()
xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm"
;;
*.xcassets)
XCASSET_FILES="$XCASSET_FILES '${PODS_ROOT}/$1'"
ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1")
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
;;
/*)
echo "$1"
......@@ -169,8 +178,16 @@ then
TARGET_DEVICE_ARGS="--target-device mac"
;;
esac
while read line; do XCASSET_FILES="$XCASSET_FILES '$line'"; done <<<$(find "$PWD" -name "*.xcassets" | egrep -v "^$PODS_ROOT")
echo $XCASSET_FILES | xargs actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
# Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
while read line; do
if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
XCASSET_FILES+=("$line")
fi
done <<<"$OTHER_XCASSETS"
printf "%s\\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
fi
EOS
end
......
Subproject commit 053e086f92387ca51dff135c8477d1e1f7b2af6d
Subproject commit 3c638589f3dcc34f56b475e694fcfc1f8745cae7
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