ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/docs/manual/CoreTasks import.html
Date Thu, 16 Oct 2003 17:04:58 GMT
peterreilly    2003/10/16 10:04:58

  Modified:    src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
                        ImportTask.java
               docs/manual/CoreTasks Tag: ANT_16_BRANCH import.html
  Log:
  merge with HEAD
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.16.2.1  +20 -5     ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java
  
  Index: ImportTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java,v
  retrieving revision 1.16
  retrieving revision 1.16.2.1
  diff -u -r1.16 -r1.16.2.1
  --- ImportTask.java	19 Sep 2003 09:36:22 -0000	1.16
  +++ ImportTask.java	16 Oct 2003 17:04:57 -0000	1.16.2.1
  @@ -64,8 +64,6 @@
   import java.util.Vector;
   
   /**
  - * <i>EXPERIMENTAL:</i> This task is experimental and may be under continual
  - * change till Ant1.6 ships; it may even be omitted from the product.
    * <p>
    * Task to import another build file into the current project.
    * <p>
  @@ -96,8 +94,19 @@
    */
   public class ImportTask extends Task {
       private String file;
  +    private boolean optional;
   
       /**
  +     * sets the optional attribute
  +     *
  +     * @param optional if true ignore files that are not present,
  +     *                 default is false
  +     */
  +    public void setOptional(boolean optional) {
  +        this.optional = true;
  +    }
  +    
  +    /**
        * the name of the file to import. How relative paths are resolved is still
        * in flux: use absolute paths for safety.
        * @param file the name of the file
  @@ -151,9 +160,15 @@
           }
   
           if (!importedFile.exists()) {
  -                throw new BuildException(
  -                    "Cannot find " + file + " imported from "
  -                    + buildFile.getAbsolutePath());
  +            String message =
  +                "Cannot find " + file + " imported from "
  +                + buildFile.getAbsolutePath();
  +            if (optional) {
  +                getProject().log(message, Project.MSG_VERBOSE);
  +                return;
  +            } else {
  +                throw new BuildException(message);
  +            }
           }
   
           importedFile = new File(getPath(importedFile));
  
  
  
  No                   revision
  No                   revision
  1.6.2.2   +9 -0      ant/docs/manual/CoreTasks/import.html
  
  Index: import.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/import.html,v
  retrieving revision 1.6.2.1
  retrieving revision 1.6.2.2
  diff -u -r1.6.2.1 -r1.6.2.2
  --- import.html	9 Oct 2003 21:01:07 -0000	1.6.2.1
  +++ import.html	16 Oct 2003 17:04:58 -0000	1.6.2.2
  @@ -84,6 +84,15 @@
         </td>
         <td valign="top" align="center">Yes</td>
       </tr>
  +    <tr>
  +      <td valign="top">optional<br>
  +      </td>
  +      <td valign="top">
  +        if true, do not issue stop the build if the file does not exist,
  +        default is false.<br>
  +      </td>
  +      <td valign="top" align="center">No</td>
  +    </tr>
     </tbody>
   </table>
   <h3><br>
  
  
  

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


Mime
View raw message