tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@hyperreal.org
Subject cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant Project.java
Date Tue, 07 Dec 1999 02:23:07 GMT
stefano     99/12/06 18:23:06

  Modified:    ant/src/main/org/apache/tools/ant Project.java
  Log:
  Fixed the multiple target problem. Thanks to "KB Sriram" <kbs@skytalk.com> for the
patch.
  
  Revision  Changes    Path
  1.16      +52 -13    jakarta-tools/ant/src/main/org/apache/tools/ant/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/Project.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Project.java	1999/12/03 12:41:42	1.15
  +++ Project.java	1999/12/07 02:23:05	1.16
  @@ -246,24 +246,63 @@
       }
   
       public void addTaskDefinition(String taskName, Class taskClass) {
  -	String msg = " +User task: " + taskName + "     " +
  -	    taskClass.getName();
  -	log(msg, MSG_VERBOSE);
  -	taskClassDefinitions.put(taskName, taskClass);
  +        String msg = " +User task: " + taskName + "     " + taskClass.getName();
  +        log(msg, MSG_VERBOSE);
  +        taskClassDefinitions.put(taskName, taskClass);
       }
   
  -    public void addTarget(Target target) {
  -	String msg = " +Target: " + target.getName();
  -	log(msg, MSG_VERBOSE);
  -	targets.put(target.getName(), target);
  +    /**
  +     * This call expects to add a <em>new</em> Target.
  +     * @param target is the Target to be added to the current
  +     * Project.
  +     * @exception BuildException if the Target already exists
  +     * in the project.
  +     * @see Project#addOrReplaceTarget to replace existing Targets.
  +     */
  +    public void addTarget(Target target) throws BuildException {
  +        String name = target.getName();
  +        if (targets.get(name) != null) {
  +            throw new BuildException("Duplicate target: `"+name+"'");
  +        }
  +        addOrReplaceTarget(name, target);
       }
       
  -    public void addTarget(String targetName, Target target) {
  -	String msg = " +Target: " + targetName;
  -	log(msg, MSG_VERBOSE);
  -	targets.put(targetName, target);
  +    /**
  +     * This call expects to add a <em>new</em> Target.
  +     * @param target is the Target to be added to the current
  +     * Project.
  +     * @param targetName is the name to use for the Target
  +     * @exception BuildException if the Target already exists
  +     * in the project.
  +     * @see Project#addOrReplaceTarget to replace existing Targets.
  +     */
  +    public void addTarget(String targetName, Target target)
  +        throws BuildException {
  +        if (targets.get(targetName) != null) {
  +            throw new BuildException("Duplicate target: `"+targetName+"'");
  +        }
  +        addOrReplaceTarget(targetName, target);
       }
   
  +    /**
  +     * @param target is the Target to be added or replaced in
  +     * the current Project.
  +     */
  +    public void addOrReplaceTarget(Target target) {
  +	     addOrReplaceTarget(target.getName(), target);
  +    }
  +    
  +    /**
  +     * @param target is the Target to be added/replaced in
  +     * the current Project.
  +     * @param targetName is the name to use for the Target
  +     */
  +    public void addOrReplaceTarget(String targetName, Target target) {
  +        String msg = " +Target: " + targetName;
  +        log(msg, MSG_VERBOSE);
  +        targets.put(targetName, target);
  + 	}
  +
       public Task createTask(String taskType) throws BuildException {
   	Class c = (Class)taskClassDefinitions.get(taskType);
   
  @@ -497,4 +536,4 @@
           } while(!c.equals(end));
           return new BuildException(new String(sb));
       }
  -}
  +}
  \ No newline at end of file
  
  
  

Mime
View raw message