From 1f98f9eb36402273fb7aa445da91ad0d4b6dee7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Sun, 5 Feb 2017 18:29:22 +0100 Subject: [PATCH] Don't touch Info.plist unless git version changes PlistBuddy always touches its output file, even if the value written is identical to the value already there. In such case, Xcode sees Info.plist as modified, therefore sees the entire target as modified and re-runs potentially expensive operations like copying frameworks or signing. Avoid unnecessary build operations by checking the previous CFBundleShortVersionString if Info.plist already exists and only updating it if necessary. --- Configurations/set-git-version-info.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Configurations/set-git-version-info.sh b/Configurations/set-git-version-info.sh index f1f31624..2f2a0860 100755 --- a/Configurations/set-git-version-info.sh +++ b/Configurations/set-git-version-info.sh @@ -30,5 +30,11 @@ fi # and use it to set the CFBundleShortVersionString value export PATH="$PATH:/usr/libexec" -PlistBuddy -c "Set :CFBundleShortVersionString '$version'" \ - "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" + +if [ -f "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" ] ; then + oldversion=$(PlistBuddy -c "Print :CFBundleShortVersionString" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH") +fi +if [ "$version" != "$oldversion" ] ; then + PlistBuddy -c "Set :CFBundleShortVersionString '$version'" \ + "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" +fi