2

我有一个 Xcode 项目。我试图融入OcLint其中。但它说没有 OCLint。如何下载并添加OCLint到我的系统路径,以便我可以集成OCLint到我的 xcode 项目中。

编辑:

当我有 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

1 回答 1

4

您可以从以下网址下载 oclint:http: //archives.oclint.org/nightly/oclint-0.9.dev.02251e4-x86_64-darwin-14.0.0.tar.gz

要集成到您的 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"

当且仅当您的构建成功并且您可以将生成的报告路径和脚本报告检查到 Xcode 的 Log Navigator 时,才会生成 HTML 报告。

于 2015-05-05T12:35:04.420 回答