I'm building C/C++ code with gradle under Linux (gcc) and Windows (VS10) like it's described in Building native software documentation of gradle.
The build process is fine and I can start my application. If errors occur during the build process you can see the compiler output like warnings and errors on the console. This output is additionally written to a file: build/tmp/"TaskName"/output.txt
.
The problem is that this output is not displayed on the console if the build runs without errors, nevertheless the file is written.
I'm searching for a way to display the compiler output like warnings or errors on console even if the build succeeded.
It's possible to start the gradle build with a higher log level: gradle build --info
, but there is so much addional output that I do not want.
I already tried something like the code below in the build.gradle
file to set the log level only for all compiling tasks, but it makes no difference as I would start the gradle build just with: gradle build
.
tasks.whenTaskAdded { task ->
if (task instanceof CCompile || task instanceof CppCompile) {
logging.setLevel(LogLevel.INFO)
}
}
My question:
Is there any way to get the compiler errors/warnings on the console without the overhead? Is it possible at all to set the LogLevel
for some tasks? If so what's wrong with the code above?
Any help will be appreciated.