ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant DefaultLogger.java IntrospectionHelper.java Project.java Task.java
Date Wed, 12 Jul 2000 10:46:12 GMT
bodewig     00/07/12 03:46:12

  Modified:    src/main/org/apache/tools/ant DefaultLogger.java
                        IntrospectionHelper.java Project.java Task.java
  Log:
  Make Tasks aware of the name they are used as - and change the
  DefaultLogger to use this name in messages.
  Submitted by:	Peter Donald donaldp@mad.scientist.com
  
  Revision  Changes    Path
  1.3       +1 -5      jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java
  
  Index: DefaultLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultLogger.java	2000/07/03 12:10:26	1.2
  +++ DefaultLogger.java	2000/07/12 10:46:11	1.3
  @@ -130,11 +130,7 @@
   
               // Print out the name of the task if we're in one
               if (event.getTask() != null) {
  -                String name = event.getTask().getClass().getName();
  -                int pos = name.lastIndexOf(".");
  -                if (pos != -1) {
  -                    name = name.substring(pos + 1);
  -                }
  +                String name = event.getTask().getTaskName();
   
                   String msg = "[" + name + "] ";
                   for (int i = 0; i < (LEFT_COLUMN_SIZE - msg.length()); i++) {
  
  
  
  1.2       +4 -1      jakarta-ant/src/main/org/apache/tools/ant/IntrospectionHelper.java
  
  Index: IntrospectionHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IntrospectionHelper.java	2000/07/11 11:14:46	1.1
  +++ IntrospectionHelper.java	2000/07/12 10:46:11	1.2
  @@ -116,7 +116,10 @@
               Class returnType = m.getReturnType();
               Class[] args = m.getParameterTypes();
   
  -            if ("setLocation".equals(name) || "setDescription".equals(name)) {
  +            // not really user settable properties
  +            if ("setLocation".equals(name) || 
  +                "setDescription".equals(name) ||
  +                "setTaskName".equals(name)) {
                   continue;
               }
               
  
  
  
  1.30      +1 -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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Project.java	2000/07/12 06:36:10	1.29
  +++ Project.java	2000/07/12 10:46:11	1.30
  @@ -400,6 +400,7 @@
                   task=taskA;
               }
               task.setProject(this);
  +            task.setTaskName(taskType);
               String msg = "   +Task: " + taskType;
               log (msg, MSG_VERBOSE);
               return task;
  
  
  
  1.11      +23 -2     jakarta-ant/src/main/org/apache/tools/ant/Task.java
  
  Index: Task.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Task.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Task.java	2000/07/10 11:21:39	1.10
  +++ Task.java	2000/07/12 10:46:11	1.11
  @@ -56,6 +56,8 @@
   
   /**
    * Base class for all tasks.
  + *
  + * <p>Use {@link Project#createTask Project.createTask} to create a new Task.
    */
   
   public abstract class Task {
  @@ -64,6 +66,7 @@
       protected Target target = null;
       protected String description=null;
       protected Location location = Location.UNKNOWN_LOCATION;
  +    protected String taskName = null;
   
       /**
        * Sets the project object of this task. This method is used by
  @@ -80,7 +83,7 @@
       /**
        * Get the Project to which this task belongs
        *
  -     * @param the task's project.
  +     * @return the task's project.
        */
       public Project getProject() {
           return project;
  @@ -98,12 +101,30 @@
       /**
        * Get the Target to which this task belongs
        *
  -     * @param the task's target.
  +     * @return the task's target.
        */
       public Target getOwningTarget() {
           return target;
       }
       
  +    /**
  +     * Set the name with which the task has been invoked.
  +     *
  +     * @param name the name the task has been invoked as.
  +     */
  +    public void setTaskName(String name) {
  +        this.taskName = name;
  +    }
  +
  +    /**
  +     * Get the name with which the task has been invoked.
  +     *
  +     * @return the name the task has been invoked as.
  +     */
  +    public String getTaskName() {
  +        return taskName;
  +    }
  +
       /**
        * Log a message with the default (INFO) priority.
        *
  
  
  

Mime
View raw message