FRAMEWORK_FILENAME="LookinServer.framework"
FRAMEWORK_WORKPATH="${CODESIGNING_FOLDER_PATH}/Frameworks"

# Define that LookinServer.framework is at the root directory of your Xcode project. If you want to move LookinServer.framework to a subdirectory named "FavoriteFrameworks", replace the line below with 'FRAMEWORK_PATH="${SRCROOT}/FavoriteFrameworks/${FRAMEWORK_FILENAME}"', and add "$(SRCROOT)/FavoriteFrameworks" to "Framework Search Paths" in "Build Settings" tab. 
FRAMEWORK_PATH="${SRCROOT}/${FRAMEWORK_FILENAME}"

# If configuration is not "Debug", do not integrate LookinServer.framework
[ "${CONFIGURATION}" != "Debug" ] && exit 0

# If you want to use Lookin both in "Debug" and another configuration(e.g. "DailyTest"), comment the line above and uncomment the line below. Be careful not to integrate LookinServer in "Release" configuration.
# [ "${CONFIGURATION}" != "Debug" ] && [ "${CONFIGURATION}" != "DailyTest" ] && exit 0

mkdir -p "${FRAMEWORK_WORKPATH}"

if [ -e "${FRAMEWORK_PATH}" ]; then
    cp -Rf "$FRAMEWORK_PATH" "${FRAMEWORK_WORKPATH}"
    if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" ]; then
    	codesign -fs "${EXPANDED_CODE_SIGN_IDENTITY}" "${FRAMEWORK_WORKPATH}/${FRAMEWORK_FILENAME}"
    fi
    echo "LookinServer was integrated successfully."
else
    echo "Failed to integrate LookinServer. Because the framework could not be found at ${FRAMEWORK_PATH}."
fi