Last active
June 22, 2020 23:39
-
-
Save zadr/1b40a122e7d28f7969d757106b2258a8 to your computer and use it in GitHub Desktop.
objc framework diffing for all .frameworks in xcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -x | |
set -k INTERACTIVE_COMMENTS=1 # treats everything after # as being a comment | |
# vars | |
export XCODE_RELEASE_PATH="/Applications/Xcode-11.5.app" | |
export XCODE_BETA_PATH="/Applications/Xcode-12-beta.app" | |
export XCODE_FRAMEWORKS_PATH="Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks" | |
export OUTPUT="${HOME}/Desktop/iosapidiff" | |
mkdir "${OUTPUT}" | |
# fetch dependencies | |
# curl -LO "http://codeworkshop.net/files/objc-diff-0.4.0.zip" | |
# unzip objc-diff-0.4.0.zip | |
cd objc-diff-0.4.0 | |
# make an index | |
echo "<html>" >> "${OUTPUT}/index.html" | |
# generate diffs for newly added frameworks | |
echo "<div class=\"headerName\">New</div><div>" >> "${OUTPUT}/index.html" | |
for FRAMEWORK in `diff -q "${XCODE_RELEASE_PATH}/${XCODE_FRAMEWORKS_PATH}" "${XCODE_BETA_PATH}/${XCODE_FRAMEWORKS_PATH}" | grep Only | awk '{ print $NF }'`; | |
do | |
# generate a diff | |
./objc-diff --new "${XCODE_BETA_PATH}/${XCODE_FRAMEWORKS_PATH}/${FRAMEWORK}" --html "${OUTPUT}/${FRAMEWORK}" | |
# add it to the index | |
echo "<div><a href=\"./${FRAMEWORK}/apidiff.html\">${FRAMEWORK}</a></div>" >> "${OUTPUT}/index.html" | |
done | |
echo "</div>" >> "${OUTPUT}/index.html" | |
# generate diffs for existing frameworks | |
echo "<div class=\"headerName\">Changed</div><div>" >> "${OUTPUT}/index.html" | |
for FRAMEWORK_PATH in "${XCODE_RELEASE_PATH}/${XCODE_FRAMEWORKS_PATH}"/*; | |
do | |
# generate a diff | |
FRAMEWORK=`echo ${FRAMEWORK_PATH} | awk -F/ '{ print $NF }'` | |
./objc-diff --old "${XCODE_RELEASE_PATH}/${XCODE_FRAMEWORKS_PATH}/${FRAMEWORK}" --new "${XCODE_BETA_PATH}/${XCODE_FRAMEWORKS_PATH}/${FRAMEWORK}" --html "${OUTPUT}/${FRAMEWORK}" | |
# if nothing changed, remove the file | |
if grep -q "No differences" "${OUTPUT}/${FRAMEWORK}/apidiff.html"; | |
then | |
rm -rf "${OUTPUT}/${FRAMEWORK}" | |
else | |
# add it to the index | |
echo "<div><a href=\"./${FRAMEWORK}/apidiff.html\">${FRAMEWORK}</a></div>" >> "${OUTPUT}/index.html" | |
fi | |
done | |
echo "</div>" >> "${OUTPUT}/index.html" | |
# set up some styling | |
find ${OUTPUT} -iname "apidiff.css" -print -exec cp '{}' "${OUTPUT}" \; | |
echo "<link rel="stylesheet" href=\"./apidiff.css\">" >> "${OUTPUT}/index.html" | |
# close the index out | |
echo "</html" >> "${OUTPUT}/index.html" | |
open "${OUTPUT}/index.html" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment