???????????????Xcode Plugin??Clang scan-build Plugin???iOS?????????????????????Щ???????????????????????????????????????????????????о????????Щ?????У???????????????????????????????????????????????????iOS???????????????????????????д????????£??????ο???

????#????????·??

????WORKSPACE_PATH=`pwd`
????SCAN_BUILD_PATH=~/dev-tools/clang/llvm/tools/clang/tools/scan-build/scan-build
????CLANG_PATH=/usr/bin/clang
????XCODEBUILD_PATH=/usr/bin/xcodebuild
????XCRUN_PATH=/usr/bin/xcrun

????#????????????????????????????????????????

????#??????????????????

????ERROR_COUNT=0

????#??????Target????

????APP_TARGET=

????#????????Test Target????

????#APP_TEST_TARGET=

????SIMULATOR_SDK=iphonesimulator6.0

????OS_SDK=iphoneos6.0

????#?????????????mobileprovision???λ??

????MOBILEPROVISION_PATH=

????#??????????????????

????PASSWORD=

????cd ${WORKSPACE_PATH}

????#??о?????????

????rm -rf scan.output

????rm -rf ${WORKSPACE_PATH}/clangScanBuildReports

????${SCAN_BUILD_PATH} -k -v -v -o ${WORKSPACE_PATH}/clangScanBuildReports --use-analyzer ${CLANG_PATH} xcodebuild -target ${APP_TARGET} -configuration Debug -sdk ${SIMULATOR_SDK} clean build | tee scan.output

????ACC_ERROR_COUNT=`grep -E '^scan-build: ([0-9]+) bugs found' scan.output | awk '{print $2}'`

????#????????????????????????????????????????????????????????????????????

????if [ ${ACC_ERROR_COUNT} -gt ${ERROR_COUNT} ]; then

????echo "scan-build found ${ACC_ERROR_COUNT} bugs?? larger than ${ERROR_COUNT}. Please check..."

????exit 1

????fi

????#????????????????л?????????????????