LUCENE-4493: Better workflow for documentation linting

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1400081 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2012-10-19 13:14:00 +00:00
parent fd1200c1c7
commit 85c73511fb
4 changed files with 144 additions and 145 deletions

146
build.xml
View File

@ -36,59 +36,31 @@
depends="check-svn-working-copy,validate,documentation-lint"/>
<target name="test" description="Test both Lucene and Solr">
<sequential>
<subant target="test" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
</sequential>
</target>
<target name="pitest" description="Run PITest on both Lucene and Solr">
<sequential>
<subant target="pitest" inheritall="false" failonerror="false">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
</sequential>
</target>
<target name="documentation" description="Generate Lucene and Solr Documentation">
<sequential>
<subant target="documentation" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
</sequential>
</target>
<target name="documentation-lint" depends="-documentation-lint,-documentation-lint-unsupported"
description="Validates the generated documentation (HTML errors, broken links,...)"/>
<condition property="documentation-lint.supported">
<and>
<or>
<contains string="${java.vm.name}" substring="hotspot" casesensitive="false"/>
<contains string="${java.vm.name}" substring="openjdk" casesensitive="false"/>
<contains string="${java.vm.name}" substring="jrockit" casesensitive="false"/>
</or>
<or>
<equals arg1="${ant.java.version}" arg2="1.6"/>
<equals arg1="${ant.java.version}" arg2="1.7"/>
<equals arg1="${ant.java.version}" arg2="1.8"/>
</or>
</and>
</condition>
<target name="-documentation-lint" if="documentation-lint.supported">
<subant target="documentation-lint" inheritall="false" failonerror="true">
<subant target="test" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
</target>
<target name="-documentation-lint-unsupported" unless="documentation-lint.supported">
<echo level="warning" message="WARN: Linting documentation is not supported on this Java version (${ant.java.version}) / JVM (${java.vm.name}). Nothing done!"/>
<target name="pitest" description="Run PITest on both Lucene and Solr">
<subant target="pitest" inheritall="false" failonerror="false">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
</target>
<target name="documentation" description="Generate Lucene and Solr Documentation">
<subant target="documentation" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
</target>
<target name="documentation-lint" description="Validates the generated documentation (HTML errors, broken links,...)">
<subant target="documentation-lint" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
</subant>
</target>
<target name="validate" description="Validate dependencies, licenses, etc." depends="-validate-source-patterns">
@ -278,46 +250,44 @@
</target>
<target name="nightly-smoke" description="Builds an unsigned release and smoke tests it" depends="clean,-env-JAVA6_HOME,-env-JAVA7_HOME">
<sequential>
<fail unless="JAVA6_HOME">JAVA6_HOME property or environment variable is not defined.</fail>
<fail unless="JAVA7_HOME">JAVA7_HOME property or environment variable is not defined.</fail>
<subant target="prepare-release-no-sign" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
<property name="version" value="${fakeReleaseVersion}" />
</subant>
<delete dir="${fakeRelease}"/>
<delete dir="${fakeReleaseTmp}"/>
<mkdir dir="${fakeRelease}"/>
<copy todir="${fakeRelease}/lucene">
<fileset dir="lucene/dist"/>
</copy>
<copy todir="${fakeRelease}/lucene/changes">
<fileset dir="lucene/build/docs/changes"/>
</copy>
<get src="http://people.apache.org/keys/group/lucene.asc"
dest="${fakeRelease}/lucene/KEYS"/>
<copy todir="${fakeRelease}/solr">
<fileset dir="solr/package"/>
</copy>
<copy file="${fakeRelease}/lucene/KEYS" todir="${fakeRelease}/solr"/>
<copy todir="${fakeRelease}/solr/changes">
<fileset dir="solr/build/docs/changes"/>
</copy>
<makeurl file="${fakeRelease}" validate="false" property="fakeRelease.uri"/>
<exec executable="${python32.exe}" failonerror="true">
<arg value="-u"/>
<arg file="dev-tools/scripts/smokeTestRelease.py"/>
<arg value="${fakeRelease.uri}"/>
<arg value="${fakeReleaseVersion}"/>
<arg file="${fakeReleaseTmp}"/>
<arg value="false"/>
<env key="JAVA6_HOME" file="${JAVA6_HOME}"/>
<env key="JAVA7_HOME" file="${JAVA7_HOME}"/>
</exec>
<delete dir="${fakeRelease}"/>
<delete dir="${fakeReleaseTmp}"/>
</sequential>
<fail unless="JAVA6_HOME">JAVA6_HOME property or environment variable is not defined.</fail>
<fail unless="JAVA7_HOME">JAVA7_HOME property or environment variable is not defined.</fail>
<subant target="prepare-release-no-sign" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml" />
<fileset dir="solr" includes="build.xml" />
<property name="version" value="${fakeReleaseVersion}" />
</subant>
<delete dir="${fakeRelease}"/>
<delete dir="${fakeReleaseTmp}"/>
<mkdir dir="${fakeRelease}"/>
<copy todir="${fakeRelease}/lucene">
<fileset dir="lucene/dist"/>
</copy>
<copy todir="${fakeRelease}/lucene/changes">
<fileset dir="lucene/build/docs/changes"/>
</copy>
<get src="http://people.apache.org/keys/group/lucene.asc"
dest="${fakeRelease}/lucene/KEYS"/>
<copy todir="${fakeRelease}/solr">
<fileset dir="solr/package"/>
</copy>
<copy file="${fakeRelease}/lucene/KEYS" todir="${fakeRelease}/solr"/>
<copy todir="${fakeRelease}/solr/changes">
<fileset dir="solr/build/docs/changes"/>
</copy>
<makeurl file="${fakeRelease}" validate="false" property="fakeRelease.uri"/>
<exec executable="${python32.exe}" failonerror="true">
<arg value="-u"/>
<arg file="dev-tools/scripts/smokeTestRelease.py"/>
<arg value="${fakeRelease.uri}"/>
<arg value="${fakeReleaseVersion}"/>
<arg file="${fakeReleaseTmp}"/>
<arg value="false"/>
<env key="JAVA6_HOME" file="${JAVA6_HOME}"/>
<env key="JAVA7_HOME" file="${JAVA7_HOME}"/>
</exec>
<delete dir="${fakeRelease}"/>
<delete dir="${fakeReleaseTmp}"/>
</target>
<target name="check-svn-working-copy" description="Checks the status of the SVN working copy">

View File

@ -226,57 +226,61 @@
<target name="javadoc" depends="javadocs"/>
<target name="javadocs" description="Generate javadoc" depends="javadocs-lucene-core, javadocs-modules, javadocs-test-framework"/>
<!-- we check for broken links across all documentation -->
<target name="documentation-lint" depends="compile-test-framework,documentation,-ecj-resolve">
<sequential>
<subant target="-ecj-javadoc-lint" failonerror="true" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
<fileset dir="core" includes="build.xml"/>
<fileset dir="test-framework" includes="build.xml"/>
</subant>
<modules-crawl target="-ecj-javadoc-lint"/>
<echo message="Checking for broken links..."/>
<check-broken-links dir="build/docs"/>
<echo message="Checking for missing docs..."/>
<!-- TODO: change this level=method -->
<check-missing-javadocs dir="build/docs" level="class"/>
<!-- too many classes to fix overall to just enable
the above to be level="method" right now, but we
can prevent the modules that don't have problems
from getting any worse -->
<!-- analyzers-common: problems -->
<check-missing-javadocs dir="build/docs/analyzers-icu" level="method"/>
<!-- analyzers-kuromoji: problems -->
<check-missing-javadocs dir="build/docs/analyzers-morfologik" level="method"/>
<check-missing-javadocs dir="build/docs/analyzers-phonetic" level="method"/>
<!-- analyzers-smartcn: problems -->
<check-missing-javadocs dir="build/docs/analyzers-stempel" level="method"/>
<!-- analyzers-uima: problems -->
<!-- benchmark: problems -->
<check-missing-javadocs dir="build/docs/classification" level="method"/>
<!-- codecs: problems -->
<!-- core: problems -->
<check-missing-javadocs dir="build/docs/demo" level="method"/>
<!-- facet: problems -->
<!-- grouping: problems -->
<!-- highlighter: problems -->
<check-missing-javadocs dir="build/docs/join" level="method"/>
<check-missing-javadocs dir="build/docs/memory" level="method"/>
<!-- misc: problems -->
<!-- queries: problems -->
<!-- queryparser: problems -->
<!-- sandbox: problems -->
<!-- spatial: problems -->
<check-missing-javadocs dir="build/docs/suggest" level="method"/>
<!-- test-framework: problems -->
<target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint,-documentation-lint-unsupported"
description="Validates the generated documentation (HTML errors, broken links,...)"/>
<!-- too much to fix core/ for now, but enforce full javadocs for key packages -->
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/analysis" level="method"/>
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/document" level="method"/>
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/search/similarities" level="method"/>
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/index" level="method"/>
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/codecs" level="method"/>
</sequential>
<!-- we check for broken links across all documentation -->
<target name="-documentation-lint" if="documentation-lint.supported" depends="documentation">
<echo message="Checking for broken links..."/>
<check-broken-links dir="build/docs"/>
<echo message="Checking for missing docs..."/>
<!-- TODO: change this level=method -->
<check-missing-javadocs dir="build/docs" level="class"/>
<!-- too many classes to fix overall to just enable
the above to be level="method" right now, but we
can prevent the modules that don't have problems
from getting any worse -->
<!-- analyzers-common: problems -->
<check-missing-javadocs dir="build/docs/analyzers-icu" level="method"/>
<!-- analyzers-kuromoji: problems -->
<check-missing-javadocs dir="build/docs/analyzers-morfologik" level="method"/>
<check-missing-javadocs dir="build/docs/analyzers-phonetic" level="method"/>
<!-- analyzers-smartcn: problems -->
<check-missing-javadocs dir="build/docs/analyzers-stempel" level="method"/>
<!-- analyzers-uima: problems -->
<!-- benchmark: problems -->
<check-missing-javadocs dir="build/docs/classification" level="method"/>
<!-- codecs: problems -->
<!-- core: problems -->
<check-missing-javadocs dir="build/docs/demo" level="method"/>
<!-- facet: problems -->
<!-- grouping: problems -->
<!-- highlighter: problems -->
<check-missing-javadocs dir="build/docs/join" level="method"/>
<check-missing-javadocs dir="build/docs/memory" level="method"/>
<!-- misc: problems -->
<!-- queries: problems -->
<!-- queryparser: problems -->
<!-- sandbox: problems -->
<!-- spatial: problems -->
<check-missing-javadocs dir="build/docs/suggest" level="method"/>
<!-- test-framework: problems -->
<!-- too much to fix core/ for now, but enforce full javadocs for key packages -->
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/analysis" level="method"/>
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/document" level="method"/>
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/search/similarities" level="method"/>
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/index" level="method"/>
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/codecs" level="method"/>
</target>
<target name="-ecj-javadoc-lint" depends="documentation,compile-test-framework,-ecj-resolve">
<subant target="-ecj-javadoc-lint" failonerror="true" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
<fileset dir="core" includes="build.xml"/>
<fileset dir="test-framework" includes="build.xml"/>
</subant>
<modules-crawl target="-ecj-javadoc-lint"/>
</target>
<target name="process-webpages" depends="resolve-groovy,resolve-pegdown">

View File

@ -265,6 +265,25 @@
</condition>
</fail>
<condition property="documentation-lint.supported">
<and>
<or>
<contains string="${java.vm.name}" substring="hotspot" casesensitive="false"/>
<contains string="${java.vm.name}" substring="openjdk" casesensitive="false"/>
<contains string="${java.vm.name}" substring="jrockit" casesensitive="false"/>
</or>
<or>
<equals arg1="${ant.java.version}" arg2="1.6"/>
<equals arg1="${ant.java.version}" arg2="1.7"/>
<equals arg1="${ant.java.version}" arg2="1.8"/>
</or>
</and>
</condition>
<target name="-documentation-lint-unsupported" unless="documentation-lint.supported">
<echo level="warning" message="WARN: Linting documentation HTML is not supported on this Java version (${ant.java.version}) / JVM (${java.vm.name}). NOTHING DONE!"/>
</target>
<!-- Import custom ANT tasks. -->
<import file="${common.dir}/tools/custom-tasks.xml" />

View File

@ -520,9 +520,20 @@
</sequential>
</target>
<target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint,-documentation-lint-unsupported"
description="Validates the generated documentation (HTML errors, broken links,...)"/>
<!-- TODO: does solr have any other docs we should check? -->
<!-- TODO: also integrate checkJavaDocs.py, which does more checks -->
<target name="documentation-lint" depends="compile-solr-test-framework,documentation,-ecj-resolve">
<target name="-documentation-lint" if="documentation-lint.supported" depends="documentation">
<echo message="Checking for broken links..."/>
<check-broken-links dir="${javadoc.dir}"/>
<echo message="Checking for malformed docs..."/>
<!-- TODO: add missing package.htmls and bump this to level=package -->
<check-missing-javadocs dir="${javadoc.dir}" level="none"/>
</target>
<target name="-ecj-javadoc-lint" depends="documentation,compile-solr-test-framework,-ecj-resolve">
<subant target="-ecj-javadoc-lint" failonerror="true" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/>
<fileset dir="core" includes="build.xml"/>
@ -530,11 +541,6 @@
<fileset dir="test-framework" includes="build.xml"/>
</subant>
<contrib-crawl target="-ecj-javadoc-lint"/>
<echo message="Checking for broken links..."/>
<check-broken-links dir="${javadoc.dir}"/>
<echo message="Checking for malformed docs..."/>
<!-- TODO: add missing package.htmls and bump this to level=package -->
<check-missing-javadocs dir="${javadoc.dir}" level="none"/>
</target>
<!-- install-maven-tasks is *not* a useless dependency. do not remove -->