if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
fi
if [ ! -f "${TARGET_TEMP_DIR}"/xcodebuild.log ]; then
echo "[*] xcodebuild.log not found, possibly clean was performed"
echo "[*] starting xcodebuild to rebuild the project.."
cd "${SRCROOT}"
xcodebuild clean -configuration "${CONFIGURATION}" -project "${PROJECT_NAME}".xcodeproj
#build xcodebuild.log
xcodebuild -configuration "${CONFIGURATION}" -project "${PROJECT_NAME}".xcodeproj | tee "${TARGET_TEMP_DIR}"/xcodebuild.log
fi
cd "${TARGET_TEMP_DIR}"
echo "[*] transforming xcodebuild.log into compile_commands.json..."
#transform it into compile_commands.json
oclint-xcodebuild
echo "[*] starting analyzing"
oclint-json-compilation-database -- -p "${TARGET_TEMP_DIR}" | sed -E 's/(.*\.(c|m{1,2}):[0-9]*:[0-9]*:)/\1 warning:/'