ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Ant.java
Date Tue, 28 May 2002 13:53:13 GMT
bodewig     02/05/28 06:53:13

  Modified:    src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
                        Project.java
               src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
                        Ant.java
  Log:
  Make sure user properties remain user properties - no matter what
  inheritall says.  Deal with potential non-String properties.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.108.2.1 +2 -2      jakarta-ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.108
  retrieving revision 1.108.2.1
  diff -u -r1.108 -r1.108.2.1
  --- Project.java	30 Apr 2002 14:20:16 -0000	1.108
  +++ Project.java	28 May 2002 13:53:13 -0000	1.108.2.1
  @@ -83,7 +83,7 @@
    *
    * @author duncan@x180.com
    *
  - * @version $Revision: 1.108 $
  + * @version $Revision: 1.108.2.1 $
    */
   
   public class Project {
  @@ -151,7 +151,7 @@
       /** Description for this project (if any). */
       private String description;
   
  -    /** Project properties map (String to String). */
  +    /** Project properties map (usually String to String). */
       private Hashtable properties = new Hashtable();
       /**
        * Map of "user" properties (as created in the Ant task, for example).
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.56.2.3  +25 -19    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java
  
  Index: Ant.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
  retrieving revision 1.56.2.2
  retrieving revision 1.56.2.3
  diff -u -r1.56.2.2 -r1.56.2.3
  --- Ant.java	10 May 2002 11:33:54 -0000	1.56.2.2
  +++ Ant.java	28 May 2002 13:53:13 -0000	1.56.2.3
  @@ -255,31 +255,37 @@
               newProject.addDataTypeDefinition(typeName, typeClass);
           }
   
  -        // set user-defined or all properties from calling project
  -        Hashtable prop1;
  -        if (inheritAll) {
  -           prop1 = project.getProperties();
  -        } else {
  -           prop1 = project.getUserProperties();
  +        // set user-defined
  +        Hashtable props = getProject().getUserProperties();
  +        e = props.keys();
  +        while (e.hasMoreElements()) {
  +            String arg = e.nextElement().toString();
  +            String value = props.get(arg).toString();
  +            newProject.setUserProperty(arg, value);
  +        }
   
  +        if (!inheritAll) {
              // set Java built-in properties separately,
              // b/c we won't inherit them.
              newProject.setSystemProperties();
  -        }
   
  -        e = prop1.keys();
  -        while (e.hasMoreElements()) {
  -            String arg = (String) e.nextElement();
  -            if ("basedir".equals(arg) || "ant.file".equals(arg)) {
  -                // basedir and ant.file get special treatment in execute()
  -                continue;
  -            }
  +        } else {
  +            // set all properties from calling project
  +
  +            props = getProject().getProperties();
  +            e = props.keys();
  +            while (e.hasMoreElements()) {
  +                String arg = e.nextElement().toString();
  +                if ("basedir".equals(arg) || "ant.file".equals(arg)) {
  +                    // basedir and ant.file get special treatment in execute()
  +                    continue;
  +                }
   
  -            String value = (String) prop1.get(arg);
  -            if (inheritAll){
  -               newProject.setProperty(arg, value);
  -            } else {
  -               newProject.setUserProperty(arg, value);
  +                String value = props.get(arg).toString();
  +                if (newProject.getProperty(arg) == null){
  +                    // no user property
  +                    newProject.setProperty(arg, value);
  +                }
               }
           }
       }
  
  
  

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