LUCENE-4763: Fix Java version detection in common-build.xml, use correct source version for javadocs, fail build on unsupported java version when documentation linting is enabled

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1444254 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-02-08 22:00:15 +00:00
parent 806ab343c6
commit 6677bbf60f
4 changed files with 61 additions and 16 deletions

View File

@ -375,28 +375,44 @@
</target> </target>
<!-- Jenkins tasks --> <!-- Jenkins tasks -->
<target name="jenkins-hourly" depends="clean,test-with-heapdumps,validate,documentation-lint,jar-checksums,check-svn-working-copy"/> <target name="-jenkins-base" depends="clean,test-with-heapdumps,validate,documentation-lint,jar-checksums,check-svn-working-copy"/>
<target name="jenkins-hourly">
<antcall>
<param name="is.jenkins.build" value="true"/>
<target name="-jenkins-base"/>
</antcall>
</target>
<target name="jenkins-nightly"> <target name="jenkins-nightly">
<antcall> <antcall>
<param name="is.jenkins.build" value="true"/>
<param name="tests.nightly" value="true"/> <param name="tests.nightly" value="true"/>
<target name="jenkins-hourly"/> <target name="-jenkins-base"/>
</antcall> </antcall>
</target> </target>
<target name="jenkins-maven-nightly" depends="clean,clean-maven-build"> <target name="jenkins-maven-nightly" depends="clean,clean-maven-build">
<!-- step 1: build, install, deploy, and validate ANT-generated maven artifacts: --> <!-- step 1: build, install, deploy, and validate ANT-generated maven artifacts: -->
<antcall> <antcall>
<param name="is.jenkins.build" value="true"/>
<target name="remove-maven-artifacts"/> <target name="remove-maven-artifacts"/>
<!-- this implicitely publishes the maven artifacts: --> <!-- this implicitely publishes the maven artifacts: -->
<target name="validate-maven-dependencies"/> <target name="validate-maven-dependencies"/>
</antcall> </antcall>
<!-- step 2: run the maven build to check that the pom templates also work to drive "mvn": --> <!-- step 2: run the maven build to check that the pom templates also work to drive "mvn": -->
<antcall> <antcall>
<param name="is.jenkins.build" value="true"/>
<target name="remove-maven-artifacts"/> <target name="remove-maven-artifacts"/>
<target name="run-maven-build"/> <target name="run-maven-build"/>
</antcall> </antcall>
</target> </target>
<target name="jenkins-clover" depends="run-clover"/> <target name="jenkins-clover">
<antcall>
<param name="is.jenkins.build" value="true"/>
<target name="run-clover"/>
</antcall>
</target>
</project> </project>

View File

@ -238,11 +238,14 @@
<target name="javadoc" depends="javadocs"/> <target name="javadoc" depends="javadocs"/>
<target name="javadocs" description="Generate javadoc" depends="javadocs-lucene-core, javadocs-modules, javadocs-test-framework"/> <target name="javadocs" description="Generate javadoc" depends="javadocs-lucene-core, javadocs-modules, javadocs-test-framework"/>
<target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint,-documentation-lint-unsupported" <target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint-unsupported" if="documentation-lint.supported"
description="Validates the generated documentation (HTML errors, broken links,...)"/> description="Validates the generated documentation (HTML errors, broken links,...)">
<!-- we use antcall here, otherwise ANT will run all dependent targets: -->
<antcall target="-documentation-lint"/>
</target>
<!-- we check for broken links across all documentation --> <!-- we check for broken links across all documentation -->
<target name="-documentation-lint" if="documentation-lint.supported" depends="documentation"> <target name="-documentation-lint" depends="documentation">
<echo message="checking for broken html..."/> <echo message="checking for broken html..."/>
<jtidy-macro> <jtidy-macro>
<!-- NOTE: must currently exclude deprecated-list due to a javadocs bug (as of 1.7.0_09) <!-- NOTE: must currently exclude deprecated-list due to a javadocs bug (as of 1.7.0_09)
@ -293,7 +296,7 @@
<check-missing-javadocs dir="build/docs/core/org/apache/lucene/codecs" level="method"/> <check-missing-javadocs dir="build/docs/core/org/apache/lucene/codecs" level="method"/>
</target> </target>
<target name="-ecj-javadoc-lint" depends="documentation,compile-test-framework,-ecj-resolve"> <target name="-ecj-javadoc-lint" depends="compile,compile-test,-ecj-resolve">
<subant target="-ecj-javadoc-lint" failonerror="true" inheritall="false"> <subant target="-ecj-javadoc-lint" failonerror="true" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/> <propertyset refid="uptodate.and.compiled.properties"/>
<fileset dir="core" includes="build.xml"/> <fileset dir="core" includes="build.xml"/>

View File

@ -268,6 +268,23 @@
</condition> </condition>
</fail> </fail>
<!--
the propery "ant.java.version" is not always correct, depending on used ANT version.
E.g. Java 8 is only detected in ANT 1.8.3+.
Add newer Java version checks at beginning,
because ANT will nevert override existing properties!
-->
<condition property="build.java.runtime" value="1.8">
<hasmethod classname="java.util.Collections" method="emptySortedSet"/>
</condition>
<condition property="build.java.runtime" value="1.7">
<hasmethod classname="java.lang.Throwable" method="getSuppressed"/>
</condition>
<condition property="build.java.runtime" value="1.6">
<hasmethod classname="java.lang.String" method="isEmpty"/>
</condition>
<fail message="Minimum supported Java version is 1.6." unless="build.java.runtime"/>
<condition property="documentation-lint.supported"> <condition property="documentation-lint.supported">
<and> <and>
<or> <or>
@ -276,8 +293,9 @@
<contains string="${java.vm.name}" substring="jrockit" casesensitive="false"/> <contains string="${java.vm.name}" substring="jrockit" casesensitive="false"/>
</or> </or>
<or> <or>
<equals arg1="${ant.java.version}" arg2="1.7"/> <equals arg1="${build.java.runtime}" arg2="1.7"/>
<equals arg1="${ant.java.version}" arg2="1.8"/> <!-- TODO: Current Java 8 JDKs have broken Javadocs -->
<!--<equals arg1="${build.java.runtime}" arg2="1.8"/>-->
</or> </or>
<!-- TODO: Fix this! For now only run this on 64bit, because jTIDY OOMs with default heap size: --> <!-- TODO: Fix this! For now only run this on 64bit, because jTIDY OOMs with default heap size: -->
<contains string="${os.arch}" substring="64"/> <contains string="${os.arch}" substring="64"/>
@ -285,7 +303,12 @@
</condition> </condition>
<target name="-documentation-lint-unsupported" unless="documentation-lint.supported"> <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!"/> <fail message="Linting documentation HTML is not supported on this Java version (${build.java.runtime}) / JVM (${java.vm.name}).">
<condition>
<not><isset property="is.jenkins.build"/></not>
</condition>
</fail>
<echo level="warning" message="WARN: Linting documentation HTML is not supported on this Java version (${build.java.runtime}) / JVM (${java.vm.name}). NOTHING DONE!"/>
</target> </target>
<!-- Import custom ANT tasks. --> <!-- Import custom ANT tasks. -->
@ -1648,7 +1671,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
linksource="@{linksource}" linksource="@{linksource}"
use="true" use="true"
failonerror="true" failonerror="true"
source="${ant.java.version}" source="${javac.source}"
locale="en_US" locale="en_US"
windowtitle="${Name} ${version} API" windowtitle="${Name} ${version} API"
doctitle="@{title}" doctitle="@{title}"

View File

@ -565,12 +565,15 @@
</sequential> </sequential>
</target> </target>
<target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint,-documentation-lint-unsupported" <target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint-unsupported" if="documentation-lint.supported"
description="Validates the generated documentation (HTML errors, broken links,...)"/> description="Validates the generated documentation (HTML errors, broken links,...)">
<!-- we use antcall here, otherwise ANT will run all dependent targets: -->
<antcall target="-documentation-lint"/>
</target>
<!-- TODO: does solr have any other docs we should check? --> <!-- TODO: does solr have any other docs we should check? -->
<!-- TODO: also integrate checkJavaDocs.py, which does more checks --> <!-- TODO: also integrate checkJavaDocs.py, which does more checks -->
<target name="-documentation-lint" if="documentation-lint.supported" depends="documentation"> <target name="-documentation-lint" depends="documentation">
<jtidy-macro> <jtidy-macro>
<!-- NOTE: must currently exclude deprecated-list due to a javadocs bug (as of 1.7.0_09) <!-- NOTE: must currently exclude deprecated-list due to a javadocs bug (as of 1.7.0_09)
javadocs generates invalid XML if you deprecate a method that takes a parameter javadocs generates invalid XML if you deprecate a method that takes a parameter
@ -584,7 +587,7 @@
<check-missing-javadocs dir="${javadoc.dir}" level="package"/> <check-missing-javadocs dir="${javadoc.dir}" level="package"/>
</target> </target>
<target name="-ecj-javadoc-lint" depends="documentation,compile-solr-test-framework,-ecj-resolve"> <target name="-ecj-javadoc-lint" depends="compile,compile-test,jar-test-framework,-ecj-resolve">
<subant target="-ecj-javadoc-lint" failonerror="true" inheritall="false"> <subant target="-ecj-javadoc-lint" failonerror="true" inheritall="false">
<propertyset refid="uptodate.and.compiled.properties"/> <propertyset refid="uptodate.and.compiled.properties"/>
<fileset dir="core" includes="build.xml"/> <fileset dir="core" includes="build.xml"/>