Operating System
Many plugin developers are familiar with the OperatingSystem internal API in Gradle. Unfortunately this remains an internal API and is subject to change.
Grolifant offers a similar public API with a small number of API differences:
- 
No
getFamilyNameandgetNativePrefixmethods. (A scan of the Gradle3.2.1codebase seem to yield no usage either). - 
No public static fields called
WINDOWS,MACOSXetc. These are now a static field calledINSTANCEon each of the specific operating system implementations. - 
getSharedLibrarySuffixandgetSharedLibraryNamehave been added. - 
Support for NetBSD.
 - 
getHomeVarto get the name of the environment variable for home directories. 
Example
OperatingSystem os = OperatingSystem.current() (1)
    File findExe = os.findInPath('bash')
    File findExe = os.findInPath('bash')
| 1 | Use current() to the operating system the code is being executed upon. | 
Operating system detection
The logic in 5.7.0 to determine an operating system is
if (OS_NAME.contains('windows')) {
    Windows.INSTANCE
} else if (OS_NAME.contains('mac os x') || OS_NAME.contains('darwin') || OS_NAME.contains('osx')) {
    MacOsX.INSTANCE
} else if (OS_NAME.contains('linux')) {
    Linux.INSTANCE
} else if (OS_NAME.contains('freebsd')) {
    FreeBSD.INSTANCE
} else if (OS_NAME.contains('sunos') || OS_NAME.contains('solaris')) {
    Solaris.INSTANCE
} else if (OS_NAME.contains('netbsd')) {
    NetBSD.INSTANCE
} else {
    // Not strictly true, but a good guess
    GenericUnix.INSTANCE
}