Skip to content

Apache Lucene open-source search software

LUCENE-3006: fail on javadoc warnings

Grant Ingersoll937ee38c7ff6
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 0ec3f79127e..8ea03b6dcc2 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -379,6 +379,11 @@ Test Cases
stop iterating if at least 'tests.iter.min' ran and a failure occured.
(Shai Erera, Chris Hostetter)
+Build
+
+* LUCENE-3006: Building javadocs will fail on warnings by default. Override with -Dfailonjavadocwarning=false (sarowe, gsingers)
+
+
======================= Lucene 3.x (not yet released) =======================
Changes in backwards compatibility policy
diff --git a/lucene/build.xml b/lucene/build.xml
index 1d12084cf76..3a0a522249a 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -200,6 +200,7 @@
<path refid="classpath"/>
<pathelement location="${ant.home}/lib/ant.jar"/>
<fileset dir=".">
+ <exclude name="build/**/*.jar"/>
<include name="**/lib/*.jar"/>
</fileset>
<pathelement location="${common.dir}/../modules/analysis/build/common/lucene-analyzers-common-${version}.jar"/>
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 7415bbcd916..3225f7e0774 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -103,6 +103,7 @@
<path refid="classpath"/>
<pathelement location="${ant.home}/lib/ant.jar"/>
<fileset dir=".">
+ <exclude name="build/**/*.jar"/>
<include name="**/lib/*.jar"/>
</fileset>
</path>
@@ -762,7 +763,8 @@
</fixcrlf>
</sequential>
</macrodef>
-
+
+ <property name="failonjavadocwarning" value="true"/>
<macrodef name="invoke-javadoc">
<element name="sources" optional="yes"/>
<attribute name="destdir"/>
@@ -772,6 +774,7 @@
<copy todir="@{destdir}/../prettify" overwrite="false">
<fileset dir="${prettify.dir}"/>
</copy>
+ <record name="@{destdir}/log_javadoc.txt" action="start" append="no"/>
<javadoc
overview="@{overview}"
packagenames="org.apache.lucene.*"
@@ -783,6 +786,7 @@
author="true"
version="true"
use="true"
+ failonerror="true"
source="${ant.java.version}"
link="${javadoc.link}"
windowtitle="${Name} ${version} API"
@@ -804,6 +808,26 @@
<classpath refid="javadoc.classpath"/>
</javadoc>
+ <record name="@{destdir}/log_javadoc.txt" action="stop"/>
+
+ <delete>
+ <fileset file="@{destdir}/log_javadoc.txt">
+ <not>
+ <containsregexp expression="\[javadoc\]\s*[1-9][0-9]*[\s]*warning"/>
+ </not>
+ </fileset>
+ </delete>
+
+ <fail message="Javadocs warnings were found!">
+ <condition>
+ <and>
+ <available file="@{destdir}/log_javadoc.txt"/>
+ <istrue value="${failonjavadocwarning}"/>
+ </and>
+ </condition>
+ </fail>
+
+
</sequential>
</macrodef>
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 0f36491e0be..df4a7231fb1 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -211,6 +211,8 @@ Documentation
* SOLR-2232: Improved README info on solr.solr.home in examples
(Eric Pugh and hossman)
+* LUCENE-3006: Building javadocs will fail on warnings by default. Override with -Dfailonjavadocwarning=false (sarowe, gsingers)
+
================== 3.2.0-dev ==================
Versions of Major Components
---------------------
diff --git a/solr/common-build.xml b/solr/common-build.xml
index 420f75726e4..861ff237062 100644
--- a/solr/common-build.xml
+++ b/solr/common-build.xml
@@ -330,6 +330,7 @@
</sequential>
</macrodef>
+ <property name="failonjavadocwarning" value="true"/>
<macrodef name="invoke-javadoc">
<element name="sources" optional="yes"/>
<attribute name="destdir"/>
@@ -339,6 +340,7 @@
<copy todir="@{destdir}/prettify" overwrite="false">
<fileset dir="${prettify.dir}"/>
</copy>
+ <record name="@{destdir}/log_javadoc.txt" action="start" append="no"/>
<javadoc
packagenames="org.apache.solr.*"
failonerror="true"
@@ -373,6 +375,24 @@
<classpath refid="javadoc.classpath"/>
</javadoc>
+ <record name="@{destdir}/log_javadoc.txt" action="stop"/>
+
+ <delete>
+ <fileset file="@{destdir}/log_javadoc.txt">
+ <not>
+ <containsregexp expression="\[javadoc\]\s*[1-9][0-9]*[\s]*warning"/>
+ </not>
+ </fileset>
+ </delete>
+
+ <fail message="Javadocs warnings were found!" >
+ <condition>
+ <and>
+ <available file="@{destdir}/log_javadoc.txt"/>
+ <istrue value="${failonjavadocwarning}"/>
+ </and>
+ </condition>
+ </fail>
</sequential>
</macrodef>