Return-Path: X-Original-To: apmail-ant-dev-archive@www.apache.org Delivered-To: apmail-ant-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A7F43DC31 for ; Thu, 23 May 2013 17:08:18 +0000 (UTC) Received: (qmail 54505 invoked by uid 500); 23 May 2013 17:08:18 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 54368 invoked by uid 500); 23 May 2013 17:08:16 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 54345 invoked by uid 99); 23 May 2013 17:08:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 May 2013 17:08:15 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of tboemker@elynx.com does not designate 216.32.181.181 as permitted sender) Received: from [216.32.181.181] (HELO ch1outboundpool.messaging.microsoft.com) (216.32.181.181) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 May 2013 17:08:09 +0000 Received: from mail191-ch1-R.bigfish.com (10.43.68.231) by CH1EHSOBE008.bigfish.com (10.43.70.58) with Microsoft SMTP Server id 14.1.225.23; Thu, 23 May 2013 17:07:48 +0000 Received: from mail191-ch1 (localhost [127.0.0.1]) by mail191-ch1-R.bigfish.com (Postfix) with ESMTP id 2BB81260120 for ; Thu, 23 May 2013 17:07:48 +0000 (UTC) X-Forefront-Antispam-Report: CIP:157.56.244.181;KIP:(null);UIP:(null);IPV:NLI;H:CH1PRD0410HT005.namprd04.prod.outlook.com;RD:none;EFVD:NLI X-SpamScore: 6 X-BigFish: PS6(zz936eIc85fhdbeeh12d5Idbd5idbb0izz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz1b1984h17326ah18c673h18602eh186068h8275bh1b9c21h123cabnz31h54h2a8h668h839hd25hf0ah1288h12a5h12bdh137ah1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h19ceh1a24h1a82h1ad9h1b0ah1bceh1d07h1d0ch1d2eh1d3fh1dc1h1155h) Received-SPF: softfail (mail191-ch1: transitioning domain of elynx.com does not designate 157.56.244.181 as permitted sender) client-ip=157.56.244.181; envelope-from=tboemker@elynx.com; helo=CH1PRD0410HT005.namprd04.prod.outlook.com ;.outlook.com ; Received: from mail191-ch1 (localhost.localdomain [127.0.0.1]) by mail191-ch1 (MessageSwitch) id 1369328864418771_15751; Thu, 23 May 2013 17:07:44 +0000 (UTC) Received: from CH1EHSMHS017.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.234]) by mail191-ch1.bigfish.com (Postfix) with ESMTP id 5A1AC80078 for ; Thu, 23 May 2013 17:07:44 +0000 (UTC) Received: from CH1PRD0410HT005.namprd04.prod.outlook.com (157.56.244.181) by CH1EHSMHS017.bigfish.com (10.43.70.17) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 23 May 2013 17:07:43 +0000 Received: from CH1PRD0410MB380.namprd04.prod.outlook.com ([169.254.12.226]) by CH1PRD0410HT005.namprd04.prod.outlook.com ([10.255.147.40]) with mapi id 14.16.0311.000; Thu, 23 May 2013 17:07:43 +0000 From: "Boemker, Tim" To: "dev@ant.apache.org" Subject: Enhancement request: add option failonwarning to Javadoc task Thread-Topic: Enhancement request: add option failonwarning to Javadoc task Thread-Index: Ac5X2Aiy7vWef6ejQ3CfbdrM1RVYoA== Date: Thu, 23 May 2013 17:07:42 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-originating-ip: [199.175.187.4] Content-Type: multipart/related; boundary="_007_AB5C244567184949B9C73F32BBC470372CFF171FCH1PRD0410MB380_"; type="multipart/alternative" MIME-Version: 1.0 X-OriginatorOrg: elynx.com X-Virus-Checked: Checked by ClamAV on apache.org --_007_AB5C244567184949B9C73F32BBC470372CFF171FCH1PRD0410MB380_ Content-Type: multipart/alternative; boundary="_000_AB5C244567184949B9C73F32BBC470372CFF171FCH1PRD0410MB380_" --_000_AB5C244567184949B9C73F32BBC470372CFF171FCH1PRD0410MB380_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable It would be useful if the javadoc task could fail a build if the javadoc pr= ogram issued any warnings. One way to do this would be to add an option, failonwarning, and to modify = org.apache.tools.ant.taskdefs.Javadoc as follows: --- /cygdrive/c/Users/tboemker/Desktop/jars/apache-ant-1.9.1-src/src/main/o= rg/apache/tools/ant/taskdefs/Javadoc.java 2013-05-15 22:37:06.000000000 = -0400 +++ Javadoc.java 2013-05-23 12:55:38.875978100 -0400 @@ -15,7 +15,7 @@ * limitations under the License. * */ -package org.apache.tools.ant.taskdefs; +package com.eLynx; import java.io.File; import java.io.FileWriter; @@ -39,6 +39,9 @@ import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.Task; +import org.apache.tools.ant.taskdefs.Execute; +import org.apache.tools.ant.taskdefs.LogOutputStream; +import org.apache.tools.ant.taskdefs.PumpStreamHandler; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.DirSet; import org.apache.tools.ant.types.EnumeratedAttribute; @@ -423,6 +426,11 @@ * Javadoc error. */ private boolean failOnError =3D false; + /** + * Flag which indicates if the task should fail if there is a + * Javadoc warning. + */ + private boolean failOnWarning =3D false; private Path sourcePath =3D null; private File destDir =3D null; private Vector sourceFiles =3D new Vector(); @@ -1540,6 +1548,17 @@ } /** + * Should the build process fail if Javadoc warns (as indicated by + * the word "warnings" in stdout)? + * + *

Default is false.

+ * @param b a boolean value + */ + public void setFailonwarning(boolean b) { + failOnWarning =3D b; + } + + /** * Enables the -source switch, will be ignored if Javadoc is not * the 1.4 version. * @param source a String value @@ -1765,6 +1784,10 @@ throw new BuildException("Javadoc returned " + ret, getLocation()); } + if (out.sawWarnings() && failOnWarning) { + throw new BuildException("Javadoc issued warnings.", + getLocation()); + } } catch (IOException e) { throw new BuildException("Javadoc failed: " + e, e, getLocatio= n()); } finally { @@ -2431,7 +2454,10 @@ // unless they appear after what could be an informational message= . // private String queuedLine =3D null; + private boolean sawWarnings =3D false; protected void processLine(String line, int messageLevel) { + if(line.contains("warnings")) + sawWarnings =3D true; if (messageLevel =3D=3D Project.MSG_INFO && line.startsWith("Generating ")) { if (queuedLine !=3D null) { @@ -2458,6 +2484,10 @@ queuedLine =3D null; } } + + public boolean sawWarnings() { + return sawWarnings; + } } /** [cid:image001.jpg@01CC1AD4.42937250] Tim Boemker Sr. Software Engineer tboemker@elynx.com office: 513.612.5945 fax: 513.612.5978 www.elynx.com enter the world of [cid:image003.png@01CC1A25.1F2D0CE0] [cid:image004.jpg@01CC1A25.1F2D0CE0] [cid:image005.jpg@01CC1A25.1F2D0CE0] Electronic Privacy Notice. This email may be covered by electronic communic= ations privacy laws and may be confidential or proprietary in nature. If yo= u are not the intended recipient, you are prohibited from retaining, using,= copying, distributing or disclosing this email. Instead, please reply to t= he sender that you have received this email in error, and then delete it. T= hank you. --_000_AB5C244567184949B9C73F32BBC470372CFF171FCH1PRD0410MB380_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
It would be useful if the javadoc task could fail a build if the javad= oc program issued any warnings.
 
One way to do this would be to add an option, failonwarning, and to mo= dify org.apache.tools.ant.taskdefs.Javadoc as follows:
 
--- /cygdrive/c/Users/tboemker/Desktop/jars= /apache-ant-1.9.1-src/src/main/org/apache/tools/ant/taskdefs/Javadoc.java&n= bsp;   2013-05-15 22:37:06.000000000 -0400
+++ Javadoc.java  &nb= sp;     2013-05-23 12:55:38.875978100 -0400
@@ -15,7 +15,7 @@
  *  limitations under the Licens= e.
  *
  */
-package org.apache.tools.ant.taskdefs;
+package com.eLynx;
 
import java.io.File;
import java.io.FileWriter;
@@ -39,6 +39,9 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectCompone= nt;
import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.E= xecute;
+import org.apache.tools.ant.taskdefs.L= ogOutputStream;
+import org.apache.tools.ant.taskdefs.P= umpStreamHandler;
import org.apache.tools.ant.types.Commandl= ine;
import org.apache.tools.ant.types.DirSet;<= /font>
import org.apache.tools.ant.types.Enumerat= edAttribute;
@@ -423,6 +426,11 @@
      * Javadoc er= ror.
      */
     private boolean fa= ilOnError =3D false;
+    /**
+     * Flag which = indicates if the task should fail if there is a
+     * Javadoc war= ning.
+     */
+    private boolean fai= lOnWarning =3D false;
     private Path sourc= ePath =3D null;
     private File destD= ir =3D null;
     private Vector<= SourceFile> sourceFiles =3D new Vector<SourceFile>();
@@ -1540,6 +1548,17 @@
     }
 
     /**
+     * Should the = build process fail if Javadoc warns (as indicated by
+     * the word &q= uot;warnings" in stdout)?
+     *
+     * <p>De= fault is false.</p>
+     * @param b a = <code>boolean</code> value
+     */
+    public void setFail= onwarning(boolean b) {
+      &n= bsp; failOnWarning =3D b;
+    }
+
+    /**
      * Enables th= e -source switch, will be ignored if Javadoc is not
      * the 1.4 ve= rsion.
      * @param sou= rce a <code>String</code> value
@@ -1765,6 +1784,10 @@
       &= nbsp;         throw new BuildExcept= ion("Javadoc returned " + ret,
       &= nbsp;           &nbs= p;            &= nbsp;         getLocation());
       &= nbsp;     }
+      &n= bsp;     if (out.sawWarnings() && failOnWarning= ) {
+      &n= bsp;         throw new BuildExcepti= on("Javadoc issued warnings.",
+      &n= bsp;            = ;     getLocation());
+      &n= bsp;     }
       &= nbsp; } catch (IOException e) {
       &= nbsp;     throw new BuildException("Javadoc failed= : " + e, e, getLocation());
       &= nbsp; } finally {
@@ -2431,7 +2454,10 @@
       &= nbsp; // unless they appear after what could be an informational message.
       &= nbsp; //
       &= nbsp; private String queuedLine =3D null;
+      &n= bsp; private boolean sawWarnings =3D false;
       &= nbsp; protected void processLine(String line, int messageLevel) {
+      &n= bsp;         if(line.contains("= ;warnings"))
+      &n= bsp;            = ;     sawWarnings =3D true;
       &= nbsp;     if (messageLevel =3D=3D Project.MSG_INFO
       &= nbsp;         && line.start= sWith("Generating ")) {
       &= nbsp;         if (queuedLine !=3D n= ull) {
@@ -2458,6 +2484,10 @@
       &= nbsp;         queuedLine =3D null;<= /font>
       &= nbsp;     }
       &= nbsp; }
+
+      &n= bsp; public boolean sawWarnings() {
+      &n= bsp;         return sawWarnings;
+      &n= bsp; }
     }
 
     /**
 
 
Tim Boemker
Sr. Software Engineer<= br> tboemker@elynx.com<= /font>
office: 513.612.5945
fax: 5= 13.612.5978
www.elynx.com
 
enter = the world of  
 
 
Electronic Privacy Notice. This email may be c= overed by electronic communications privacy laws and may be confidential or= proprietary in nature. If you are not the intended recipient, you are prohibited from retaining, using, copying, dist= ributing or disclosing this email. Instead, please reply to the sender that= you have received this email in error, and then delete it. Thank you.
 
 
 
--_000_AB5C244567184949B9C73F32BBC470372CFF171FCH1PRD0410MB380_-- --_007_AB5C244567184949B9C73F32BBC470372CFF171FCH1PRD0410MB380_--