ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Property.java
Date Sat, 27 May 2000 22:21:10 GMT
rubys       00/05/27 15:21:10

  Modified:    src/main/org/apache/tools/ant Project.java
               src/main/org/apache/tools/ant/taskdefs Property.java
  Log:
  Make sure that properies from the command line and/or parent projects
  override properties specified in the build.xml file.
  
  Revision  Changes    Path
  1.20      +6 -0      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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Project.java	2000/04/28 08:45:21	1.19
  +++ Project.java	2000/05/27 22:21:09	1.20
  @@ -198,6 +198,12 @@
           return property;
       }
   
  +    public String getUserProperty(String name) {
  +        if (name == null) return null;
  +        String property = (String) userProperties.get(name);
  +        return property;
  +    }
  +
       public Hashtable getProperties() {
           return properties;
       }
  
  
  
  1.5       +27 -5     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java
  
  Index: Property.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Property.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Property.java	2000/02/23 20:46:53	1.4
  +++ Property.java	2000/05/27 22:21:10	1.5
  @@ -60,8 +60,10 @@
   
   /**
    * Will set a Project property. Used to be a hack in ProjectHelper
  + * Will not override values set by the command line or parent projects.
    *
    * @author costin@dnt.ro
  + * @author Sam Ruby <rubys@us.ibm.com>
    */
   public class Property extends Task {
   
  @@ -101,9 +103,19 @@
               if ((name != null) && (value != null)) {
                   String v = ProjectHelper.replaceProperties(value, project.getProperties());
   		if( userProperty )
  -		    project.setUserProperty(name, v);
  +                    if (project.getUserProperty(name) == null) {
  +		        project.setUserProperty(name, v);
  +                    } else {
  +                        project.log("Override ignored for " + name, 
  +                                    project.MSG_VERBOSE);
  +                    }
   		else
  -		    project.setProperty(name, v);
  +                    if (project.getProperty(name) == null) {
  +		        project.setProperty(name, v);
  +                    } else {
  +                        project.log("Override ignored for " + name, 
  +                                    project.MSG_VERBOSE);
  +                    }
               }
   
               if (file != null) loadFile(file);
  @@ -149,9 +161,19 @@
               String value = (String) props.getProperty(name);
               String v = ProjectHelper.replaceProperties(value, project.getProperties());
               if( userProperty )
  -		project.setUserProperty(name, v);
  -	    else
  -		project.setProperty(name, v);
  +                if (project.getUserProperty(name) == null) {
  +		    project.setUserProperty(name, v);
  +                } else {
  +                    project.log("Override ignored for " + name, 
  +                                project.MSG_VERBOSE);
  +                }
  +            else
  +                if (project.getProperty(name) == null) {
  +		    project.setProperty(name, v);
  +                } else {
  +                    project.log("Override ignored for " + name, 
  +                                project.MSG_VERBOSE);
  +                }
           }
       }
   
  
  
  

Mime
View raw message