ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs ExecuteOn.java
Date Thu, 27 Mar 2003 13:14:31 GMT
bodewig     2003/03/27 05:14:31

  Modified:    .        WHATSNEW
               docs/manual/CoreTasks apply.html
               src/main/org/apache/tools/ant/taskdefs ExecuteOn.java
  Log:
  Add a forwardslash attribute to <apply>
  
  Submitted by:	Zdenek Wagner <wagner at cesnet dot cz>
  
  Revision  Changes    Path
  1.374     +5 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.373
  retrieving revision 1.374
  diff -u -r1.373 -r1.374
  --- WHATSNEW	27 Mar 2003 10:02:02 -0000	1.373
  +++ WHATSNEW	27 Mar 2003 13:14:31 -0000	1.374
  @@ -179,6 +179,11 @@
   
   * New task <sync> that synchronizes two directory trees.
   
  +* <apply> has new forwardslash attribute that can force filenames to
  +  use forward slashes (/) as file separators even on platforms with a
  +  different separator.  This is useful if you want to run certain
  +  ported Unix tools.
  +
   Changes from Ant 1.5.2 to Ant 1.5.3
   ===================================
   
  
  
  
  1.19      +9 -1      ant/docs/manual/CoreTasks/apply.html
  
  Index: apply.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/apply.html,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- apply.html	26 Sep 2002 13:55:28 -0000	1.18
  +++ apply.html	27 Mar 2003 13:14:31 -0000	1.19
  @@ -58,6 +58,14 @@
       <td align="center" valign="top">No, default is <i>false</i></td>
     </tr>
     <tr>
  +    <td valign="top">forwardslash</td>
  +    <td valign="top">whether the absolute file names should be passed
  +      with forward slashes even if the operating system requires other
  +      file separator. The option is ignored if the system file separator
  +      is a forward slash.</td>
  +    <td align="center" valign="top">No, default is <i>false</i></td>
  +  </tr>
  +  <tr>
       <td valign="top">os</td>
       <td valign="top">list of Operating Systems on which the command may be
         executed.</td>
  @@ -220,7 +228,7 @@
   <code>.o</code>, replacing TARGETFILE with the absolute filename of
   the <code>.o</code> and SOURCEFILE with the absolute name of the
   <code>.c</code> file.</p>
  -<hr><p align="center">Copyright &copy; 2000-2002 Apache Software Foundation.
All rights
  +<hr><p align="center">Copyright &copy; 2000-2003 Apache Software Foundation.
All rights
   Reserved.</p>
   
   </body>
  
  
  
  1.38      +18 -1     ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  
  Index: ExecuteOn.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- ExecuteOn.java	7 Mar 2003 11:23:01 -0000	1.37
  +++ ExecuteOn.java	27 Mar 2003 13:14:31 -0000	1.38
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights 
  + * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -83,6 +83,7 @@
       protected Vector filesets = new Vector();
       private boolean relative = false;
       private boolean parallel = false;
  +    private boolean forwardSlash = false;
       protected String type = "file";
       protected Commandline.Marker srcFilePos = null;
       private boolean skipEmpty = false;
  @@ -145,6 +146,14 @@
       }
   
       /**
  +     * The source and target file names on Windows and OS/2 must use
  +     * forward slash as file separator.
  +     */
  +    public void setForwardslash(boolean forwardSlash) {
  +        this.forwardSlash = forwardSlash;
  +    }
  +
  +    /**
        * Marker that indicates where the name of the source file should
        * be put on the command line.
        */
  @@ -284,6 +293,7 @@
        * @param baseDir filenames are relative to this dir
        */
       protected String[] getCommandline(String[] srcFiles, File[] baseDirs) {
  +        final char fileSeparator = File.separatorChar;
           Vector targets = new Vector();
           if (targetFilePos != null) {
               Hashtable addedFiles = new Hashtable();
  @@ -297,6 +307,9 @@
                           } else {
                               name = subTargets[j];
                           }
  +                        if (forwardSlash && fileSeparator != '/') {
  +                            name = name.replace(fileSeparator, '/');
  +                        }
                           if (!addedFiles.contains(name)) {
                               targets.addElement(name);
                               addedFiles.put(name, name);
  @@ -379,6 +392,10 @@
                       (new File(baseDirs[i], srcFiles[i])).getAbsolutePath();
               } else {
                   result[srcIndex + i] = srcFiles[i];
  +            }
  +            if (forwardSlash && fileSeparator != '/') {
  +                result[srcIndex + i] = 
  +                    result[srcIndex + i].replace(fileSeparator, '/');
               }
           }
           return result;
  
  
  

Mime
View raw message