Conditional configuration based on operating system

( #1

Hi, I would like to change the configuration of a given task based on the operating system. To be specific, I’m using the protobuf plugin which has a property that defines the location of the protobuf compiler to be invoked. I need to do something like the following:

if (runningOnWindows()) {
    protocPath = 'tools/protoc'
} else {
    protocPath = "${pathToProtoc}"

Is there an easy way to implement the runningOnWindows method?

(René Groeschke) #2

Hey, you can do something like this in your build script:

String osName = System.getProperty("").toLowerCase();
if (osName.contains("windows")) {

regards, René

( #3

That works great.

Thanks very much.