oclint-xcodebuild Manual¶
For developers who use Xcode, oclint-xcodebuild
is a helpful program that extracts adequate compiler options from xcodebuild
execution log, converts them into JSON Compilation Database format, and save it into compile_commands.json
file.
See also
Read Apple’s official xcodebuild Manual Page from Mac Developer Library. To understand how oclint-xcodebuild
can be applied in your workflow, please move onto Using OCLint with xcodebuild document.
Running oclint-xcodebuild¶
If a xcodebuild.log
file is at the current working directory. Simply run
oclint-xcodebuild
In case the xcodebuild log is stored in a file with name other than xcodebuild.log
, append the path to the log file like
oclint-xcodebuild /path/to/xcodebuild/log
When certain files are compiled by Xcode but we want to exclude them from the compilation database, we could filter them out by
oclint-xcodebuild -e <exclude_pattern_regex> -l </path/to/xcodebuild/log>
The compile_commands.json
will be generated to the current working directory.
Warning
It’s highly recommended to avoid having spaces in your file name or file path. It’s a good practice. Meanwhile, even though oclint
itself supports spaces in path, oclint-json-compilation-database
and oclint-xcodebuild
still have issues handling spaces in path.
Note
oclint-xcodebuild
is still an experimental project. The success of it depends on various things, e.g. Mac OS X version, the Xcode version and project settings. However, since developers who use Xcode are familiar with Apple’s manner of supporting only the latest version and one previous version, so oclint-xcodebuild
tries to follow this convention. Your feedback is warmly welcome to help improve this helper program.