You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2013/02/08 23:00:16 UTC

svn commit: r1444254 - in /lucene/dev/trunk: build.xml lucene/build.xml lucene/common-build.xml solr/build.xml

Author: uschindler
Date: Fri Feb  8 22:00:15 2013
New Revision: 1444254

URL: http://svn.apache.org/r1444254
Log:
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

Modified:
    lucene/dev/trunk/build.xml
    lucene/dev/trunk/lucene/build.xml
    lucene/dev/trunk/lucene/common-build.xml
    lucene/dev/trunk/solr/build.xml

Modified: lucene/dev/trunk/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/build.xml?rev=1444254&r1=1444253&r2=1444254&view=diff
==============================================================================
--- lucene/dev/trunk/build.xml (original)
+++ lucene/dev/trunk/build.xml Fri Feb  8 22:00:15 2013
@@ -375,28 +375,44 @@
   </target>
 
   <!-- 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">
     <antcall>
+      <param name="is.jenkins.build" value="true"/>
       <param name="tests.nightly" value="true"/>
-      <target name="jenkins-hourly"/>
+      <target name="-jenkins-base"/>
     </antcall>
   </target>
   
   <target name="jenkins-maven-nightly" depends="clean,clean-maven-build">
     <!-- step 1: build, install, deploy, and validate ANT-generated maven artifacts: -->
     <antcall>
+      <param name="is.jenkins.build" value="true"/>
       <target name="remove-maven-artifacts"/>
       <!-- this implicitely publishes the maven artifacts: -->
       <target name="validate-maven-dependencies"/>
     </antcall>
     <!-- step 2: run the maven build to check that the pom templates also work to drive "mvn": -->
     <antcall>
+      <param name="is.jenkins.build" value="true"/>
       <target name="remove-maven-artifacts"/>
       <target name="run-maven-build"/>
     </antcall>
   </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>

Modified: lucene/dev/trunk/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/build.xml?rev=1444254&r1=1444253&r2=1444254&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/build.xml (original)
+++ lucene/dev/trunk/lucene/build.xml Fri Feb  8 22:00:15 2013
@@ -238,11 +238,14 @@
   <target name="javadoc" depends="javadocs"/>
   <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"
-          description="Validates the generated documentation (HTML errors, broken links,...)"/>
+  <target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint-unsupported" if="documentation-lint.supported"
+          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 -->
-  <target name="-documentation-lint" if="documentation-lint.supported" depends="documentation">
+  <target name="-documentation-lint" depends="documentation">
     <echo message="checking for broken html..."/>
     <jtidy-macro>
        <!-- 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"/>
   </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">
       <propertyset refid="uptodate.and.compiled.properties"/>
       <fileset dir="core" includes="build.xml"/>

Modified: lucene/dev/trunk/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/common-build.xml?rev=1444254&r1=1444253&r2=1444254&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/common-build.xml (original)
+++ lucene/dev/trunk/lucene/common-build.xml Fri Feb  8 22:00:15 2013
@@ -268,6 +268,23 @@
     </condition>
   </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">
     <and>
       <or>
@@ -276,8 +293,9 @@
         <contains string="${java.vm.name}" substring="jrockit" casesensitive="false"/>
       </or>
       <or>
-        <equals arg1="${ant.java.version}" arg2="1.7"/>
-        <equals arg1="${ant.java.version}" arg2="1.8"/>
+        <equals arg1="${build.java.runtime}" arg2="1.7"/>
+        <!-- TODO: Current Java 8 JDKs have broken Javadocs -->
+        <!--<equals arg1="${build.java.runtime}" arg2="1.8"/>-->
       </or>
       <!-- TODO: Fix this! For now only run this on 64bit, because jTIDY OOMs with default heap size: -->
       <contains string="${os.arch}" substring="64"/>
@@ -285,7 +303,12 @@
   </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!"/>
+    <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>
 
   <!-- Import custom ANT tasks. -->
@@ -1648,7 +1671,7 @@ ${tests-output}/junit4-*.suites     - pe
           linksource="@{linksource}"
           use="true"
           failonerror="true"
-          source="${ant.java.version}"
+          source="${javac.source}"
           locale="en_US"
           windowtitle="${Name} ${version} API"
           doctitle="@{title}"

Modified: lucene/dev/trunk/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/build.xml?rev=1444254&r1=1444253&r2=1444254&view=diff
==============================================================================
--- lucene/dev/trunk/solr/build.xml (original)
+++ lucene/dev/trunk/solr/build.xml Fri Feb  8 22:00:15 2013
@@ -565,12 +565,15 @@
     </sequential>
   </target>
 
-  <target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint,-documentation-lint-unsupported"
-          description="Validates the generated documentation (HTML errors, broken links,...)"/>
-  
+  <target name="documentation-lint" depends="-ecj-javadoc-lint,-documentation-lint-unsupported" if="documentation-lint.supported"
+          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: 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>
        <!-- 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
@@ -584,7 +587,7 @@
     <check-missing-javadocs dir="${javadoc.dir}" level="package"/>
   </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">
       <propertyset refid="uptodate.and.compiled.properties"/>
       <fileset dir="core" includes="build.xml"/>