ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/helper ProjectHelper2.java
Date Tue, 31 Dec 2002 17:33:58 GMT
costin      2002/12/31 09:33:58

  Modified:    src/main/org/apache/tools/ant/helper ProjectHelper2.java
  Log:
  Added back the import property.
  Added a small message to allow debugging of duplicated project names.
  
  Revision  Changes    Path
  1.7       +30 -3     jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
  
  Index: ProjectHelper2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ProjectHelper2.java	27 Dec 2002 18:14:50 -0000	1.6
  +++ ProjectHelper2.java	31 Dec 2002 17:33:58 -0000	1.7
  @@ -100,6 +100,7 @@
               throws BuildException
       {
           this.getImportStack().addElement(source);
  +        //System.out.println("Adding " + source);
           AntXmlContext context=null;
           context=(AntXmlContext)project.getReference("ant.parsing.context");
   //        System.out.println("Parsing " + getImportStack().size() + " " +
  @@ -578,10 +579,21 @@
   
               Project project=context.getProject();
   
  +            /** XXX I really don't like this - the XML processor is still
  +             * too 'involved' in the processing. A better solution (IMO)
  +             * would be to create UE for Project and Target too, and
  +             * then process the tree and have Project/Target deal with
  +             * its attributes ( similar with Description ).
  +             *
  +             * If we eventually switch to ( or add support for ) DOM,
  +             * things will work smoothly - UE can be avoided almost completely
  +             * ( it could still be created on demand, for backward compat )
  +             */
  +
               for (int i = 0; i < attrs.getLength(); i++) {
                   String key = attrs.getQName(i);
                   String value = attrs.getValue(i);
  -                
  +
                   if (key.equals("default")) {
                       if ( value != null && !value.equals("")) {
                           if( !context.ignoreProjectTag )
  @@ -594,7 +606,7 @@
                           if( !context.ignoreProjectTag ) {
                               project.setName(value);
                               project.addReference(value, project);
  -                        } 
  +                        }
                       }
                   } else if (key.equals("id")) {
                       if (value != null) {
  @@ -612,6 +624,21 @@
                   }
               }
   
  +            // XXX Move to Project ( so it is shared by all helpers )
  +            String antFileProp="ant.file." + context.currentProjectName;
  +            String dup=project.getProperty(antFileProp);
  +            if( dup!=null ) {
  +                project.log("Duplicated project name in import. Project "+
  +                        context.currentProjectName + " defined first in " +
  +                        dup + " and again in " + context.buildFile,
  +                        Project.MSG_WARN);
  +            }
  +
  +            if( context.buildFile != null ) {
  +                project.setUserProperty("ant.file."+context.currentProjectName,
  +                        context.buildFile.toString());
  +            }
  +
               if( context.ignoreProjectTag ) {
                   // no further processing
                   return;
  @@ -633,7 +660,7 @@
                       }
                   }
               }
  -            
  +
               project.addTarget("", context.implicitTarget);
               context.currentTarget=context.implicitTarget;
           }
  
  
  

--
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