ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r704562 - in /ant/core/trunk: WHATSNEW docs/manual/listeners.html src/main/org/apache/tools/ant/listener/MailLogger.java
Date Tue, 14 Oct 2008 15:15:48 GMT
Author: bodewig
Date: Tue Oct 14 08:15:47 2008
New Revision: 704562

URL: http://svn.apache.org/viewvc?rev=704562&view=rev
Log:
Allow MailLogger to send a fixed email text.  PR 38029.

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/docs/manual/listeners.html
    ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=704562&r1=704561&r2=704562&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Tue Oct 14 08:15:47 2008
@@ -429,6 +429,10 @@
    reach at least one given recipient.
    Bugzilla Report 36446.
 
+ * two new properties allow MailLogger to send a fixed text instead of
+   the log file.
+   Bugzilla Report 38029.
+
 Changes from Ant 1.7.0 TO Ant 1.7.1
 =============================================
 

Modified: ant/core/trunk/docs/manual/listeners.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/listeners.html?rev=704562&r1=704561&r2=704562&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/listeners.html (original)
+++ ant/core/trunk/docs/manual/listeners.html Tue Oct 14 08:15:47 2008
@@ -224,9 +224,16 @@
     <td width="63%">No, default &quot;Build Success&quot;</td>
   </tr>
   <tr>
-    <td width="337">MailLogger.properties.file </td>
-    <td width="63%">Filename of properties file that will override other values.</td>
-    <td width="63%">No</td>
+    <td width="337">MailLogger.failure.body</td>
+    <td width="63%">Fixed body of the email for a failed
+      build.  <em>Since Ant 1.8.0</em></td>
+    <td width="63%">No, default is to send the full log output.</td>
+  </tr>
+  <tr>
+    <td width="337">MailLogger.success.body</td>
+    <td width="63%">Fixed body of the email for a successful
+      build.  <em>Since Ant 1.8.0</em></td>
+    <td width="63%">No, default is to send the full log output.</td>
   </tr>
   <tr>
     <td width="337">MailLogger.mimeType</td>
@@ -238,6 +245,11 @@
     <td width="63%">Character set of the message.  <em>Since Ant 1.8.0</em></td>
     <td width="63%">No</td>
   </tr>
+  <tr>
+    <td width="337">MailLogger.properties.file </td>
+    <td width="63%">Filename of properties file that will override other values.</td>
+    <td width="63%">No</td>
+  </tr>
 </table>
 <blockquote>
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java?rev=704562&r1=704561&r2=704562&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java Tue Oct 14 08:15:47
2008
@@ -67,6 +67,10 @@
  *    failed build</li>
  *    <li> MailLogger.success.subject [default: "Build Success"] - Subject of
  *    successful build</li>
+ *    <li> MailLogger.failure.body [default: none] - fixed text of
+ *    mail body for a failed build, default is to send the logfile</li>
+ *    <li> MailLogger.success.body [default: none] - fixed text of
+ *    mail body for a successful build, default is to send the logfile</li>
  *    <li> MailLogger.mimeType [default: text/plain] - MIME-Type of email</li>
  *    <li> MailLogger.charset [no default] - character set of email</li>
  *    <li> MailLogger.properties.file [no default] - Filename of
@@ -143,6 +147,7 @@
                 .toList(getValue(properties, prefix + ".to", null))
                 .mimeType(getValue(properties, "mimeType", DEFAULT_MIME_TYPE))
                 .charset(getValue(properties, "charset", ""))
+                .body(getValue(properties, prefix + ".body", ""))
                 .subject(getValue(
                              properties, prefix + ".subject",
                              (success) ? "Build Success" : "Build Failure"));
@@ -249,6 +254,14 @@
             this.mimeType = mimeType;
             return this;
         }
+        private String body;
+        public String body() {
+            return body;
+        }
+        public Values body(String body) {
+            this.body = body;
+            return this;
+        }
     }
 
     /**
@@ -324,7 +337,7 @@
         }
 
         PrintStream ps = mailMessage.getPrintStream();
-        ps.println(message);
+        ps.println(values.body().length() > 0 ? values.body() : message);
 
         mailMessage.sendAndClose();
     }
@@ -352,7 +365,8 @@
         mailer.setUser(values.user());
         mailer.setPassword(values.password());
         mailer.setSSL(values.ssl());
-        Message mymessage = new Message(message);
+        Message mymessage =
+            new Message(values.body().length() > 0 ? values.body() : message);
         mymessage.setProject(project);
         mymessage.setMimeType(values.mimeType());
         if (values.charset().length() > 0) {



Mime
View raw message