I am using following commands to use the oclint with xcode 5-
Step1: xcodebuild -target OClintDemo -configuration Debug -scheme OClintDemo -sdk iphonesimulator
Step2: OClintDemo jenkins$ xcodebuild -sdk iphonesimulator | tee xcodebuild.log
Step3: oclint-xcodebuild xcodebuild.log
Step4: oclint-json-compilation-database -- -o=report.html
but i am getting compile_commands.json empty file, and report.html contains following- OCLint Report Summary: TotalFiles=0 FilesWithViolations=0 P1=0 P2=0 P3=0 [OCLint (http://oclint.org) v0.7]
Xcode 8 does not support xctool, you can use xcpretty. Your xcodebuild command should be like this
If you are using a workspace
xcodebuild -workspace WORKSPACE_NAME.xcworkspace -scheme SELECTED_SCHEME | xcpretty -r json-compilation-database --output compile_commands.json
For a single project
xcodebuild -project PROJECT_NAME.xcodeproj | xcpretty -r json-compilation-database --output compile_commands.json
Here's how I got a proper compile_commands.json
file (Xcode 8.3)
Clean your build
xcodebuild clean -workspace WORKSPACE.xcworkspace/ -scheme "SCHEME"
This ensures xcodebuild recompiles all of your files, which would then make them appear in the compilation database.
Build and generate compile_commands.json:
xcodebuild -workspace WORKSPACE.xcworkspace/ -scheme "SCHEME" | xcpretty -r json-compilation-database -o compile_commands.json
You should obviously replace the workspace and scheme with your projects values. You can also run this against a project by using -project
instead of -workspace
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With