aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts
diff options
context:
space:
mode:
authorStuart Connolly <stuart02@gmail.com>2017-03-23 20:45:50 +0000
committerStuart Connolly <stuart02@gmail.com>2017-03-23 20:45:50 +0000
commit4a186517155223c48255e9952d002f465c567626 (patch)
treeb45aeef12f3f186cb6db19264d5377d3ab22e59b /Scripts
parentdd468908b319a7e607fc7c918dff090e12c44db7 (diff)
downloadsequelpro-4a186517155223c48255e9952d002f465c567626.tar.gz
sequelpro-4a186517155223c48255e9952d002f465c567626.tar.bz2
sequelpro-4a186517155223c48255e9952d002f465c567626.zip
Re-order some build steps (while investigating slowish debug builds).
Diffstat (limited to 'Scripts')
-rwxr-xr-xScripts/build.sh122
1 files changed, 83 insertions, 39 deletions
diff --git a/Scripts/build.sh b/Scripts/build.sh
index 5348152a..681a98fa 100755
--- a/Scripts/build.sh
+++ b/Scripts/build.sh
@@ -40,11 +40,16 @@ then
exit 1
fi
+FRAMEWORKS_LIST="/tmp/sp.frameworks.$$"
+FILES_TO_SIGN_LIST="/tmp/sp.filelist.$$"
BUILD_PRODUCT="${BUILT_PRODUCTS_DIR}/${TARGET_NAME}${WRAPPER_SUFFIX}"
FRAMEWORKS_PATH="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}"
+SHARED_SUPPORT_DIR="${BUILD_PRODUCT}/Contents/SharedSupport"
dev_sign_resource()
{
+ log "Signing resource: $1"
+
codesign -f -s 'Sequel Pro Development' "$1" 2> /dev/null
}
@@ -92,86 +97,124 @@ dist_code_sign()
echo $ERRORS
}
-echo 'Updating build version...'
+copy_default_bundles()
+{
+ log "Copying default bundles from '${SRCROOT}/SharedSupport/Default Bundles' to '${SHARED_SUPPORT_DIR}'"
+
+ # Copy all Default Bundles to build product
+ rm -rf "${SHARED_SUPPORT_DIR}/Default Bundles"
+
+ mkdir -p "${SHARED_SUPPORT_DIR}/Default Bundles"
+
+ cp -R "${SRCROOT}/SharedSupport/Default Bundles" "${SHARED_SUPPORT_DIR}"
+}
+
+copy_default_themes()
+{
+ log "Copying default bundles from '${SRCROOT}/SharedSupport/Default Themes' to '${SHARED_SUPPORT_DIR}'"
+
+ # Copy all Default Themes to build product
+ rm -rf "${SHARED_SUPPORT_DIR}/Default Themes"
+
+ mkdir -p "${SHARED_SUPPORT_DIR}/Default Themes"
+
+ cp -R "${SRCROOT}/SharedSupport/Default Themes" "${SHARED_SUPPORT_DIR}"
+}
+
+set_spotlight_comment()
+{
+ log "Setting Spotlight comment to 'MySQL database pancakes with syrup'"
+
+ # Add a SpotLight comment (can't use applescript from a continuous integration server, so we manually set the binaryplist with xattr - but if this fails fall back to applescript)
+ xattr -wx com.apple.metadata:kMDItemFinderComment "62 70 6C 69 73 74 30 30 5F 10 22 4D 79 53 51 4C 20 64 61 74 61 62 61 73 65 20 70 61 6E 63 61 6B 65 73 20 77 69 74 68 20 73 79 72 75 70 08 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D" "${BUILD_PRODUCT}"
+
+ if [ $? -ne 0 ] ; then
+ osascript -e "tell application \"Finder\" to set comment of (alias (POSIX file \"${BUILD_PRODUCT}\")) to \"MySQL database pancakes with syrup\""
+ fi
+}
+
+remove_temp_files()
+{
+ rm "$FRAMEWORKS_LIST"
+ rm "$FILES_TO_SIGN_LIST"
+}
+
+log()
+{
+ echo $1
+}
+
+log 'Updating build number (build-version.pl)...'
# Add the build/bundle version
"${SRCROOT}/Scripts/build-version.pl"
-# Remove the .ibplugin from within frameworks
-rm -rf "${BUILD_PRODUCT}/Contents/Frameworks/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin"
+copy_default_bundles
+copy_default_themes
# Perform 'Release' or 'Distribution' build specific actions
if [[ "$CONFIGURATION" == 'Release' || "$CONFIGURATION" == 'Distribution' ]]
then
+ log 'Updating localizations (localize.sh)...'
+
"${SRCROOT}/Scripts/localize.sh"
- printf "Running trim-application.sh to strip application resources for distribution...\n\n"
+ log "Stripping application resources for distribution (trim-application.sh)..."
"${SRCROOT}/Scripts/trim-application.sh" -p "$BUILD_PRODUCT" -a
-fi
-
-SHARED_SUPPORT_DIR="${BUILD_PRODUCT}/Contents/SharedSupport"
-
-# Copy all Default Bundles to build product
-rm -rf "${SHARED_SUPPORT_DIR}/Default Bundles"
-
-mkdir -p "${SHARED_SUPPORT_DIR}/Default Bundles"
-
-cp -R "${SRCROOT}/SharedSupport/Default Bundles" "${SHARED_SUPPORT_DIR}"
-
-# Copy all Default Themes to build product
-rm -rf "${SHARED_SUPPORT_DIR}/Default Themes"
-mkdir -p "${SHARED_SUPPORT_DIR}/Default Themes"
+ # Remove the .ibplugin from within frameworks
+ rm -rf "${BUILD_PRODUCT}/Contents/Frameworks/ShortcutRecorder.framework/Versions/A/Resources/ShortcutRecorder.ibplugin"
-cp -R "${SRCROOT}/SharedSupport/Default Themes" "${SHARED_SUPPORT_DIR}"
-
-# Add a SpotLight comment (can't use applescript from a continuous integration server, so we manually set the binaryplist with xattr - but if this fails fall back to applescript)
-xattr -wx com.apple.metadata:kMDItemFinderComment "62 70 6C 69 73 74 30 30 5F 10 22 4D 79 53 51 4C 20 64 61 74 61 62 61 73 65 20 70 61 6E 63 61 6B 65 73 20 77 69 74 68 20 73 79 72 75 70 08 00 00 00 00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2D" "${BUILD_PRODUCT}"
-if [ $? -ne 0 ] ; then
- osascript -e "tell application \"Finder\" to set comment of (alias (POSIX file \"${BUILD_PRODUCT}\")) to \"MySQL database pancakes with syrup\""
+ set_spotlight_comment
fi
-
-FRAMEWORKS_LIST="/tmp/sp.frameworks.$$"
ls -d -1 "$FRAMEWORKS_PATH"/** > "$FRAMEWORKS_LIST"
-FILES_TO_SIGN_LIST="/tmp/sp.filelist.$$"
echo "${BUILD_PRODUCT}/Contents/Library/QuickLook/Sequel Pro.qlgenerator" >> "$FILES_TO_SIGN_LIST"
echo "${BUILD_PRODUCT}/Contents/Resources/SequelProTunnelAssistant" >> "$FILES_TO_SIGN_LIST"
echo "${BUILD_PRODUCT}" >> "$FILES_TO_SIGN_LIST"
-
# Perform distribution specific tasks if this is a 'Distribution' build
if [ "$CONFIGURATION" == 'Distribution' ]
then
- echo 'Checking for localizations to copy in, using the "ResourcesToCopy" directory...'
+ log 'Checking for localizations to copy in, using the "ResourcesToCopy" directory...'
if [ -e "${SRCROOT}/ResourcesToCopy" ]
then
TRANSLATIONS_BASE="${SRCROOT}/languagetranslations"
IBSTRINGSDIR="${SRCROOT}/ibstrings"
XIB_BASE="${SRCROOT}/Interfaces/English.lproj"
+
rm -rf "${IBSTRINGSDIR}" &> /dev/null
rm -rf "${TRANSLATIONS_BASE}" &> /dev/null
- echo "Creating IB strings files for rekeying..."
+ log "Creating IB strings files for rekeying..."
+
cp -R "${SRCROOT}/ResourcesToCopy" "${TRANSLATIONS_BASE}"
+
mkdir -p "$IBSTRINGSDIR/English.lproj"
+
find "${XIB_BASE}" \( -name "*.xib" \) | while read FILE; do
ibtool "$FILE" --export-strings-file "$IBSTRINGSDIR/English.lproj/`basename "$FILE" .xib`.strings"
done
- echo "Rekeying localization files, translating xibs, merging localizations..."
+ log "Rekeying localization files, translating xibs, merging localizations..."
+
find "${TRANSLATIONS_BASE}" \( -name "*.lproj" \) | while read FILE; do
loc=`basename "$FILE"`
+
mkdir "$IBSTRINGSDIR/$loc"
+
printf "\tProcessing: $loc\n"
+
find "$FILE" \( -name "*.strings" \) | while read STRFILE; do
+
file=`basename "$STRFILE" .strings`
ibkeyfile="$IBSTRINGSDIR/English.lproj/$file.strings"
xibfile="$XIB_BASE/$file.xib"
transfile="$IBSTRINGSDIR/$loc/$file.strings"
+
if [ -e "$ibkeyfile" ] && [ -e "$xibfile" ]; then
"${BUILT_PRODUCTS_DIR}/xibLocalizationPostprocessor" "$STRFILE" "$ibkeyfile" "$transfile"
@@ -187,22 +230,24 @@ then
rm -rf "${IBSTRINGSDIR}" &> /dev/null
rm -rf "${TRANSLATIONS_BASE}" &> /dev/null
else
- echo 'No localizations to copy.'
+ log 'No localizations to copy.'
fi
- echo 'Performing distribution build code signing...'
+ log 'Performing distribution build code signing...'
VERIFY_ERRORS=$(dist_code_sign "$FRAMEWORKS_LIST" "$FILES_TO_SIGN_LIST")
if [ "$VERIFY_ERRORS" != '' ]
then
- echo "error: Signing verification threw an error: $VERIFY_ERRORS"
- echo "error: All distribution builds must be signed with the key used for all previous distribution signing!"
+ log "error: Signing verification threw an error: $VERIFY_ERRORS"
+ log "error: All distribution builds must be signed with the key used for all previous distribution signing!"
+
+ remove_temp_files
exit 1
fi
- echo 'Running package-application.sh to package application for distribution...'
+ log 'Running package-application.sh to package application for distribution...'
"${SRCROOT}/Scripts/package-application.sh" -p "$BUILD_PRODUCT"
fi
@@ -210,7 +255,7 @@ fi
# Development build code signing
if [ "$CONFIGURATION" == 'Debug' ]
then
- echo 'Performing development build code signing...'
+ log 'Performing development build code signing...'
dev_code_sign "$FRAMEWORKS_LIST"
dev_code_sign "$FILES_TO_SIGN_LIST"
@@ -219,7 +264,6 @@ then
touch "$BUILD_PRODUCT"
fi
-rm "$FRAMEWORKS_LIST"
-rm "$FILES_TO_SIGN_LIST"
+remove_temp_files
exit 0