You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by jk...@apache.org on 2006/02/02 21:08:39 UTC

svn commit: r374482 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/ProjectComponent.java src/main/org/apache/tools/ant/Task.java

Author: jkf
Date: Thu Feb  2 12:08:32 2006
New Revision: 374482

URL: http://svn.apache.org/viewcvs?rev=374482&view=rev
Log:
38458 removed log implementation of Task to allow logging from tasks outside a project. The base class has the logging behaviour we need. This does not guarantee that (all) tasks are working outside an project, but at least will not break just because of logging.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
    ant/core/trunk/src/main/org/apache/tools/ant/Task.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewcvs/ant/core/trunk/WHATSNEW?rev=374482&r1=374481&r2=374482&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Feb  2 12:08:32 2006
@@ -4,6 +4,9 @@
 Changes that could break older environments:
 --------------------------------------------
 
+* Task will now log correctly even if no project is set. 
+  Bugzilla report 38458.
+
 * Use alternative names for the command line arguments in javac. Bugzilla
   Report 37546.
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java?rev=374482&r1=374481&r2=374482&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java Thu Feb  2 12:08:32 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2001-2004 The Apache Software Foundation
+ * Copyright  2001-2004,2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -75,8 +75,8 @@
      *                 to be logged.
      */
     public void log(String msg, int msgLevel) {
-        if (project != null) {
-            project.log(msg, msgLevel);
+        if (getProject() != null) {
+            getProject().log(msg, msgLevel);
         } else {
             // 'reasonable' default, if the component is used without
             // a Project ( for example as a standalone Bean ).

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Task.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/Task.java?rev=374482&r1=374481&r2=374482&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Task.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Task.java Thu Feb  2 12:08:32 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2000-2005 The Apache Software Foundation
+ * Copyright  2000-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -333,18 +333,6 @@
      */
     public void log(String msg) {
         log(msg, Project.MSG_INFO);
-    }
-
-    /**
-     * Logs a message with the given priority. This delegates
-     * the actual logging to the project.
-     *
-     * @param msg The message to be logged. Should not be <code>null</code>.
-     * @param msgLevel The message priority at which this message is to
-     *                 be logged.
-     */
-    public void log(String msg, int msgLevel) {
-        getProject().log(this, msg, msgLevel);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r374482 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/ProjectComponent.java src/main/org/apache/tools/ant/Task.java

Posted by Martijn Kruithof <jm...@kruithof.xs4all.nl>.
And I was already wondering why i broke a testcase

Matt Benson schreef:

>Martijn, I think you've got to stay more w/ the patch
>submitted, since Task calls not Project.log(String,
>int), but Project(Task, String, int) --passing itself
>in as the originator of the message... 
>
>-Matt 
>
>--- jkf@apache.org wrote:
>
>  
>
>>Author: jkf
>>Date: Thu Feb  2 12:08:32 2006
>>New Revision: 374482
>>
>>URL:
>>http://svn.apache.org/viewcvs?rev=374482&view=rev
>>Log:
>>38458 removed log implementation of Task to allow
>>logging from tasks outside a project. The base class
>>has the logging behaviour we need. This does not
>>guarantee that (all) tasks are working outside an
>>project, but at least will not break just because of
>>logging.
>>
>>Modified:
>>    ant/core/trunk/WHATSNEW
>>   
>>
>>    
>>
>ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
>  
>
>>   
>>
>>    
>>
>ant/core/trunk/src/main/org/apache/tools/ant/Task.java
>  
>
>>Modified: ant/core/trunk/WHATSNEW
>>URL:
>>
>>    
>>
>http://svn.apache.org/viewcvs/ant/core/trunk/WHATSNEW?rev=374482&r1=374481&r2=374482&view=diff
>  
>
>==============================================================================
>  
>
>>--- ant/core/trunk/WHATSNEW (original)
>>+++ ant/core/trunk/WHATSNEW Thu Feb  2 12:08:32 2006
>>@@ -4,6 +4,9 @@
>> Changes that could break older environments:
>> --------------------------------------------
>> 
>>+* Task will now log correctly even if no project is
>>set. 
>>+  Bugzilla report 38458.
>>+
>> * Use alternative names for the command line
>>arguments in javac. Bugzilla
>>   Report 37546.
>> 
>>
>>Modified:
>>
>>    
>>
>ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
>  
>
>>URL:
>>
>>    
>>
>http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java?rev=374482&r1=374481&r2=374482&view=diff
>  
>
>==============================================================================
>  
>
>>---
>>
>>    
>>
>ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
>  
>
>>(original)
>>+++
>>
>>    
>>
>ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
>  
>
>>Thu Feb  2 12:08:32 2006
>>@@ -1,5 +1,5 @@
>> /*
>>- * Copyright  2001-2004 The Apache Software
>>Foundation
>>+ * Copyright  2001-2004,2006 The Apache Software
>>Foundation
>>  *
>>  *  Licensed under the Apache License, Version 2.0
>>(the "License");
>>  *  you may not use this file except in compliance
>>with the License.
>>@@ -75,8 +75,8 @@
>>      *                 to be logged.
>>      */
>>     public void log(String msg, int msgLevel) {
>>-        if (project != null) {
>>-            project.log(msg, msgLevel);
>>+        if (getProject() != null) {
>>+            getProject().log(msg, msgLevel);
>>         } else {
>>             // 'reasonable' default, if the
>>component is used without
>>             // a Project ( for example as a
>>standalone Bean ).
>>
>>Modified:
>>
>>    
>>
>ant/core/trunk/src/main/org/apache/tools/ant/Task.java
>  
>
>>URL:
>>
>>    
>>
>http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/Task.java?rev=374482&r1=374481&r2=374482&view=diff
>  
>
>==============================================================================
>  
>
>>---
>>
>>    
>>
>ant/core/trunk/src/main/org/apache/tools/ant/Task.java
>  
>
>>(original)
>>+++
>>
>>    
>>
>ant/core/trunk/src/main/org/apache/tools/ant/Task.java
>  
>
>>Thu Feb  2 12:08:32 2006
>>@@ -1,5 +1,5 @@
>> /*
>>- * Copyright  2000-2005 The Apache Software
>>Foundation
>>+ * Copyright  2000-2006 The Apache Software
>>Foundation
>>  *
>>  *  Licensed under the Apache License, Version 2.0
>>(the "License");
>>  *  you may not use this file except in compliance
>>with the License.
>>@@ -333,18 +333,6 @@
>>      */
>>     public void log(String msg) {
>>         log(msg, Project.MSG_INFO);
>>-    }
>>-
>>-    /**
>>-     * Logs a message with the given priority. This
>>delegates
>>-     * the actual logging to the project.
>>-     *
>>-     * @param msg The message to be logged. Should
>>not be <code>null</code>.
>>-     * @param msgLevel The message priority at
>>which this message is to
>>-     *                 be logged.
>>-     */
>>-    public void log(String msg, int msgLevel) {
>>-        getProject().log(this, msg, msgLevel);
>>     }
>> 
>>     /**
>>
>>
>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>dev-unsubscribe@ant.apache.org
>>For additional commands, e-mail:
>>dev-help@ant.apache.org
>>
>>
>>    
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r374482 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/ProjectComponent.java src/main/org/apache/tools/ant/Task.java

Posted by Matt Benson <gu...@yahoo.com>.
Martijn, I think you've got to stay more w/ the patch
submitted, since Task calls not Project.log(String,
int), but Project(Task, String, int) --passing itself
in as the originator of the message... 

-Matt 

--- jkf@apache.org wrote:

> Author: jkf
> Date: Thu Feb  2 12:08:32 2006
> New Revision: 374482
> 
> URL:
> http://svn.apache.org/viewcvs?rev=374482&view=rev
> Log:
> 38458 removed log implementation of Task to allow
> logging from tasks outside a project. The base class
> has the logging behaviour we need. This does not
> guarantee that (all) tasks are working outside an
> project, but at least will not break just because of
> logging.
> 
> Modified:
>     ant/core/trunk/WHATSNEW
>    
>
ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
>    
>
ant/core/trunk/src/main/org/apache/tools/ant/Task.java
> 
> Modified: ant/core/trunk/WHATSNEW
> URL:
>
http://svn.apache.org/viewcvs/ant/core/trunk/WHATSNEW?rev=374482&r1=374481&r2=374482&view=diff
>
==============================================================================
> --- ant/core/trunk/WHATSNEW (original)
> +++ ant/core/trunk/WHATSNEW Thu Feb  2 12:08:32 2006
> @@ -4,6 +4,9 @@
>  Changes that could break older environments:
>  --------------------------------------------
>  
> +* Task will now log correctly even if no project is
> set. 
> +  Bugzilla report 38458.
> +
>  * Use alternative names for the command line
> arguments in javac. Bugzilla
>    Report 37546.
>  
> 
> Modified:
>
ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
> URL:
>
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java?rev=374482&r1=374481&r2=374482&view=diff
>
==============================================================================
> ---
>
ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
> (original)
> +++
>
ant/core/trunk/src/main/org/apache/tools/ant/ProjectComponent.java
> Thu Feb  2 12:08:32 2006
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright  2001-2004 The Apache Software
> Foundation
> + * Copyright  2001-2004,2006 The Apache Software
> Foundation
>   *
>   *  Licensed under the Apache License, Version 2.0
> (the "License");
>   *  you may not use this file except in compliance
> with the License.
> @@ -75,8 +75,8 @@
>       *                 to be logged.
>       */
>      public void log(String msg, int msgLevel) {
> -        if (project != null) {
> -            project.log(msg, msgLevel);
> +        if (getProject() != null) {
> +            getProject().log(msg, msgLevel);
>          } else {
>              // 'reasonable' default, if the
> component is used without
>              // a Project ( for example as a
> standalone Bean ).
> 
> Modified:
>
ant/core/trunk/src/main/org/apache/tools/ant/Task.java
> URL:
>
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/Task.java?rev=374482&r1=374481&r2=374482&view=diff
>
==============================================================================
> ---
>
ant/core/trunk/src/main/org/apache/tools/ant/Task.java
> (original)
> +++
>
ant/core/trunk/src/main/org/apache/tools/ant/Task.java
> Thu Feb  2 12:08:32 2006
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright  2000-2005 The Apache Software
> Foundation
> + * Copyright  2000-2006 The Apache Software
> Foundation
>   *
>   *  Licensed under the Apache License, Version 2.0
> (the "License");
>   *  you may not use this file except in compliance
> with the License.
> @@ -333,18 +333,6 @@
>       */
>      public void log(String msg) {
>          log(msg, Project.MSG_INFO);
> -    }
> -
> -    /**
> -     * Logs a message with the given priority. This
> delegates
> -     * the actual logging to the project.
> -     *
> -     * @param msg The message to be logged. Should
> not be <code>null</code>.
> -     * @param msgLevel The message priority at
> which this message is to
> -     *                 be logged.
> -     */
> -    public void log(String msg, int msgLevel) {
> -        getProject().log(this, msg, msgLevel);
>      }
>  
>      /**
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org