How to set compiler arguments based on a condition?


In my build.gradle, I want to set c compiler flag based on the output of a command. To be specific, I want to enable below compiler option (Wno-address) only when BullsEye coverage is enabled.

            if (toolChain in Gcc) {
                    _cCompiler.args '-Wno-address'

I can check whether BullsEye is enabled or not from the return value of below command.

#/usr/local/bullseye/bin/cov01 --status
#echo $?
0 ==> enabled
1 ==> disabled

How can I add this logic in the build.gradle to add Wno-address compiler argument only when BullsEye is enabled ?