From 6644eb5bbb1fee9b2eadab1b98f0b3cdcdaec203 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 10 Jul 2008 15:57:56 +0000 Subject: [PATCH] properly detect MacOS X when running inside OpenJDK. Bugzilla Issue 44889 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@675623 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 4 ++++ .../org/apache/tools/ant/taskdefs/condition/Os.java | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 38177f62e..ef1917752 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -106,6 +106,10 @@ Other changes: * The resource selector has had an "any" type added for better configurability. + * Ant should detect the OS as both a Mac and a Unix system when + running on OpenJDK. + Bugzilla Report 44889. + Changes from Ant 1.7.0 TO Ant 1.7.1 ============================================= diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java index 5059185f4..279e194e4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java +++ b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java @@ -100,6 +100,13 @@ public class Os implements Condition { /** OS family that can be tested for. {@value} */ public static final String FAMILY_OS400 = "os/400"; + /** + * OpenJDK is reported to call MacOS X "Darwin" + * @see https://issues.apache.org/bugzilla/show_bug.cgi?id=44889 + * @see https://issues.apache.org/jira/browse/HADOOP-3318 + */ + private static final String DARWIN = "darwin"; + /** * Default constructor * @@ -276,13 +283,15 @@ public class Os implements Condition { } else if (family.equals(FAMILY_DOS)) { isFamily = PATH_SEP.equals(";") && !isFamily(FAMILY_NETWARE); } else if (family.equals(FAMILY_MAC)) { - isFamily = OS_NAME.indexOf(FAMILY_MAC) > -1; + isFamily = OS_NAME.indexOf(FAMILY_MAC) > -1 + || OS_NAME.indexOf(DARWIN) > -1; } else if (family.equals(FAMILY_TANDEM)) { isFamily = OS_NAME.indexOf("nonstop_kernel") > -1; } else if (family.equals(FAMILY_UNIX)) { isFamily = PATH_SEP.equals(":") && !isFamily(FAMILY_VMS) - && (!isFamily(FAMILY_MAC) || OS_NAME.endsWith("x")); + && (!isFamily(FAMILY_MAC) || OS_NAME.endsWith("x") + || OS_NAME.indexOf(DARWIN) > -1); } else if (family.equals(FAMILY_ZOS)) { isFamily = OS_NAME.indexOf(FAMILY_ZOS) > -1 || OS_NAME.indexOf("os/390") > -1;