Commit fdf80d24 authored by Kyle Fuller's avatar Kyle Fuller

[Copy Resources] Resolve various problems with xcasset bundles

Allow support for pods with xcasset bundles using `:path`.

Closes #1549
Closes #3384
Closes #3358
parent dbbfd255
...@@ -4,6 +4,18 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides ...@@ -4,6 +4,18 @@ To install or update CocoaPods see this [guide](http://docs.cocoapods.org/guides
To install release candidates run `[sudo] gem install cocoapods --pre` To install release candidates run `[sudo] gem install cocoapods --pre`
## Master
##### Bug Fixes
* 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 ## 0.36.3
##### Bug Fixes ##### Bug Fixes
......
# rubocop:disable LineLength
module Pod module Pod
module Generator module Generator
class CopyResourcesScript class CopyResourcesScript
...@@ -96,7 +98,13 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" ...@@ -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=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
> "$RESOURCES_TO_COPY" > "$RESOURCES_TO_COPY"
XCASSET_FILES="" XCASSET_FILES=()
realpath() {
DIRECTORY=$(cd "${1%/*}" && pwd)
FILENAME="${1##*/}"
echo "$DIRECTORY/$FILENAME"
}
install_resource() install_resource()
{ {
...@@ -128,7 +136,8 @@ install_resource() ...@@ -128,7 +136,8 @@ install_resource()
xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm"
;; ;;
*.xcassets) *.xcassets)
XCASSET_FILES="$XCASSET_FILES '${PODS_ROOT}/$1'" ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1")
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
;; ;;
/*) /*)
echo "$1" echo "$1"
...@@ -169,8 +178,16 @@ then ...@@ -169,8 +178,16 @@ then
TARGET_DEVICE_ARGS="--target-device mac" TARGET_DEVICE_ARGS="--target-device mac"
;; ;;
esac 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 fi
EOS EOS
end end
......
Subproject commit a0f4b2a0d386adf9cad9fc3797c72a89978c7b51 Subproject commit 482081e5a1cecff64b88ac13af111056ffadece1
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