How to configure native builds differently on various host systems?

Is there any Gradle API to query the host operating system name? I’m trying to configure a native-binary build differently in different host environments (like “make”, where you often specify different CFLAGS for each supported build environment: one for “linux”, one for “darwin”, etc). Right now I’m using a apache.commons.lang class to query it and configure a SharedLibraryBinary in an if else block. Doesn’t seem like the most Gradle-y way of doing it… And if there is no Gradle API, still, is there a better way of doing what I’m trying to do?

just use System.getproperty directly: http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html. relavent keys:

“os.arch” Operating system architecture “os.name” Operating system name “os.version” Operating system version

Sorry, I should have mentioned that “os.name” is a bit raw and requires additional parsing. It works sure! Just ever so slightly inconvenient. Plus, that doesn’t solve the nasty if/else block. I was wondering whether Gradle might have a slightly more integrated/elegant solution. I figure this is a fairly common use case for native builds?

Sorry, I should have mentioned that “os.name” is a bit raw and requires additional parsing. It works sure! Just ever so slightly inconvenient. Plus, that doesn’t solve the nasty if/else block. I was wondering whether Gradle might have a slightly more integrated/elegant solution. I figure this is a fairly common use case for native builds?

i don’t know of anything more. maybe these guys http://lopica.sourceforge.net/os.html have some code to parse them.