From 5504d77244efe0e94ce78c6b49b23f7e08ad2fb5 Mon Sep 17 00:00:00 2001 From: Brandon Evans Date: Thu, 12 Dec 2019 14:56:31 -0700 Subject: [PATCH] Use PlistBuddy instead of defaults in scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The defaults command will sometimes fail with an error like this: > The domain/default pair of (.../FraudForce.framework/Info.plist, CFBundleExecutable) does not exist The defaults command seems intended for use with the macOS preferences system. Included in its man page is: > WARNING: The defaults command will be changed in an upcoming major release to only operate on preferences domains. General plist manipulation utilities will be folded into a different command-line program. Perhaps Catalina is that upcoming major release 😅 A better alternative to using defaults is PlistBuddy. If you replace the defaults command in slim-build-frameworks.sh with /usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" "${OUTPUT_FRAMEWORK_PATH}/Info.plist" then it will return the same value and shouldn't fail with the error quoted above. --- .../build scripts/add-framework-symbols-to-app-archive.sh | 2 +- FraudForce SDK/build scripts/slim-build-frameworks.sh | 2 +- iovSample/bin/add-framework-symbols-to-app-archive.sh | 2 +- iovSample/bin/slim-build-frameworks.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FraudForce SDK/build scripts/add-framework-symbols-to-app-archive.sh b/FraudForce SDK/build scripts/add-framework-symbols-to-app-archive.sh index 9095be1..d8f0eb5 100755 --- a/FraudForce SDK/build scripts/add-framework-symbols-to-app-archive.sh +++ b/FraudForce SDK/build scripts/add-framework-symbols-to-app-archive.sh @@ -29,7 +29,7 @@ for BUILD_FRAMEWORK_PATH in "$(find "${BUILD_FRAMEWORKS_DIR}" -name '*.framework FRAMEWORK_NAME=$(basename "${BUILD_FRAMEWORK_PATH}") # Determine the uuids of the architectures of the executable file within the framework bundle. - FRAMEWORK_EXECUTABLE_NAME=$(defaults read "${BUILD_FRAMEWORK_PATH}/Info.plist" CFBundleExecutable) + FRAMEWORK_EXECUTABLE_NAME=$(/usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" "${BUILD_FRAMEWORK_PATH}/Info.plist") FRAMEWORK_EXECUTABLE_PATH="${BUILD_FRAMEWORK_PATH}/${FRAMEWORK_EXECUTABLE_NAME}" EXECUTABLE_ARCHS="$(lipo -info "${FRAMEWORK_EXECUTABLE_PATH}" | rev | cut -d ':' -f1 | rev)" FRAMEWORK_SLICE_UUIDS="$(xcrun dwarfdump --uuid "${FRAMEWORK_EXECUTABLE_PATH}" | awk '{ print $2 }' | tr '\n' ' ')" diff --git a/FraudForce SDK/build scripts/slim-build-frameworks.sh b/FraudForce SDK/build scripts/slim-build-frameworks.sh index 370534f..ceddb69 100755 --- a/FraudForce SDK/build scripts/slim-build-frameworks.sh +++ b/FraudForce SDK/build scripts/slim-build-frameworks.sh @@ -33,7 +33,7 @@ for UNIVERSAL_FRAMEWORK in "$(find "${INPUT_FRAMEWORKS_DIR}" -name '*.framework' cp -a "${UNIVERSAL_FRAMEWORK}" "${OUTPUT_FRAMEWORKS_DIR}/." # Determine the architectures of the executable file within the framework bundle. - FRAMEWORK_EXECUTABLE_NAME=$(defaults read "${OUTPUT_FRAMEWORK_PATH}/Info.plist" CFBundleExecutable) + FRAMEWORK_EXECUTABLE_NAME=$(/usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" "${OUTPUT_FRAMEWORK_PATH}/Info.plist") FRAMEWORK_EXECUTABLE_PATH="${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_EXECUTABLE_NAME}" EXECUTABLE_ARCHS="$(lipo -info "${FRAMEWORK_EXECUTABLE_PATH}" | rev | cut -d ':' -f1 | rev)" echo "Framework (${FRAMEWORK_NAME}) executable (${FRAMEWORK_EXECUTABLE_NAME}) contains archs: ${EXECUTABLE_ARCHS}" diff --git a/iovSample/bin/add-framework-symbols-to-app-archive.sh b/iovSample/bin/add-framework-symbols-to-app-archive.sh index 9095be1..d8f0eb5 100755 --- a/iovSample/bin/add-framework-symbols-to-app-archive.sh +++ b/iovSample/bin/add-framework-symbols-to-app-archive.sh @@ -29,7 +29,7 @@ for BUILD_FRAMEWORK_PATH in "$(find "${BUILD_FRAMEWORKS_DIR}" -name '*.framework FRAMEWORK_NAME=$(basename "${BUILD_FRAMEWORK_PATH}") # Determine the uuids of the architectures of the executable file within the framework bundle. - FRAMEWORK_EXECUTABLE_NAME=$(defaults read "${BUILD_FRAMEWORK_PATH}/Info.plist" CFBundleExecutable) + FRAMEWORK_EXECUTABLE_NAME=$(/usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" "${BUILD_FRAMEWORK_PATH}/Info.plist") FRAMEWORK_EXECUTABLE_PATH="${BUILD_FRAMEWORK_PATH}/${FRAMEWORK_EXECUTABLE_NAME}" EXECUTABLE_ARCHS="$(lipo -info "${FRAMEWORK_EXECUTABLE_PATH}" | rev | cut -d ':' -f1 | rev)" FRAMEWORK_SLICE_UUIDS="$(xcrun dwarfdump --uuid "${FRAMEWORK_EXECUTABLE_PATH}" | awk '{ print $2 }' | tr '\n' ' ')" diff --git a/iovSample/bin/slim-build-frameworks.sh b/iovSample/bin/slim-build-frameworks.sh index 370534f..ceddb69 100755 --- a/iovSample/bin/slim-build-frameworks.sh +++ b/iovSample/bin/slim-build-frameworks.sh @@ -33,7 +33,7 @@ for UNIVERSAL_FRAMEWORK in "$(find "${INPUT_FRAMEWORKS_DIR}" -name '*.framework' cp -a "${UNIVERSAL_FRAMEWORK}" "${OUTPUT_FRAMEWORKS_DIR}/." # Determine the architectures of the executable file within the framework bundle. - FRAMEWORK_EXECUTABLE_NAME=$(defaults read "${OUTPUT_FRAMEWORK_PATH}/Info.plist" CFBundleExecutable) + FRAMEWORK_EXECUTABLE_NAME=$(/usr/libexec/PlistBuddy -c "Print :CFBundleExecutable" "${OUTPUT_FRAMEWORK_PATH}/Info.plist") FRAMEWORK_EXECUTABLE_PATH="${OUTPUT_FRAMEWORK_PATH}/${FRAMEWORK_EXECUTABLE_NAME}" EXECUTABLE_ARCHS="$(lipo -info "${FRAMEWORK_EXECUTABLE_PATH}" | rev | cut -d ':' -f1 | rev)" echo "Framework (${FRAMEWORK_NAME}) executable (${FRAMEWORK_EXECUTABLE_NAME}) contains archs: ${EXECUTABLE_ARCHS}"