ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant ProjectHelper.java
Date Thu, 30 Nov 2000 17:27:58 GMT
bodewig     00/11/30 09:27:56

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant ProjectHelper.java
  Log:
  Make sure, Taskdef.execute doesn't get called before the nested
  elements have been configured.
  
  Revision  Changes    Path
  1.58      +3 -0      jakarta-ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- WHATSNEW	2000/11/30 16:27:13	1.57
  +++ WHATSNEW	2000/11/30 17:27:48	1.58
  @@ -63,6 +63,9 @@
   * org.apache.tools.mail.MailMessage (and therefore <mail>) can now
     handle SMTP servers sending multi line responses.
   
  +* nested <classpath> elements of <taskdef> now work for <taskdef>s not
  +  nested into <target> as well.
  +
   Changes from Ant 1.1 to Ant 1.2
   ===============================
   
  
  
  
  1.37      +24 -2     jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java
  
  Index: ProjectHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- ProjectHelper.java	2000/11/29 10:36:15	1.36
  +++ ProjectHelper.java	2000/11/30 17:27:54	1.37
  @@ -223,6 +223,12 @@
        * Handler for the top level "project" element.
        */
       private class ProjectHandler extends AbstractHandler {
  +        /**
  +         * Tasks not living in a target need special processing
  +         * in endElement (this is the right place to call execute).
  +         */
  +        protected TaskHandler childHandler = null;
  +
           public ProjectHandler(DocumentHandler parentHandler) {
               super(parentHandler);
           }
  @@ -291,11 +297,13 @@
           }
   
           private void handleTaskdef(String name, AttributeList attrs) throws SAXParseException
{
  -            new TaskHandler(this, null).init(name, attrs);
  +            childHandler = new TaskHandler(this, null);
  +            childHandler.init(name, attrs);
           }
   
           private void handleProperty(String name, AttributeList attrs) throws SAXParseException
{
  -            new TaskHandler(this, null).init(name, attrs);
  +            childHandler = new TaskHandler(this, null);
  +            childHandler.init(name, attrs);
           }
   
           private void handleTarget(String tag, AttributeList attrs) throws SAXParseException
{
  @@ -305,6 +313,15 @@
           private void handleDataType(String name, AttributeList attrs) throws SAXParseException
{
               new DataTypeHandler(this).init(name, attrs);
           }
  +
  +        public void endElement(String name) throws SAXException {
  +            if (childHandler != null) {
  +                childHandler.finished();
  +                childHandler = null;
  +            }
  +            
  +            super.endElement(name);
  +        }
       }
   
       /**
  @@ -416,6 +433,11 @@
               } else {
                   task.init();
                   configure(task, attrs, project);
  +            }
  +        }
  +
  +        public void finished() {
  +            if (task != null && target == null) {
                   task.execute();
               }
           }
  
  
  

Mime
View raw message