ysb33r
09/08/2026, 4:53 PMOperatingSystem.
Well, you don't have to suffer. You can have all that information (and more) with the Operating System plugin. It adds an extension called OS.
What's new with the latest release?
• There is a version that you can apply to settings.gradle(.kts)
• If you work with variants you can even obtain the correct values you need for operating system and machine architecture.
• If you need to look up values for OS/Arch for anything other that what Gradle is running on, you can do that do now via getOsTypes() and getArchitectures().
Hope it helps to resolve some pain for some of you. See the link for more details.
os-gradle.ysb33r.org/operatingsystem-gradle-plugin/3.0.1/usage.htmlVampire
09/08/2026, 5:06 PMOs from Ant available which is not internal, and there is also the osdetector Gradle plugin by Google. :-)ysb33r
09/08/2026, 5:08 PMtony
09/08/2026, 5:09 PMysb33r
09/08/2026, 5:11 PMosdetector last release 2023Vampire
09/08/2026, 5:23 PMysb33r
09/09/2026, 6:25 PMVampire
09/09/2026, 6:52 PMVampire
09/09/2026, 6:53 PMysb33r
09/09/2026, 6:53 PMVampire
09/09/2026, 6:55 PMPlugin<PluginAware>, then check the argument type.Vampire
09/09/2026, 6:55 PMysb33r
09/09/2026, 6:56 PMVampire
09/09/2026, 6:59 PMysb33r
09/09/2026, 7:04 PMOperatingSystem.current() internally which in turn just refers to an internal static final.
Of course with different classloaders it might actually detect more than once.
Actual code is here gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/…/OperatingSystem.java?ref_type=heads and here gitlab.com/ysb33rOrg/gradle/grolifant/-/blob/…/OperatingSystemUtils.groovy?ref_type=heads