Unverified Commit bb88523a authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #7180 from keith/ks/set-u-scripts

Add set -u to frameworks and resources copy scripts
parents 3e27274c 7d803426
...@@ -23,6 +23,15 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -23,6 +23,15 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
* Store which specs repo a pod comes from in the lockfile. * Store which specs repo a pod comes from in the lockfile.
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
* Add `set -u` to the copy frameworks and copy resources scripts.
[Keith Smiley](https://github.com/keith)
[#7180](https://github.com/CocoaPods/CocoaPods/pull/7180)
* Allow integrating into static library targets without attempting to copy
resources or embed frameworks unless `UNLOCALIZED_RESOURCES_FOLDER_PATH`
or `FRAMEWORKS_FOLDER_PATH` is set.
[Samuel Giddins](https://github.com/segiddins)
##### Bug Fixes ##### Bug Fixes
* Clear input/output paths if they exceed an arbitrary limit * Clear input/output paths if they exceed an arbitrary limit
......
...@@ -96,6 +96,14 @@ module Pod ...@@ -96,6 +96,14 @@ module Pod
INSTALL_RESOURCES_FUNCTION = <<EOS INSTALL_RESOURCES_FUNCTION = <<EOS
#!/bin/sh #!/bin/sh
set -e set -e
set -u
set -o pipefail
if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
# If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's no where for us to copy
# resources to, so exit 0 (signalling the script phase was successful).
exit 0
fi
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
...@@ -108,7 +116,7 @@ XCASSET_FILES=() ...@@ -108,7 +116,7 @@ XCASSET_FILES=()
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
case "${TARGETED_DEVICE_FAMILY}" in case "${TARGETED_DEVICE_FAMILY:-}" in
1,2) 1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;; ;;
...@@ -194,7 +202,7 @@ EOS ...@@ -194,7 +202,7 @@ EOS
XCASSETS_COMPILE = <<EOS XCASSETS_COMPILE = <<EOS
if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ]
then then
# Find all other xcassets (this unfortunately includes those of path pods and other targets). # Find all other xcassets (this unfortunately includes those of path pods and other targets).
OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
......
...@@ -37,10 +37,19 @@ module Pod ...@@ -37,10 +37,19 @@ module Pod
script = <<-SH.strip_heredoc script = <<-SH.strip_heredoc
#!/bin/sh #!/bin/sh
set -e set -e
set -u
set -o pipefail
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
# If FRAMEWORKS_FOLDER_PATH is not set, then there's no where for us to copy
# frameworks to, so exit 0 (signalling the script phase was successful).
exit 0
fi
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}"
COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function. # Used as a return value for each invocation of `strip_invalid_archs` function.
...@@ -129,10 +138,10 @@ module Pod ...@@ -129,10 +138,10 @@ module Pod
# Signs a framework with the provided identity # Signs a framework with the provided identity
code_sign_if_enabled() { code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy # Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
code_sign_cmd="$code_sign_cmd &" code_sign_cmd="$code_sign_cmd &"
......
Subproject commit 382f474f5f42af0cbfeccac15371fe6dd9ee579c Subproject commit f3299acb7729e33d7ac944dda6f45ed9c1d8ad20
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