aclaus
(Andrew)
March 15, 2019, 9:31pm
1
Versions: SonarQube 7.6, Sonar-Scanner 3.3.0.1492, SonarCFamily 6.1
What are you trying to achieve: run build-wrapper-macosx-x86 and fastlane scan together, or optimize running them separately.
I am currently running build-wrapper-macosx-x86 with xcodebuild as a shell command, then the scan command.
sh("cd .. && build-wrapper-macosx-x86 --out-dir sonar-reports xcodebuild -workspace workspace.xcworkspace -scheme scheme clean build")
scan(
scheme: "scheme",
output_directory: "./sonar-reports",
code_coverage: true,
workspace: "workspace.xcworkspace",
skip_build: true
)
However, this builds twice and takes a long time on larger projects. Ideally, fastlane will add the option to include the build-wrapper command. Until that happens, I would be happy with any recommendations to optimize the order/settings of these commands.
Is anyone else using build-wrapper-macosx-x86 with fastlane?
mpaladin
(Massimo Paladin)
March 18, 2019, 10:52am
2
Hello @aclaus ,
in order to build once you should run it externally and not plug it inside fastlane configuration file:
build-wrapper-macosx-x86 --out-dir sonar-reports
sonar-scanner -D sonar.cfamily.build-wrapper-output=sonar-reports …
brbsBruno
(Bruno)
December 27, 2019, 4:31pm
3
Hi,
I discovered a way to use the build wrapper
in the same build of the Fastlane scan.
You can use the xcodebuild_command
parameter like this:
scan(scheme: "scheme",
output_directory: "./sonar-reports",
code_coverage: true,
workspace: "workspace.xcworkspace",
skip_build: true,
xcodebuild_command: "env NSUnbufferedIO=YES build-wrapper-macosx-x86 --out-dir ./build/build_wrapper_output xcodebuild")
I found this on Github , applied in my mixed objective-c/swift project and it’s working fine.
3 Likes
aclaus
(Andrew)
December 27, 2019, 5:52pm
4
@brbsBruno Excellent find! Thanks for updating!
I ended up doing it the other way around, and found it worked. Calling fast lane with the build-wrapper.
bash: ‘build-wrapper-macosx-x86 --out-dir sonar-reports bundle exec fastlane test’
2 Likes