2015-05-05 102 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报告。 –