Tweak to XCode copy script


#1

I just tweaked the final “Copy to the different plugin folders” script to speed up my debugging life a bit. Previously XCode would copy the files every time I wanted to run the debugger, even if I hadn’t made any changes. I added a test of the modification dates before the files are copied, which saves me some seconds of waiting in that case.

EDIT: added braces to make bash happier.


# This script takes the build product and copies it to the AU, VST, and RTAS folders, depending on 
# which plugin types you've built

original=$CONFIGURATION_BUILD_DIR/$FULL_PRODUCT_NAME

# this looks inside the binary to detect which platforms are needed.. 
copyAU=`nm -g "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH" | grep -i 'AudioUnit' | wc -l`
copyVST=`nm -g "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH" | grep -i 'VSTPlugin' | wc -l`
copyRTAS=`nm -g "$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH" | grep -i 'CProcess' | wc -l`

# get paths to executable and copies in order to check modification dates
new_exe=$CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH
AU=~/Library/Audio/Plug-Ins/Components/$PRODUCT_NAME.component
VST=~/Library/Audio/Plug-Ins/VST/$PRODUCT_NAME.vst
RTAS=/Library/Application\ Support/Digidesign/Plug-Ins/$PRODUCT_NAME.dpm

if [[ $copyAU -gt 0 ]] && [[ $new_exe -nt $AU ]]; then
  echo "Copying to AudioUnit folder..."
  if [[ -d "$AU" ]]; then 
    rm -r "$AU"
  fi

  cp -r "$original" "$AU"
  sed -i "" -e 's/TDMwPTul/BNDLPTul/g' "$AU/Contents/PkgInfo"
  sed -i "" -e 's/TDMw/BNDL/g' "$AU/Contents/$INFOPLIST_FILE"
fi

if [[ $copyVST -gt 0 ]] && [[ $new_exe -nt $VST ]]; then
  echo "Copying to VST folder..."
  if [[ -d "$VST" ]]; then 
    rm -r "$VST"
  fi

  cp -r "$original" "$VST"
  sed -i "" -e 's/TDMwPTul/BNDLPTul/g' "$VST/Contents/PkgInfo"
  sed -i "" -e 's/TDMw/BNDL/g' "$VST/Contents/$INFOPLIST_FILE"
fi

if [[ $copyRTAS -gt 0 ]] && [[ $new_exe -nt $RTAS ]]; then
  echo "Copying to RTAS folder..."
  if [[ -d "$RTAS" ]]; then
    rm -r "$RTAS"
  fi

  cp -r "$original" "$RTAS"
fi

#2

I’ve been meaning to change that script to use rsync instead of cp, which should deal with that kind of issue automatically…