2015-05-05 101 views
2

我有一個Xcode項目。我試圖在其中整合OcLint。但它表示沒有OCLint。如何下載並將OCLint添加到我的系統路徑中,以便我可以將OCLint集成到我的xcode項目中。OCLint不在系統路徑中

編輯:

當我有一個partof OCLint腳本

hash oclint &> /dev/null 
if [ $? -eq 1 ]; then 
echo >&2 "oclint not found, analyzing stopped" 
exit 1 
fi 

它給oclint not found, analyzing stopped

請給我一個解決方案。

回答

4

您可以從下載oclint:http://archives.oclint.org/nightly/oclint-0.9.dev.02251e4-x86_64-darwin-14.0.0.tar.gz

要integarte到您的Xcode項目ü可以使用此鏈接:http://docs.oclint.org/en/dev/guide/xcode.html

下面是我使用生成html文件中的腳本。

OCLINT_HOME是oclint下載文件夾的路徑。我已將該文件夾重命名爲oclintrelease。

OCLINT_HOME=/Users/Dheeraj/Downloads/oclintrelease 
export PATH=$OCLINT_HOME/bin:$PATH 

hash oclint &> /dev/null 
if [ $? -eq 1 ]; then 
echo >&2 "oclint not found, analyzing stopped" 
exit 1 
fi 

cd ${TARGET_TEMP_DIR} 

if [ ! -f compile_commands.json ]; then 
echo "[*] compile_commands.json not found, possibly clean was performed" 
echo "[*] starting xcodebuild to rebuild the project.." 
# clean previous output 
if [ -f xcodebuild.log ]; then 
rm xcodebuild.log 
fi 

cd ${SRCROOT} 

xcodebuild clean 

#build xcodebuild.log 
xcodebuild | tee ${TARGET_TEMP_DIR}/xcodebuild.log 
#xcodebuild <options>| tee ${TARGET_TEMP_DIR}/xcodebuild.log 

echo "[*] transforming xcodebuild.log into compile_commands.json..." 
cd ${TARGET_TEMP_DIR} 
#transform it into compile_commands.json 
oclint-xcodebuild 

fi 

echo "[*] starting analyzing" 
cd ${TARGET_TEMP_DIR} 

oclint-json-compilation-database -v oclint_args "-report-type html -o $OCLINT_HOME/report.html" 

您的報告將產生使用上面的腳本中OCLINT_HOME提供的路徑。

如果你想在你的派生數據文件夾中生成的報告,然後替換最後一行:

oclint-json-compilation-database -v oclint_args "-report-type html -o report.html" 

當且僅當您的構建是成功的,您可以檢查生成的報告路徑將生成的HTML報告並將腳本報告到Xcode的日誌導航器中。

+0

這很完美。 –

+0

即使構建失敗,是否有生成html報告的方法? –

+1

如果你的項目構建成功,那麼你可以生成。如果你的oclint構建失敗,那麼也會生成html報告。 –