How to make gradle print or write all executed compiler commands?

I am trying to see the exact compiler commands (in my case gcc) used by gradle during all build tasks. Executing with --debugdoes not output these commands, and the output files in build / tmp also do not have them. I am currently using gradle 2.6

+4
source share
2 answers

Cm. $projectDir/build/tmp

You should have a folder structure that looks something like this:

β”œβ”€β”€β”€compileMainSharedLibraryMainCpp
β”‚       options.txt
β”‚       output.txt
β”‚
β”œβ”€β”€β”€compileMainStaticLibraryMainCpp
β”‚       options.txt
β”‚       output.txt
β”‚
β”œβ”€β”€β”€createMainStaticLibrary
β”‚       options.txt
β”‚       output.txt
β”‚
└───linkMainSharedLibrary
        options.txt
        output.txt

options.txtcontains parameters passed to the compiler / linker, etc., and output.txtcontains the output of the compiler / linker.

+4
source

The following snippet in build.gradle displays the parameters (not a complete command line):

toolChains {
    gcc(Gcc) {
        eachPlatform { 
            cppCompiler.withArguments { args ->
                println "----> C++ args: " + args
            }
        }
    }
}    
0

Source: https://habr.com/ru/post/1619680/


All Articles