OCLint报告编译器错误,因为它无法找到#import-ed头文件

问题描述 投票:0回答:1

我正在尝试集成OCLint 0.13以检查基于ObjC的iOS项目中的lint违规。

根据this guide,我在Xcode中创建了一个聚合目标来运行xcodebuild clean build,然后运行oclint-xcodebuild来生成compile_commands.json。我能够从生成的clang文件中运行compile_commands.json命令。但是,在oclint-json-compilation-database命令生成的html报告中,在处理像NEORepos/Public/ResourceObservables/NEOAggregatedObservable.h这样的文件时,我看到编译器错误,如'NEOObservables/NEOObservable.h' file not found,即使所述头文件存在于NEOObservables/Public/Observables/NEOObservable.h

enter image description here

如何摆脱这些编译器错误,这些错误会阻止我的某些源文件被隐藏?

compile_commands.json运行clang命令会生成.o文件,但是OCLint似乎无法使用json文件进行编译。我还尝试添加一些-I包含路径,但它没有帮助。欢迎提出所有建议和指示。

这是一块(编辑过的)日志......

xcode_clean_build_command = xcodebuild -workspace'Neo.xcworkspace'-scheme'NeoSampleApp'-configuration'Debug'clean build -dry-run -derivedDataPath / Users / username / Documents / git / ios-neo_linter / build / Neo -sdk iphonesimulator CLANG_ENABLE_MODULE_DEBUGGING = NO CODE_SIGNING_ALLOWED = NO CODE_SIGN_IDENTITY =''CODE_SIGNING_REQUIRED = NO ENABLE_BITCODE = NO COMPILER_INDEX_STORE_ENABLE = NO | tee xcodebuild.log

...

/ oclint-xcodebuild联编

...

生成compile_commands.json ...

挑选NEORepos / Public / ResourceObservables / NEOAggregatedObservable.m挑选NeoSampleApp / main.m

...

用于linting的入围文件(283中的2个)并创建新的compile_commands.json

...

编译/Users/username/Documents/git/ios-neo_linter/NEORepos/Public/ResourceObservables/NEOAggregatedObservable.m - 编译失败/Users/username/Documents/git/ios-neo_linter/NeoSampleApp/main.m - 成功分析/用户/ username / Documents / git / ios-neo_linter / NeoSampleApp / main.m - 完成

...

生成棉绒报告(如果有的话)......

...

执行命令:oclint-json-compilation-database -e Pods -v - -list-enabled-rules -no-analytics -enable-global-analysis -verbose --report-type html -o oclint.html -extra-arg = -Wno-一切

...

/ usr / local / bin / oclint -p / Users / username / Documents / git / ios-neo_linter -list-enabled-rules -no-analytics -enable-global-analysis -verbose --report-type html -o oclint。 html -extra-arg = -Wno-everything /Users/username/Documents/git/ios-neo_linter/NEORepos/Public/ResourceObservables/NEOAggregatedObservable.m /Users/username/Documents/git/ios-neo_linter/NeoSampleApp/main.m

objective-c xcode xcodebuild oclint
1个回答
0
投票

编译器错误是由于我使用的-dry-run标志。由于它正在干运行,它没有创建所需的.hmap文件(至少不在正确的位置)导致<blah>.h file not found错误。

但是,如果没有-dry-run,我将不得不做一个完全构建,这对我来说是不可接受的。如果我找到具有最佳性能的解决方案,将会更新。

© www.soinside.com 2019 - 2024. All rights reserved.