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/05 10:15:35 UTC

svn commit: r1442507 - in /lucene/dev/trunk: lucene/ lucene/licenses/ lucene/tools/ lucene/tools/forbiddenApis/ lucene/tools/lib/ lucene/tools/src/java/ lucene/tools/src/java/org/apache/lucene/validation/ solr/ solr/solrj/

Author: uschindler
Date: Tue Feb  5 09:15:35 2013
New Revision: 1442507

URL: http://svn.apache.org/viewvc?rev=1442507&view=rev
Log:
LUCENE-4570: Use the Policeman Formbidden API checker, released separately from Lucene and downloaded via Ivy

Removed:
    lucene/dev/trunk/lucene/licenses/asm-debug-all-4.1.jar.sha1
    lucene/dev/trunk/lucene/licenses/asm-debug-all-LICENSE-BSD_LIKE.txt
    lucene/dev/trunk/lucene/licenses/asm-debug-all-NOTICE.txt
    lucene/dev/trunk/lucene/tools/forbiddenApis/commons-io.txt
    lucene/dev/trunk/lucene/tools/forbiddenApis/jdk-deprecated.txt
    lucene/dev/trunk/lucene/tools/forbiddenApis/jdk.txt
    lucene/dev/trunk/lucene/tools/forbiddenApis/system-out.txt
    lucene/dev/trunk/lucene/tools/lib/
    lucene/dev/trunk/lucene/tools/src/java/org/apache/lucene/validation/ForbiddenApisCheckTask.java
Modified:
    lucene/dev/trunk/lucene/CHANGES.txt
    lucene/dev/trunk/lucene/build.xml
    lucene/dev/trunk/lucene/common-build.xml
    lucene/dev/trunk/lucene/tools/build.xml
    lucene/dev/trunk/lucene/tools/custom-tasks.xml
    lucene/dev/trunk/lucene/tools/ivy.xml
    lucene/dev/trunk/lucene/tools/src/java/lucene-solr.antlib.xml
    lucene/dev/trunk/solr/build.xml
    lucene/dev/trunk/solr/common-build.xml
    lucene/dev/trunk/solr/solrj/ivy.xml

Modified: lucene/dev/trunk/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/CHANGES.txt?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/CHANGES.txt (original)
+++ lucene/dev/trunk/lucene/CHANGES.txt Tue Feb  5 09:15:35 2013
@@ -137,6 +137,9 @@ Build
 
 * LUCENE-4636: Upgrade ivy to 2.3.0 (Shawn Heisey via Robert Muir)
 
+* LUCENE-4570: Use the Policeman Formbidden API checker, released separately
+  from Lucene and downloaded via Ivy.  (Uwe Schindler, Robert Muir)
+
 ======================= Lucene 4.1.0 =======================
 
 Changes in backwards compatibility policy

Modified: lucene/dev/trunk/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/build.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/build.xml (original)
+++ lucene/dev/trunk/lucene/build.xml Tue Feb  5 09:15:35 2013
@@ -157,28 +157,34 @@
     <license-check-macro dir="${basedir}" licensedir="${common.dir}/licenses" />
   </target>
 
-  <target name="check-forbidden-apis" depends="compile-tools,compile-test,load-custom-tasks,-check-forbidden-jdk-apis,-check-forbidden-test-apis,-check-system-out" description="Check forbidden API calls in compiled class files"/>
+  <target name="check-forbidden-apis" depends="compile-tools,compile-test,install-forbidden-apis,-forbidden-apis-classpath,-check-forbidden-jdk-apis,-check-forbidden-test-apis,-check-system-out" description="Check forbidden API calls in compiled class files"/>
+
+  <!-- TODO: Make the forbidden API checks per module! -->
+  <target name="-forbidden-apis-classpath">
+    <path id="forbidden-apis.classpath">
+      <fileset dir="${basedir}" includes="**/lib/*.jar"/>
+      <dirset dir="${basedir}/build" includes="**/classes/*"/>
+    </path>
+  </target>
 
   <target name="-check-forbidden-jdk-apis">
-    <forbidden-apis> 
-      <apiFileSet dir="${custom-tasks.dir}/forbiddenApis">
-        <include name="jdk.txt" />
-        <include name="jdk-deprecated.txt" />
-        <include name="executors.txt" />
-      </apiFileSet>
+    <forbidden-apis internalRuntimeForbidden="true" classpathref="forbidden-apis.classpath">
+      <bundledSignatures name="jdk-unsafe-${javac.target}"/>
+      <bundledSignatures name="jdk-deprecated-${javac.target}"/>
+      <signaturesFileSet file="${common.dir}/tools/forbiddenApis/executors.txt"/>
       <fileset dir="${basedir}/build" includes="**/*.class" />
     </forbidden-apis>
   </target>
 
   <target name="-check-forbidden-test-apis">
-    <forbidden-apis apiFile="${custom-tasks.dir}/forbiddenApis/tests.txt"> 
+    <forbidden-apis signaturesFile="${common.dir}/tools/forbiddenApis/tests.txt" classpathref="forbidden-apis.classpath"> 
       <classpath refid="junit-path"/>
       <fileset dir="${basedir}/build" includes="**/classes/test/**/*.class,test-framework/**/*.class" />
     </forbidden-apis>
   </target>
 
   <target name="-check-system-out">
-    <forbidden-apis apiFile="${custom-tasks.dir}/forbiddenApis/system-out.txt">
+    <forbidden-apis bundledSignatures="jdk-system-out" classpathref="forbidden-apis.classpath">
       <fileset dir="${basedir}/build">
         <include name="**/classes/java/**/*.class"/>
         <!-- this is basically tests -->

Modified: lucene/dev/trunk/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/common-build.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/common-build.xml (original)
+++ lucene/dev/trunk/lucene/common-build.xml Tue Feb  5 09:15:35 2013
@@ -1902,6 +1902,14 @@ ${tests-output}/junit4-*.suites     - pe
     <property name="groovy.loaded" value="true"/>
   </target>
   
+  <!-- Forbidden API Task -->
+  <target name="install-forbidden-apis" unless="forbidden-apis.loaded" depends="ivy-availability-check,ivy-configure">
+    <ivy:cachepath organisation="de.thetaphi" module="forbiddenapis" revision="1.0"
+      inline="true" conf="default" transitive="true" pathid="forbidden-apis.classpath"/>
+    <taskdef name="forbidden-apis" classname="de.thetaphi.forbiddenapis.AntTask" classpathref="forbidden-apis.classpath"/>
+    <property name="forbidden-apis.loaded" value="true"/>
+  </target>
+  
   <!-- PEGDOWN macro: Before using depend on the target "resolve-pegdown" -->
   
   <target name="resolve-pegdown" unless="pegdown.loaded" depends="ivy-availability-check,ivy-configure">

Modified: lucene/dev/trunk/lucene/tools/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/build.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/build.xml (original)
+++ lucene/dev/trunk/lucene/tools/build.xml Tue Feb  5 09:15:35 2013
@@ -25,7 +25,6 @@
   <import file="../common-build.xml"/>
 
   <path id="classpath">
-    <fileset dir="lib"/>
   </path>
 
   <!--  

Modified: lucene/dev/trunk/lucene/tools/custom-tasks.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/custom-tasks.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/custom-tasks.xml (original)
+++ lucene/dev/trunk/lucene/tools/custom-tasks.xml Tue Feb  5 09:15:35 2013
@@ -10,7 +10,6 @@
     <taskdef resource="lucene-solr.antlib.xml">
       <classpath>
         <pathelement location="${custom-tasks.dir}/../build/tools/classes/java" />
-        <fileset dir="${custom-tasks.dir}/lib" includes="asm-debug-all-4.1.jar" />
       </classpath>
     </taskdef>
     <property name="custom-tasks.loaded" value="true"/>

Modified: lucene/dev/trunk/lucene/tools/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/ivy.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/ivy.xml (original)
+++ lucene/dev/trunk/lucene/tools/ivy.xml Tue Feb  5 09:15:35 2013
@@ -18,12 +18,4 @@
 -->
 <ivy-module version="2.0">
     <info organisation="org.apache.lucene" module="core-tools"/>
-    <dependencies>
-      <!-- 
-       We use the asm-debug-all library, as the as-all has no generics.
-       It's not really debug, just not "stripped":
-      -->
-      <dependency org="org.ow2.asm" name="asm-debug-all" rev="4.1" transitive="false"/>
-      <exclude org="*" ext="*" matcher="regexp" type="${ivy.exclude.types}"/> 
-    </dependencies>
 </ivy-module>

Modified: lucene/dev/trunk/lucene/tools/src/java/lucene-solr.antlib.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/tools/src/java/lucene-solr.antlib.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/tools/src/java/lucene-solr.antlib.xml (original)
+++ lucene/dev/trunk/lucene/tools/src/java/lucene-solr.antlib.xml Tue Feb  5 09:15:35 2013
@@ -18,7 +18,4 @@
     <taskdef 
         name="licenses" 
         classname="org.apache.lucene.validation.LicenseCheckTask" />
-    <taskdef 
-        name="forbidden-apis" 
-        classname="org.apache.lucene.validation.ForbiddenApisCheckTask" />
 </antlib> 

Modified: lucene/dev/trunk/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/build.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/solr/build.xml (original)
+++ lucene/dev/trunk/solr/build.xml Tue Feb  5 09:15:35 2013
@@ -236,19 +236,29 @@
     </license-check-macro>
   </target>
   
-  <target name="check-forbidden-apis" depends="compile-tools,compile-test,load-custom-tasks,-check-forbidden-java-apis,-check-forbidden-test-apis" 
+  <target name="check-forbidden-apis" depends="compile-tools,compile-test,install-forbidden-apis,-forbidden-apis-classpath,-check-forbidden-java-apis,-check-forbidden-test-apis" 
           description="Check forbidden API calls in compiled class files."/>
 
+  <!-- TODO: Make the forbidden API checks per module! Also remove failOnMissingClasses="false" below!!! -->
+  <target name="-forbidden-apis-classpath">
+    <path id="forbidden-apis.classpath">
+      <fileset dir="${basedir}" includes="**/lib/*.jar"/>
+      <dirset dir="${basedir}/build" includes="**/classes/*"/>
+      <path refid="solr.lucene.libs"/>
+      <path refid="classpath"/>
+      <path refid="test.classpath"/>
+    </path>
+  </target>
+
   <target name="-check-forbidden-java-apis">
-    <forbidden-apis>
-      <classpath refid="additional.dependencies"/>
-      <apiFileSet dir="${custom-tasks.dir}/forbiddenApis">
-        <include name="jdk.txt" />
-        <include name="jdk-deprecated.txt" />
-        <include name="commons-io.txt" />
+    <forbidden-apis internalRuntimeForbidden="true" classpathref="forbidden-apis.classpath" failOnMissingClasses="false">
+      <bundledSignatures name="jdk-unsafe-${javac.target}"/>
+      <bundledSignatures name="jdk-deprecated-${javac.target}"/>
+      <bundledSignatures name="commons-io-unsafe-${commons-io.version}"/>
+      <signaturesFileSet dir="${common.dir}/tools/forbiddenApis">
         <include name="executors.txt" />
         <include name="servlet-api.txt" />
-      </apiFileSet>
+      </signaturesFileSet>
       <fileset dir="${basedir}/build">
         <include name="**/*.class" />        
         <!-- violates the servlet-api restrictions, but it is safe to do so in this test: -->
@@ -258,8 +268,7 @@
   </target>
 
   <target name="-check-forbidden-test-apis">
-    <forbidden-apis apiFile="${custom-tasks.dir}/forbiddenApis/tests.txt"> 
-      <classpath refid="junit-path"/>
+    <forbidden-apis signaturesFile="${common.dir}/tools/forbiddenApis/tests.txt" classpathref="forbidden-apis.classpath" failOnMissingClasses="false">
       <fileset dir="${basedir}/build">
         <include name="**/classes/test/**/*.class"/>
         <include name="solr-test-framework/**/*.class"/>

Modified: lucene/dev/trunk/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/common-build.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/solr/common-build.xml (original)
+++ lucene/dev/trunk/solr/common-build.xml Tue Feb  5 09:15:35 2013
@@ -68,6 +68,10 @@
        where X.Y.M is the last version released (on this branch).
     -->
   <property name="solr.spec.version" value="5.0.0.${dateversion}" />
+  
+  <!-- defined here to be able to make the forbidden-api checker correctly
+   reference it. 'ivy.xml' is also referencing this property. -->
+  <property name="commons-io.version" value="2.1" />
 
   <path id="solr.lucene.libs">
     <!-- List of jars that will be used as the foundation for both

Modified: lucene/dev/trunk/solr/solrj/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/ivy.xml?rev=1442507&r1=1442506&r2=1442507&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/ivy.xml (original)
+++ lucene/dev/trunk/solr/solrj/ivy.xml Tue Feb  5 09:15:35 2013
@@ -24,7 +24,7 @@
       <dependency org="org.apache.httpcomponents" name="httpcore" rev="4.1.4" transitive="false"/>
       <dependency org="org.apache.httpcomponents" name="httpclient" rev="4.1.3" transitive="false"/>
       <dependency org="org.apache.httpcomponents" name="httpmime" rev="4.1.3" transitive="false"/>
-      <dependency org="commons-io" name="commons-io" rev="2.1" transitive="false"/>
+      <dependency org="commons-io" name="commons-io" rev="${commons-io.version}" transitive="false"/>
       <dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.6.4" transitive="false"/>
       <dependency org="org.codehaus.woodstox" name="wstx-asl" rev="3.2.7" transitive="false"/>
       <dependency org="org.slf4j" name="slf4j-api" rev="1.6.4" transitive="false"/>