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 14:19:31 GMT
bodewig     02/05/28 07:19:31

  Modified:    src/main/org/apache/tools/ant/taskdefs Ant.java
  Log:
  Make sure user-properties remain user-properties.
  
  This is a partial merge of Ant.java from the 1.5 branch (only partial,
  sorry Magesh) that is required to avoid a Gump build failure of
  avalon-phoenix (which does several nested <ant>'s with varying
  inheritall values and ends up with relying on a property that has been
  set on the command line but has disappeared).
  
  Revision  Changes    Path
  1.57      +31 -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
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Ant.java	22 Apr 2002 13:43:52 -0000	1.56
  +++ Ant.java	28 May 2002 14:19:31 -0000	1.57
  @@ -184,6 +184,12 @@
               if (p.getResource() != null) {
                   newP.setResource(p.getResource());
               }
  +            if (p.getRefid() != null) {
  +                newP.setRefid(p.getRefid());
  +            }
  +            if (p.getEnvironment() != null) {
  +                newP.setEnvironment(p.getEnvironment());
  +            }
               properties.setElementAt(newP, i);
           }
       }
  @@ -243,31 +249,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
   
  -            String value = (String) prop1.get(arg);
  -            if (inheritAll){
  -               newProject.setProperty(arg, value);
  -            } else {
  -               newProject.setUserProperty(arg, value);
  +            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 = 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