Interface OperatingSystem

All Superinterfaces:
Named

public interface OperatingSystem extends Named
A machine operating system.
Values
Operating System Aliases
Windows "windows"
GNU/Linux "linux"
MacOS "osx", "mac os x", "darwin"
Solaris "solaris", "sunos"
Since:
2.2
  • Nested Class Summary

    Nested classes/interfaces inherited from interface Named

    Named.Namer
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a human-consumable display name for this operating system.
    The object's name.
    boolean
    Is this the current OS?
    boolean
    Is it FreeBSD?
    boolean
    Is it Linux?
    boolean
    Is it macOS?
    boolean
    Is it Solaris?
    boolean
    Is it Windows?
  • Method Details

    • getName

      @Input String getName()
      Description copied from interface: Named
      The object's name.

      Must be constant for the life of the object.

      Implementations should not declare a Object.toString() that returns anything other than this name. Gradle derives the name from this method wherever it needs one, but renders the object with toString() in diagnostics, so the two disagreeing produces output that contradicts the behavior it describes. This is easy to miss on an enum, which inherits a toString() returning Enum.name().

      Specified by:
      getName in interface Named
      Returns:
      The name. Never null.
    • getDisplayName

      @Internal String getDisplayName()
      Returns a human-consumable display name for this operating system.
      Since:
      2.2
    • isCurrent

      @Internal boolean isCurrent()
      Is this the current OS?
      Since:
      2.2
    • isWindows

      @Internal boolean isWindows()
      Is it Windows?
      Since:
      2.2
    • isMacOsX

      @Internal boolean isMacOsX()
      Is it macOS?
      Since:
      2.2
    • isLinux

      @Internal boolean isLinux()
      Is it Linux?
      Since:
      2.2
    • isSolaris

      @Internal boolean isSolaris()
      Is it Solaris?
      Since:
      2.2
    • isFreeBSD

      @Internal boolean isFreeBSD()
      Is it FreeBSD?
      Since:
      2.2