ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types CommandlineJava.java SourceFileScanner.java
Date Sat, 02 Mar 2002 04:03:37 GMT
adammurdoch    02/03/01 20:03:37

  Modified:    proposal/myrmidon/src/java/org/apache/antlib/nativelib
                        Exec.java
               proposal/myrmidon/src/java/org/apache/antlib/vfile
                        CopyFilesTask.java
               proposal/myrmidon/src/java/org/apache/aut/nativelib Os.java
               proposal/myrmidon/src/java/org/apache/aut/nativelib/impl
                        DefaultExecManager.java Environment.java
               proposal/myrmidon/src/java/org/apache/aut/tar TarEntry.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        DependSet.java Javac.java PathConvert.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc
                        Javadoc.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional
                        Cab.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text
                        FixCRLF.java
               proposal/myrmidon/src/main/org/apache/tools/ant/types
                        CommandlineJava.java SourceFileScanner.java
  Added:       proposal/myrmidon/src/java/org/apache/aut/nativelib
                        OsFamily.java
  Log:
  * Added OsFamily enumerated type, to represents OS groupings.
  * Replaced all usages of Os.isFamily( String ) with Os.isFamily( OsFamily ).
  * Replaced all usages of "os.name" system properties with calls to Os.isFamily().
  
  Revision  Changes    Path
  1.12      +1 -2      jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java
  
  Index: Exec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/nativelib/Exec.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Exec.java	10 Feb 2002 01:01:12 -0000	1.11
  +++ Exec.java	2 Mar 2002 04:03:36 -0000	1.12
  @@ -72,8 +72,7 @@
       }
   
       /**
  -     * Only execute the process if <code>os.name</code> is included in this
  -     * string.
  +     * Only execute the process if running on the specified OS family.
        */
       public void setOs( final String os )
       {
  
  
  
  1.3       +5 -3      jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/vfile/CopyFilesTask.java
  
  Index: CopyFilesTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/vfile/CopyFilesTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CopyFilesTask.java	27 Feb 2002 12:05:36 -0000	1.2
  +++ CopyFilesTask.java	2 Mar 2002 04:03:36 -0000	1.3
  @@ -14,6 +14,7 @@
   import org.apache.aut.vfs.FileObject;
   import org.apache.aut.vfs.FileSystemException;
   import org.apache.aut.vfs.FileType;
  +import org.apache.aut.vfs.NameScope;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.api.AbstractTask;
  @@ -129,9 +130,10 @@
                           continue;
                       }
   
  -                    // TODO - use scope here, to make sure that the result
  -                    // is a descendent of the dest dir
  -                    final FileObject destFile = m_destDir.resolveFile( path );
  +                    // Locate the destination file
  +                    final FileObject destFile = m_destDir.resolveFile( path, NameScope.DESCENDENT
);
  +
  +                    // Copy the file across
                       copyFile( srcFile, destFile );
                   }
               }
  
  
  
  1.3       +180 -47   jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/nativelib/Os.java
  
  Index: Os.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/nativelib/Os.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Os.java	20 Jan 2002 17:32:58 -0000	1.2
  +++ Os.java	2 Mar 2002 04:03:36 -0000	1.3
  @@ -7,9 +7,11 @@
    */
   package org.apache.aut.nativelib;
   
  +import java.util.ArrayList;
  +import java.util.HashSet;
  +import java.util.List;
   import java.util.Locale;
  -import org.apache.avalon.excalibur.i18n.ResourceManager;
  -import org.apache.avalon.excalibur.i18n.Resources;
  +import java.util.Set;
   
   /**
    * Class to help determining the OS.
  @@ -20,9 +22,6 @@
    */
   public class Os
   {
  -    private final static Resources REZ =
  -        ResourceManager.getPackageResources( Os.class );
  -
       private final static String OS_NAME =
           System.getProperty( "os.name" ).toLowerCase( Locale.US );
       private final static String OS_ARCH =
  @@ -31,6 +30,123 @@
           System.getProperty( "os.version" ).toLowerCase( Locale.US );
       private final static String PATH_SEP =
           System.getProperty( "path.separator" );
  +    private final static OsFamily OS_FAMILY;
  +    private final static OsFamily[] OS_ALL_FAMILIES;
  +
  +    /** All Windows based OSes. */
  +    public final static OsFamily OS_FAMILY_WINDOWS = new OsFamily( "windows" );
  +
  +    /** All DOS based OSes. */
  +    public final static OsFamily OS_FAMILY_DOS
  +        = new OsFamily( "dos", new OsFamily[]{OS_FAMILY_WINDOWS} );
  +
  +    /** All Windows NT based OSes. */
  +    public final static OsFamily OS_FAMILY_WINNT
  +        = new OsFamily( "nt", new OsFamily[]{OS_FAMILY_WINDOWS} );
  +
  +    /** All Windows 9x based OSes. */
  +    public final static OsFamily OS_FAMILY_WIN9X
  +        = new OsFamily( "win9x", new OsFamily[]{OS_FAMILY_WINDOWS, OS_FAMILY_DOS} );
  +
  +    /** OS/2 */
  +    public final static OsFamily OS_FAMILY_OS2
  +        = new OsFamily( "os/2", new OsFamily[]{OS_FAMILY_DOS} );
  +
  +    /** Netware */
  +    public final static OsFamily OS_FAMILY_NETWARE
  +        = new OsFamily( "netware" );
  +
  +    /** All UNIX based OSes. */
  +    public final static OsFamily OS_FAMILY_UNIX
  +        = new OsFamily( "unix" );
  +
  +    /** All Mac based OSes. */
  +    public final static OsFamily OS_FAMILY_MAC
  +        = new OsFamily( "mac" );
  +
  +    /** OSX */
  +    public final static OsFamily OS_FAMILY_OSX
  +        = new OsFamily( "osx", new OsFamily[]{OS_FAMILY_UNIX, OS_FAMILY_MAC} );
  +
  +    private final static OsFamily[] ALL_FAMILIES =
  +        {
  +            OS_FAMILY_DOS,
  +            OS_FAMILY_MAC,
  +            OS_FAMILY_NETWARE,
  +            OS_FAMILY_OS2,
  +            OS_FAMILY_OSX,
  +            OS_FAMILY_UNIX,
  +            OS_FAMILY_WINDOWS,
  +            OS_FAMILY_WINNT,
  +            OS_FAMILY_WIN9X
  +        };
  +
  +    static
  +    {
  +        // Determine the most specific OS family
  +        if( OS_NAME.indexOf( "windows" ) > -1 )
  +        {
  +            if( OS_NAME.indexOf( "xp" ) > -1
  +                || OS_NAME.indexOf( "2000" ) > -1
  +                || OS_NAME.indexOf( "nt" ) > -1 )
  +            {
  +                OS_FAMILY = OS_FAMILY_WINNT;
  +            }
  +            else
  +            {
  +                OS_FAMILY = OS_FAMILY_WIN9X;
  +            }
  +        }
  +        else if( OS_NAME.indexOf( "os/2" ) > -1 )
  +        {
  +            OS_FAMILY = OS_FAMILY_OS2;
  +        }
  +        else if( OS_NAME.indexOf( "netware" ) > -1 )
  +        {
  +            OS_FAMILY = OS_FAMILY_NETWARE;
  +        }
  +        else if( OS_NAME.indexOf( "mac" ) > -1 )
  +        {
  +            if( OS_NAME.endsWith( "x" ) )
  +            {
  +                OS_FAMILY = OS_FAMILY_OSX;
  +            }
  +            else
  +            {
  +                OS_FAMILY = OS_FAMILY_MAC;
  +            }
  +        }
  +        else if( PATH_SEP.equals( ":" ) )
  +        {
  +            OS_FAMILY = OS_FAMILY_UNIX;
  +        }
  +        else
  +        {
  +            OS_FAMILY = null;
  +        }
  +
  +        // Otherwise, unknown OS
  +
  +        // Determine all families the current OS belongs to
  +        Set allFamilies = new HashSet();
  +        if( OS_FAMILY != null )
  +        {
  +            List queue = new ArrayList();
  +            queue.add( OS_FAMILY );
  +            while( queue.size() > 0 )
  +            {
  +                final OsFamily family = (OsFamily)queue.remove( 0 );
  +                allFamilies.add( family );
  +                final OsFamily[] families = family.getFamilies();
  +                for( int i = 0; i < families.length; i++ )
  +                {
  +                    OsFamily parent = families[ i ];
  +                    queue.add( parent );
  +                }
  +            }
  +        }
  +        OS_ALL_FAMILIES = (OsFamily[])allFamilies.toArray( new OsFamily[ allFamilies.size()
] );
  +    }
   
       /**
        * Private constructor to block instantiation.
  @@ -45,28 +161,21 @@
        */
       public static boolean isVersion( final String version )
       {
  -        return isOs( null, null, null, version );
  +        return isOs( (OsFamily)null, null, null, version );
       }
   
       /**
        * Determines if the OS on which Ant is executing matches the given OS
        * architecture.
  -     *
  -     * @param arch Description of Parameter
  -     * @return The Arch value
        */
       public static boolean isArch( final String arch )
       {
  -        return isOs( null, null, arch, null );
  +        return isOs( (OsFamily)null, null, arch, null );
       }
   
       /**
        * Determines if the OS on which Ant is executing matches the given OS
        * family.
  -     *
  -     * @param family Description of Parameter
  -     * @return The Family value
  -     * @since 1.5
        */
       public static boolean isFamily( final String family )
       {
  @@ -74,6 +183,15 @@
       }
   
       /**
  +     * Determines if the OS on which Ant is executing matches the given OS
  +     * family.
  +     */
  +    public static boolean isFamily( final OsFamily family )
  +    {
  +        return isOs( family, null, null, null );
  +    }
  +
  +    /**
        * Determines if the OS on which Ant is executing matches the given OS name.
        *
        * @param name Description of Parameter
  @@ -82,7 +200,7 @@
        */
       public static boolean isName( final String name )
       {
  -        return isOs( null, name, null, null );
  +        return isOs( (OsFamily)null, name, null, null );
       }
   
       /**
  @@ -100,6 +218,24 @@
                                   final String arch,
                                   final String version )
       {
  +        return isOs( getFamily( family ), name, arch, version );
  +    }
  +
  +    /**
  +     * Determines if the OS on which Ant is executing matches the given OS
  +     * family, name, architecture and version
  +     *
  +     * @param family The OS family
  +     * @param name The OS name
  +     * @param arch The OS architecture
  +     * @param version The OS version
  +     * @return The Os value
  +     */
  +    public static boolean isOs( final OsFamily family,
  +                                final String name,
  +                                final String arch,
  +                                final String version )
  +    {
           if( family != null || name != null || arch != null || version != null )
           {
               final boolean isFamily = familyMatches( family );
  @@ -115,6 +251,25 @@
           }
       }
   
  +    /**
  +     * Locates an OsFamily by name (case-insensitive).
  +     *
  +     * @return the OS family, or null if not found.
  +     */
  +    public static OsFamily getFamily( final String name )
  +    {
  +        for( int i = 0; i < ALL_FAMILIES.length; i++ )
  +        {
  +            final OsFamily osFamily = ALL_FAMILIES[ i ];
  +            if( osFamily.getName().equalsIgnoreCase( name ) )
  +            {
  +                return osFamily;
  +            }
  +        }
  +
  +        return null;
  +    }
  +
       private static boolean versionMatches( final String version )
       {
           boolean isVersion = true;
  @@ -145,42 +300,20 @@
           return isName;
       }
   
  -    private static boolean familyMatches( final String family )
  +    private static boolean familyMatches( final OsFamily family )
       {
  -        boolean isFamily = true;
  -        if( family != null )
  +        if( family == null )
           {
  -            if( family.equals( "windows" ) )
  -            {
  -                isFamily = OS_NAME.indexOf( "windows" ) > -1;
  -            }
  -            else if( family.equals( "os/2" ) )
  -            {
  -                isFamily = OS_NAME.indexOf( "os/2" ) > -1;
  -            }
  -            else if( family.equals( "netware" ) )
  -            {
  -                isFamily = OS_NAME.indexOf( "netware" ) > -1;
  -            }
  -            else if( family.equals( "dos" ) )
  -            {
  -                isFamily = PATH_SEP.equals( ";" ) && !isFamily( "netware" );
  -            }
  -            else if( family.equals( "mac" ) )
  -            {
  -                isFamily = OS_NAME.indexOf( "mac" ) > -1;
  -            }
  -            else if( family.equals( "unix" ) )
  -            {
  -                isFamily = PATH_SEP.equals( ":" ) &&
  -                    ( !isFamily( "mac" ) || OS_NAME.endsWith( "x" ) );
  -            }
  -            else
  +            return false;
  +        }
  +        for( int i = 0; i < OS_ALL_FAMILIES.length; i++ )
  +        {
  +            final OsFamily osFamily = OS_ALL_FAMILIES[ i ];
  +            if( family == osFamily )
               {
  -                final String message = REZ.getString( "unknown-os-family", family );
  -                throw new IllegalArgumentException( message );
  +                return true;
               }
           }
  -        return isFamily;
  +        return false;
       }
   }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/nativelib/OsFamily.java
  
  Index: OsFamily.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.aut.nativelib;
  
  /**
   * An enumerated type, which represents an OS family.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/03/02 04:03:36 $
   */
  public final class OsFamily
  {
      private final String m_name;
      private final OsFamily[] m_families;
  
      OsFamily( final String name )
      {
          m_name = name;
          m_families = new OsFamily[0];
      }
  
      OsFamily( final String name, final OsFamily[] families )
      {
          m_name = name;
          m_families = families;
      }
  
      /**
       * Returns the name of this family.
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * Returns the OS families that this family belongs to.
       */
      public OsFamily[] getFamilies()
      {
          return m_families;
      }
  }
  
  
  
  1.10      +13 -23    jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/nativelib/impl/DefaultExecManager.java
  
  Index: DefaultExecManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/nativelib/impl/DefaultExecManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DefaultExecManager.java	2 Mar 2002 01:07:13 -0000	1.9
  +++ DefaultExecManager.java	2 Mar 2002 04:03:36 -0000	1.10
  @@ -11,7 +11,6 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  -import java.util.Locale;
   import java.util.Properties;
   import org.apache.aut.nativelib.ExecException;
   import org.apache.aut.nativelib.ExecManager;
  @@ -32,7 +31,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:thomas.haas@softwired-inc.com">Thomas Haas</a>
  - * @version $Revision: 1.9 $ $Date: 2002/03/02 01:07:13 $
  + * @version $Revision: 1.10 $ $Date: 2002/03/02 04:03:36 $
    * @see ExecManager
    * @see ExecMetaData
    * @see Environment
  @@ -174,37 +173,28 @@
       {
           CommandLauncher launcher = null;
   
  -        if( Os.isFamily( "mac" ) )
  +        if( Os.isFamily( Os.OS_FAMILY_MAC ) )
           {
               // Mac
               launcher = new MacCommandLauncher();
           }
  -        else if( Os.isFamily( "os/2" ) )
  +        else if( Os.isFamily( Os.OS_FAMILY_OS2 ) )
           {
               // OS/2 - use same mechanism as Windows 2000
               launcher = new WinNTCommandLauncher();
           }
  -        else if( Os.isFamily( "windows" ) )
  +        else if( Os.isFamily( Os.OS_FAMILY_WINNT ) )
           {
  -            // Windows.  Need to determine which JDK we're running in
  -
  -            // Determine if we're running under 2000/NT or 98/95
  -            final String osname =
  -                System.getProperty( "os.name" ).toLowerCase( Locale.US );
  -
  -            if( osname.indexOf( "nt" ) >= 0 || osname.indexOf( "2000" ) >= 0 )
  -            {
  -                // Windows 2000/NT
  -                launcher = new WinNTCommandLauncher();
  -            }
  -            else
  -            {
  -                // Windows 98/95 - need to use an auxiliary script
  -                final String script = resolveCommand( homeDir, "bin/antRun.bat" );
  -                launcher = new ScriptCommandLauncher( script );
  -            }
  +            // Windows 2000/NT
  +            launcher = new WinNTCommandLauncher();
  +        }
  +        else if( Os.isFamily( Os.OS_FAMILY_WINDOWS ) )
  +        {
  +            // Windows 98/95 - need to use an auxiliary script
  +            final String script = resolveCommand( homeDir, "bin/antRun.bat" );
  +            launcher = new ScriptCommandLauncher( script );
           }
  -        else if( Os.isFamily( "netware" ) )
  +        else if( Os.isFamily( Os.OS_FAMILY_NETWARE ) )
           {
               // NetWare.  Need to determine which JDK we're running in
               final String perlScript = resolveCommand( homeDir, "bin/antRun.pl" );
  
  
  
  1.5       +13 -20    jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/nativelib/impl/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/nativelib/impl/Environment.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Environment.java	2 Mar 2002 01:07:13 -0000	1.4
  +++ Environment.java	2 Mar 2002 04:03:36 -0000	1.5
  @@ -12,14 +12,13 @@
   import java.io.File;
   import java.io.IOException;
   import java.io.StringReader;
  -import java.util.Locale;
   import java.util.Properties;
   import org.apache.aut.nativelib.ExecException;
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.aut.nativelib.ExecMetaData;
   import org.apache.aut.nativelib.Os;
  -import org.apache.avalon.excalibur.util.StringUtil;
   import org.apache.avalon.excalibur.io.IOUtil;
  +import org.apache.avalon.excalibur.util.StringUtil;
   
   /**
    * This is the class that can be used to retrieve the environment
  @@ -27,7 +26,7 @@
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
    * @author <a href="mailto:thomas.haas@softwired-inc.com">Thomas Haas</a>
  - * @version $Revision: 1.4 $ $Date: 2002/03/02 01:07:13 $
  + * @version $Revision: 1.5 $ $Date: 2002/03/02 04:03:36 $
    */
   final class Environment
   {
  @@ -178,33 +177,27 @@
       private static String[] getEnvCommand()
           throws ExecException
       {
  -        if( Os.isFamily( "os/2" ) )
  +        if( Os.isFamily( Os.OS_FAMILY_OS2 ) )
           {
               // OS/2 - use same mechanism as Windows 2000
               return CMD_EXE;
           }
  -        else if( Os.isFamily( "windows" ) )
  +        else if( Os.isFamily( Os.OS_FAMILY_WINNT ) )
           {
  -            final String osname =
  -                System.getProperty( "os.name" ).toLowerCase( Locale.US );
  -            // Determine if we're running under 2000/NT or 98/95
  -            if( osname.indexOf( "nt" ) >= 0 || osname.indexOf( "2000" ) >= 0 )
  -            {
  -                // Windows 2000/NT
  -                return CMD_EXE;
  -            }
  -            else
  -            {
  -                // Windows 98/95 - need to use an auxiliary script
  -                return COMMAND_COM;
  -            }
  +            // Windows 2000/NT
  +            return CMD_EXE;
  +        }
  +        else if( Os.isFamily( Os.OS_FAMILY_WINDOWS) )
  +        {
  +            // Windows 98/95 - need to use an auxiliary script
  +            return COMMAND_COM;
           }
  -        else if( Os.isFamily( "unix" ) )
  +        else if( Os.isFamily( Os.OS_FAMILY_UNIX ) )
           {
               // Generic UNIX
               return ENV_CMD;
           }
  -        else if( Os.isFamily( "netware" ) )
  +        else if( Os.isFamily( Os.OS_FAMILY_NETWARE ) )
           {
               return ENV_RAW;
           }
  
  
  
  1.4       +18 -25    jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/tar/TarEntry.java
  
  Index: TarEntry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/aut/tar/TarEntry.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TarEntry.java	28 Jan 2002 09:21:52 -0000	1.3
  +++ TarEntry.java	2 Mar 2002 04:03:36 -0000	1.4
  @@ -9,6 +9,7 @@
   
   import java.io.File;
   import java.util.Date;
  +import org.apache.aut.nativelib.Os;
   
   /**
    * This class represents an entry in a Tar archive. It consists of the entry's
  @@ -178,37 +179,29 @@
           m_file = file;
   
           String name = file.getPath();
  -        final String osname = System.getProperty( "os.name" );
   
  -        if( osname != null )
  +        // Strip off drive letters!
  +        if( Os.isFamily( Os.OS_FAMILY_WINDOWS) )
           {
  -            // Strip off drive letters!
  -            // REVIEW Would a better check be "(File.separator == '\')"?
  -            final String win32Prefix = "Windows";
  -            final String prefix = osname.substring( 0, win32Prefix.length() );
  -
  -            if( prefix.equalsIgnoreCase( win32Prefix ) )
  +            if( name.length() > 2 )
               {
  -                if( name.length() > 2 )
  -                {
  -                    final char ch1 = name.charAt( 0 );
  -                    final char ch2 = name.charAt( 1 );
  +                final char ch1 = name.charAt( 0 );
  +                final char ch2 = name.charAt( 1 );
   
  -                    if( ch2 == ':' &&
  -                        ( ( ch1 >= 'a' && ch1 <= 'z' ) ||
  -                        ( ch1 >= 'A' && ch1 <= 'Z' ) ) )
  -                    {
  -                        name = name.substring( 2 );
  -                    }
  +                if( ch2 == ':' &&
  +                    ( ( ch1 >= 'a' && ch1 <= 'z' ) ||
  +                    ( ch1 >= 'A' && ch1 <= 'Z' ) ) )
  +                {
  +                    name = name.substring( 2 );
                   }
               }
  -            else if( osname.toLowerCase().indexOf( "netware" ) > -1 )
  +        }
  +        else if( Os.isFamily( Os.OS_FAMILY_NETWARE) )
  +        {
  +            final int colon = name.indexOf( ':' );
  +            if( colon != -1 )
               {
  -                final int colon = name.indexOf( ':' );
  -                if( colon != -1 )
  -                {
  -                    name = name.substring( colon + 1 );
  -                }
  +                name = name.substring( colon + 1 );
               }
           }
   
  @@ -584,7 +577,7 @@
       /**
        * Write an entry's header information to a header buffer.
        *
  -     * @param outbuf The tar entry header buffer to fill in.
  +     * @param buffer The tar entry header buffer to fill in.
        */
       public void writeEntryHeader( final byte[] buffer )
       {
  
  
  
  1.14      +2 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java
  
  Index: DependSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DependSet.java	6 Feb 2002 13:38:20 -0000	1.13
  +++ DependSet.java	2 Mar 2002 04:03:36 -0000	1.14
  @@ -60,7 +60,7 @@
    *
    *
    * @author <a href="mailto:cstrong@arielpartners.com">Craeg Strong</a>
  - * @version $Revision: 1.13 $ $Date: 2002/02/06 13:38:20 $
  + * @version $Revision: 1.14 $ $Date: 2002/03/02 04:03:36 $
    */
   public class DependSet extends MatchingTask
   {
  @@ -141,7 +141,7 @@
            * be able to check file modification times.
            * (Windows has a max resolution of two secs for modification times)
            */
  -        if( Os.isFamily( "windows" ) )
  +        if( Os.isFamily( Os.OS_FAMILY_WINDOWS ) )
           {
               now += 2000;
           }
  
  
  
  1.29      +2 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Javac.java	18 Feb 2002 09:02:39 -0000	1.28
  +++ Javac.java	2 Mar 2002 04:03:36 -0000	1.29
  @@ -12,7 +12,6 @@
   import java.util.Iterator;
   import org.apache.aut.nativelib.Os;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.framework.JavaVersion;
   import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
   import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
  @@ -726,7 +725,7 @@
       {
           // This is the most common extension case - exe for windows and OS/2,
           // nothing for *nix.
  -        String extension = Os.isFamily( "dos" ) ? ".exe" : "";
  +        String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : "";
   
           // Look for java in the java.home/../bin directory.  Unfortunately
           // on Windows java.home doesn't always refer to the correct location,
  @@ -736,7 +735,7 @@
               new java.io.File( System.getProperty( "java.home" ) +
                                 "/../bin/javac" + extension );
   
  -        if( jExecutable.exists() && !Os.isFamily( "netware" ) )
  +        if( jExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) )
           {
               return jExecutable.getAbsolutePath();
           }
  
  
  
  1.17      +4 -6      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
  
  Index: PathConvert.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- PathConvert.java	21 Feb 2002 09:41:54 -0000	1.16
  +++ PathConvert.java	2 Mar 2002 04:03:36 -0000	1.17
  @@ -9,6 +9,7 @@
   
   import java.io.File;
   import java.util.ArrayList;
  +import org.apache.aut.nativelib.Os;
   import org.apache.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.types.Path;
  @@ -45,7 +46,7 @@
       /**
        * Override the default path separator string for the target os
        *
  -     * @param sep The new PathSep value
  +     * @param pathSep The new PathSep value
        */
       public void setPathSep( final String pathSep )
       {
  @@ -64,7 +65,7 @@
       /**
        * Set the value of the targetos attribute
        *
  -     * @param target The new Targetos value
  +     * @param targetOS The new Targetos value
        */
       public void setTargetos( String targetOS )
           throws TaskException
  @@ -121,13 +122,10 @@
           // And Unix is everything that is not Windows
           // (with the exception for NetWare below)
   
  -        String osname = System.getProperty( "os.name" ).toLowerCase();
  -
           // for NetWare, piggy-back on Windows, since here and in the
           // apply code, the same assumptions can be made as with windows -
           // that \\ is an OK separator, and do comparisons case-insensitive.
  -        m_onWindows = ( ( osname.indexOf( "windows" ) >= 0 ) ||
  -            ( osname.indexOf( "netware" ) >= 0 ) );
  +        m_onWindows = ( Os.isFamily( Os.OS_FAMILY_WINDOWS ) || Os.isFamily( Os.OS_FAMILY_NETWARE
) );
   
           // Determine the from/to char mappings for dir sep
           char fromDirSep = m_onWindows ? '\\' : '/';
  
  
  
  1.29      +2 -7      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/javadoc/Javadoc.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Javadoc.java	21 Feb 2002 09:41:54 -0000	1.28
  +++ Javadoc.java	2 Mar 2002 04:03:36 -0000	1.29
  @@ -845,7 +845,7 @@
       {
           // This is the most common extension case - exe for windows and OS/2,
           // nothing for *nix.
  -        String extension = Os.isFamily( "dos" ) ? ".exe" : "";
  +        String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : "";
   
           // Look for javadoc in the java.home/../bin directory.  Unfortunately
           // on Windows java.home doesn't always refer to the correct location,
  @@ -854,17 +854,12 @@
           File jdocExecutable = new File( System.getProperty( "java.home" ) +
                                           "/../bin/javadoc" + extension );
   
  -        if( jdocExecutable.exists() && !Os.isFamily( "netware" ) )
  +        if( jdocExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) )
           {
               return jdocExecutable.getAbsolutePath();
           }
           else
           {
  -            if( !Os.isFamily( "netware" ) )
  -            {
  -                getLogger().debug( "Unable to locate " + jdocExecutable.getAbsolutePath()
+
  -                                   ". Using \"javadoc\" instead." );
  -            }
               return "javadoc";
           }
       }
  
  
  
  1.28      +2 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
  
  Index: Cab.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Cab.java	10 Feb 2002 00:46:51 -0000	1.27
  +++ Cab.java	2 Mar 2002 04:03:37 -0000	1.28
  @@ -17,8 +17,8 @@
   import org.apache.aut.nativelib.ExecManager;
   import org.apache.aut.nativelib.Os;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.tools.ant.taskdefs.MatchingTask;
   import org.apache.myrmidon.framework.Execute;
  +import org.apache.tools.ant.taskdefs.MatchingTask;
   import org.apache.tools.ant.types.Commandline;
   import org.apache.tools.ant.types.DirectoryScanner;
   import org.apache.tools.ant.types.FileSet;
  @@ -103,7 +103,7 @@
   
           getLogger().info( "Building cab: " + m_cabFile.getAbsolutePath() );
   
  -        if( !Os.isFamily( "windows" ) )
  +        if( !Os.isFamily( Os.OS_FAMILY_WINDOWS ) )
           {
               getLogger().debug( "Using listcab/libcabinet" );
   
  
  
  
  1.5       +15 -18    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/FixCRLF.java
  
  Index: FixCRLF.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/text/FixCRLF.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FixCRLF.java	20 Jan 2002 09:51:04 -0000	1.4
  +++ FixCRLF.java	2 Mar 2002 04:03:37 -0000	1.5
  @@ -21,6 +21,7 @@
   import java.io.Writer;
   import java.util.Iterator;
   import java.util.NoSuchElementException;
  +import org.apache.aut.nativelib.Os;
   import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.taskdefs.MatchingTask;
  @@ -65,7 +66,7 @@
    *
    * @author Sam Ruby <a href="mailto:rubys@us.ibm.com">rubys@us.ibm.com</a>
    * @author <a href="mailto:pbwest@powerup.com.au">Peter B. West</a>
  - * @version $Revision: 1.4 $ $Name:  $
  + * @version $Revision: 1.5 $ $Name:  $
    */
   public class FixCRLF
       extends MatchingTask
  @@ -122,25 +123,23 @@
       public FixCRLF()
       {
           tabs = ASIS;
  -        if( File.pathSeparator.equals( ":" ) )
  +        if( Os.isFamily( Os.OS_FAMILY_WINDOWS) )
  +        {
  +            ctrlz = ASIS;
  +            eol = CRLF;
  +            eolstr = "\r\n";
  +        }
  +        else if( Os.isFamily( Os.OS_FAMILY_MAC ) )
           {
               ctrlz = REMOVE;
  -            if( System.getProperty( "os.name" ).indexOf( "Mac" ) > -1 )
  -            {
  -                eol = CR;
  -                eolstr = "\r";
  -            }
  -            else
  -            {
  -                eol = LF;
  -                eolstr = "\n";
  -            }
  +            eol = CR;
  +            eolstr = "\r";
           }
           else
           {
  -            ctrlz = ASIS;
  -            eol = CRLF;
  -            eolstr = "\r\n";
  +            ctrlz = REMOVE;
  +            eol = LF;
  +            eolstr = "\n";
           }
       }
   
  @@ -618,9 +617,7 @@
                   }
                   else
                   {// (tabs != ASIS)
  -                    int ptr;
  -
  -                    while( ( ptr = line.getNext() ) < linelen )
  +                    while( line.getNext() < linelen )
                       {
   
                           switch( lines.getState() )
  
  
  
  1.20      +2 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java
  
  Index: CommandlineJava.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- CommandlineJava.java	20 Jan 2002 02:36:21 -0000	1.19
  +++ CommandlineJava.java	2 Mar 2002 04:03:37 -0000	1.20
  @@ -264,7 +264,7 @@
       {
           // This is the most common extension case - exe for windows and OS/2,
           // nothing for *nix.
  -        String extension = Os.isFamily( "dos" ) ? ".exe" : "";
  +        String extension = Os.isFamily( Os.OS_FAMILY_DOS ) ? ".exe" : "";
   
           // Look for java in the java.home/../bin directory.  Unfortunately
           // on Windows java.home doesn't always refer to the correct location,
  @@ -274,7 +274,7 @@
               new File( System.getProperty( "java.home" ) +
                         "/../bin/java" + extension );
   
  -        if( jExecutable.exists() && !Os.isFamily( "netware" ) )
  +        if( jExecutable.exists() && !Os.isFamily( Os.OS_FAMILY_NETWARE ) )
           {
               // NetWare may have a "java" in that directory, but 99% of
               // the time, you don't want to execute it -- Jeff Tulley
  
  
  
  1.5       +1 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/SourceFileScanner.java
  
  Index: SourceFileScanner.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/SourceFileScanner.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SourceFileScanner.java	25 Jan 2002 23:59:59 -0000	1.4
  +++ SourceFileScanner.java	2 Mar 2002 04:03:37 -0000	1.5
  @@ -56,7 +56,7 @@
            * not have it, so if we could reliably passively test for an NTFS
            * file systems we could turn this off...
            */
  -        if( Os.isFamily( "windows" ) )
  +        if( Os.isFamily( Os.OS_FAMILY_WINDOWS ) )
           {
               now += 2000;
           }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message