You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2012/02/14 09:35:10 UTC

svn commit: r1243824 - in /lucene/dev/branches/branch_3x: lucene/ lucene/lib/ lucene/tools/ lucene/tools/src/java/ lucene/tools/src/java/org/apache/lucene/validation/ solr/ solr/contrib/clustering/lib/ solr/contrib/langid/lib/ solr/lib/

Author: dweiss
Date: Tue Feb 14 08:35:07 2012
New Revision: 1243824

URL: http://svn.apache.org/viewvc?rev=1243824&view=rev
Log:
LUCENE-3774: Optimized and streamlined license and notice file validation
by refactoring the build task into an ANT task and modifying build scripts
to perform top-level checks. (Dawid Weiss, Steve Rowe, Robert Muir)

Added:
    lucene/dev/branches/branch_3x/lucene/lib/ant-junit-NOTICE.txt
    lucene/dev/branches/branch_3x/lucene/tools/custom-tasks.xml
    lucene/dev/branches/branch_3x/lucene/tools/src/java/lucene-solr.antlib.xml
    lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java
    lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-asl-LICENSE-ASL.txt
      - copied, changed from r1243738, lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-LICENSE-ASL.txt
    lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-asl-NOTICE.txt
      - copied, changed from r1243738, lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-NOTICE.txt
    lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-LICENSE-ASL.txt
      - copied, changed from r1243738, lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-LICENSE.txt
    lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-NOTICE.txt
    lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-LICENSE-ASL.txt
      - copied, changed from r1243738, lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-LICENSE.txt
    lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-NOTICE.txt
Removed:
    lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/DependencyChecker.java
    lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-LICENSE-ASL.txt
    lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-NOTICE.txt
    lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-LICENSE.txt
    lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-LICENSE.txt
    lucene/dev/branches/branch_3x/solr/lib/slf4j-api-LICENSE-BSD_LIKE.txt
    lucene/dev/branches/branch_3x/solr/lib/slf4j-api-NOTICE.txt
Modified:
    lucene/dev/branches/branch_3x/lucene/CHANGES.txt
    lucene/dev/branches/branch_3x/lucene/build.xml
    lucene/dev/branches/branch_3x/lucene/common-build.xml
    lucene/dev/branches/branch_3x/lucene/tools/build.xml
    lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseType.java
    lucene/dev/branches/branch_3x/solr/build.xml
    lucene/dev/branches/branch_3x/solr/common-build.xml

Modified: lucene/dev/branches/branch_3x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/CHANGES.txt?rev=1243824&r1=1243823&r2=1243824&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/CHANGES.txt Tue Feb 14 08:35:07 2012
@@ -245,6 +245,10 @@ Build
     <ant dir="internal-module-dir"> calls) to these modules' build.xml files.
   (Steve Rowe)
 
+* LUCENE-3774: Optimized and streamlined license and notice file validation
+  by refactoring the build task into an ANT task and modifying build scripts
+  to perform top-level checks. (Dawid Weiss, Steve Rowe, Robert Muir)
+
 
 ======================= Lucene 3.5.0 =======================
 

Modified: lucene/dev/branches/branch_3x/lucene/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/build.xml?rev=1243824&r1=1243823&r2=1243824&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/build.xml (original)
+++ lucene/dev/branches/branch_3x/lucene/build.xml Tue Feb 14 08:35:07 2012
@@ -49,6 +49,7 @@
       <propertyset refid="uptodate.and.compiled.properties"/>
     </ant>
   </target>
+
   <target name="test" depends="test-core, test-contrib, test-backwards"
           description="Runs all unit tests (core, contrib and back-compat)"
   />
@@ -178,6 +179,17 @@
     </clover-report>
   </target>
 
+  <!-- Validate once from top-level. -->
+  <target name="validate" depends="compile-tools" description="Validate legal stuff.">
+    <license-check-macro dir="${basedir}">
+      <additional-excludes>
+        <exclude name="backwards/lib/**/*.jar" />
+      </additional-excludes>
+      <additional-filters>
+      </additional-filters>
+    </license-check-macro>
+  </target>
+
   <!-- ================================================================== -->
   <!-- D O C U M E N T A T I O N                                          -->
   <!-- ================================================================== -->

Modified: lucene/dev/branches/branch_3x/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/common-build.xml?rev=1243824&r1=1243823&r2=1243824&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/common-build.xml (original)
+++ lucene/dev/branches/branch_3x/lucene/common-build.xml Tue Feb 14 08:35:07 2012
@@ -62,10 +62,6 @@
     <fileset dir="${common.dir}/lib" includes="ant-*.jar"/>
   </path>
 
-  <path id="tools.runtime.classpath">
-    <pathelement location="${common.dir}/build/tools/classes/java"/>
-  </path>
-
   <path id="maven-ant-tasks.classpath">
     <fileset dir="${common.dir}/lib">
       <include name="maven-ant-tasks-*.jar"/>
@@ -214,6 +210,9 @@
               excludes="**/pom.xml,**/*.iml,site/build/"
   />
 
+  <!-- Import custom ANT tasks. -->
+  <import file="${common.dir}/tools/custom-tasks.xml" />
+
   <target name="clean"
     description="Removes contents of build and dist directories">
     <delete dir="${build.dir}"/>
@@ -325,7 +324,7 @@
     </copy>
   </target>
 
-  <target name="compile" depends="compile-core, validate-lucene">
+  <target name="compile" depends="compile-core">
     <!-- convenience target to compile core -->
   </target>
 
@@ -756,12 +755,14 @@
     <attribute name="destdir"/>
     <attribute name="javac.source" default="${javac.source}"/>
     <attribute name="javac.target" default="${javac.target}"/>
+    <attribute name="includeantruntime" default="${javac.includeAntRuntime}" />
+
     <element name="nested" implicit="yes" optional="yes"/>
 
     <sequential>
       <mkdir dir="@{destdir}"/>
       <javac
-        includeAntRuntime="${javac.includeAntRuntime}"
+        includeAntRuntime="@{includeantruntime}"
         encoding="${build.encoding}"
         srcdir="@{srcdir}"
         destdir="@{destdir}"
@@ -890,50 +891,10 @@
   </target>
 
   <!-- VALIDATION work -->
-  <!--
-   >find . -name lib
-./lucene/backwards/lib
-./lucene/contrib/ant/lib
-./lucene/contrib/benchmark/lib
-./lucene/contrib/db/bdb/lib
-./lucene/contrib/db/bdb-je/lib
-./lucene/contrib/icu/lib
-./lucene/contrib/lucli/lib
-./lucene/contrib/queries/lib
-./lucene/lib
-
-
-   -->
-  <target name="check-legal-lucene" depends="compile-tools">
-    <java classname="org.apache.lucene.validation.DependencyChecker" failonerror="true" fork="true">
-      <classpath>
-        <path refid="tools.runtime.classpath" />
-      </classpath>
-      <!-- TODO: it might be better to just automatically find all directories that contain jar files, but that could take a
-       long time.  This should be faster, but we could miss a directory
-       TODO: convert this to just check whichever library is currently being built
-       -->
-      <!-- Lucene  -->
-      <arg value="-c" />
-      <arg value="${common.dir}/lib" />
-      <arg value="-c" />
-      <arg value="${common.dir}/contrib/benchmark/lib" />
-      <arg value="-c" />
-      <arg value="${common.dir}/contrib/icu/lib" />
-
-      <arg value="-c" />
-      <arg value="${common.dir}/contrib/lucli/lib" />
-      <arg value="-c" />
-      <arg value="${common.dir}/contrib/queries/lib" />
-    </java>
-  </target>
-
-  <target name="check-legal" depends="check-legal-lucene"/>
-
-  <target name="validate-lucene" depends="check-legal-lucene" unless="validated-lucene"/>
 
   <!-- Generic placeholder target for if we add other validation tasks -->
-  <target name="validate" depends="validate-lucene"/>
+  <target name="validate" depends="compile-tools">
+  </target>
 
   <property name="svn.export.dir" location="${build.dir}/svn-export"/>
   <macrodef name="svn-export-source"
@@ -1055,5 +1016,4 @@
       </scp>
     </sequential>
   </macrodef>
-
 </project>

Added: lucene/dev/branches/branch_3x/lucene/lib/ant-junit-NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/lib/ant-junit-NOTICE.txt?rev=1243824&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/lib/ant-junit-NOTICE.txt (added)
+++ lucene/dev/branches/branch_3x/lucene/lib/ant-junit-NOTICE.txt Tue Feb 14 08:35:07 2012
@@ -0,0 +1,6 @@
+Apache Ant
+Copyright 1999-2008 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Modified: lucene/dev/branches/branch_3x/lucene/tools/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/tools/build.xml?rev=1243824&r1=1243823&r2=1243824&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/tools/build.xml (original)
+++ lucene/dev/branches/branch_3x/lucene/tools/build.xml Tue Feb 14 08:35:07 2012
@@ -31,8 +31,12 @@
       classpath reference when compiling, and to not attempt to copy
       non-existent resource files to the build output directory.
    -->
-  <target name="compile-core" depends="init" description="Compiles tools classes">
-    <compile srcdir="${src.dir}" destdir="${build.dir}/classes/java"/>
+  <target name="compile-core" depends="init" description="Compiles tools classes.">
+    <compile srcdir="${src.dir}" destdir="${build.dir}/classes/java" 
+      includeantruntime="true" />
+    <copy todir="${build.dir}/classes/java">
+      <fileset dir="${src.dir}" excludes="**/*.java" />
+    </copy>
   </target>
   
   <target name="javadocs"/> <!-- to make common-build.xml happy -->

Added: lucene/dev/branches/branch_3x/lucene/tools/custom-tasks.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/tools/custom-tasks.xml?rev=1243824&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/tools/custom-tasks.xml (added)
+++ lucene/dev/branches/branch_3x/lucene/tools/custom-tasks.xml Tue Feb 14 08:35:07 2012
@@ -0,0 +1,59 @@
+
+<project name="custom-tasks">
+  <description>
+    This file is designed for importing into a main build file, and not intended
+    for standalone use.
+  </description>
+
+  <macrodef name="license-check-macro">
+    <attribute name="dir" />
+    <element name="additional-excludes" optional="true" />
+    <element name="additional-filters"  optional="true" />
+    <sequential>
+      <!-- LICENSE and NOTICE verification macro. -->
+      <dirname file="${ant.file.custom-tasks}" property="custom-tasks.dir"/>
+      <taskdef resource="lucene-solr.antlib.xml">
+        <classpath>
+          <pathelement location="${custom-tasks.dir}/../build/tools/classes/java" />
+        </classpath>
+      </taskdef>
+
+      <echo>License check under: @{dir}</echo>
+      <licenses>
+        <fileset dir="@{dir}">
+          <include name="**/*.jar" />
+          <!-- Speed up scanning a bit. -->
+          <exclude name="**/.git/**" />
+          <exclude name="**/.svn/**" />
+          <exclude name="**/bin/**" />
+          <exclude name="**/build/**" />
+          <exclude name="**/dist/**" />
+          <exclude name="**/src/**" />
+          <additional-excludes />
+        </fileset>
+
+        <licenseMapper>
+          <filtermapper id="license-mapper-defaults">
+            <!-- Normalize input paths. -->
+            <replacestring from="\" to="/" />
+            <replaceregex pattern="\.jar$" replace="" flags="gi" />
+    
+            <!-- Some typical snapshot/minimalized JAR suffixes. -->
+            <replaceregex pattern="-min$" replace="" flags="gi" />
+            <replaceregex pattern="SNAPSHOT$" replace="" flags="gi" />
+
+            <!-- Non-typical version patterns. -->
+            <additional-filters />
+            <replaceregex pattern="/xercesImpl([^/]+)$" replace="/xercesImpl" flags="gi" />
+            <replaceregex pattern="/commons-csv-([^/]+)$" replace="/commons-csv" flags="gi" />
+            <replaceregex pattern="/(bcmail|bcprov)-([^/]+)$" replace="/\1" flags="gi" />
+            <replaceregex pattern="/slf4j-([^/]+)$" replace="/slf4j" flags="gi" />
+    
+            <!-- Typical version patterns. -->
+            <replaceregex pattern="\-(r)?([0-9\-\_\.])+(b(eta)?([0-9\-\.])*)?$" replace="" flags="gi" />
+          </filtermapper>
+        </licenseMapper>
+      </licenses>
+    </sequential>
+  </macrodef>
+</project>
\ No newline at end of file

Added: lucene/dev/branches/branch_3x/lucene/tools/src/java/lucene-solr.antlib.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/tools/src/java/lucene-solr.antlib.xml?rev=1243824&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/tools/src/java/lucene-solr.antlib.xml (added)
+++ lucene/dev/branches/branch_3x/lucene/tools/src/java/lucene-solr.antlib.xml Tue Feb 14 08:35:07 2012
@@ -0,0 +1,5 @@
+<antlib>
+    <taskdef 
+        name="licenses" 
+        classname="org.apache.lucene.validation.LicenseCheckTask" />
+</antlib> 
\ No newline at end of file

Added: lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java?rev=1243824&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java (added)
+++ lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseCheckTask.java Tue Feb 14 08:35:07 2012
@@ -0,0 +1,179 @@
+package org.apache.lucene.validation;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Mapper;
+import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.types.resources.Resources;
+import org.apache.tools.ant.util.FileNameMapper;
+
+/**
+ * An ANT task that verifies if JAR file have associated <tt>LICENSE</tt>
+ * and <tt>NOTICE</tt> files. 
+ */
+public class LicenseCheckTask extends Task {
+  /**
+   * All JAR files to check.
+   */
+  private Resources jarResources = new Resources();
+
+  /**
+   * License file mapper.
+   */
+  private FileNameMapper licenseMapper;
+
+  /**
+   * A logging level associated with verbose logging.
+   */
+  private int verboseLevel = Project.MSG_VERBOSE;
+  
+  /**
+   * Failure flag.
+   */
+  private boolean failures;
+
+  /**
+   * Adds a set of JAR resources to check.
+   */
+  public void add(ResourceCollection rc) {
+    jarResources.add(rc);
+  }
+  
+  /**
+   * Adds a license mapper.
+   */
+  public void addConfiguredLicenseMapper(Mapper mapper) {
+    if (licenseMapper != null) {
+      throw new BuildException("Only one license mapper is allowed.");
+    }
+    this.licenseMapper = mapper.getImplementation();
+  }
+
+  public void setVerbose(boolean verbose) {
+    verboseLevel = (verbose ? Project.MSG_INFO : Project.MSG_VERBOSE);
+  }
+
+  /**
+   * Execute the task.
+   */
+  @Override
+  public void execute() throws BuildException {
+    if (licenseMapper == null) {
+      throw new BuildException("Expected an embedded <licenseMapper>.");
+    }
+
+    jarResources.setProject(getProject());
+    processJars();
+
+    if (failures) {
+      throw new BuildException("License check failed. Check the logs.");
+    }
+  }
+
+  /**
+   * Process all JARs.
+   */
+  private void processJars() {
+    log("Starting scan.", verboseLevel);
+    long start = System.currentTimeMillis();
+
+    @SuppressWarnings("unchecked")
+    Iterator<Resource> iter = (Iterator<Resource>) jarResources.iterator();
+    int checked = 0;
+    int errors = 0;
+    while (iter.hasNext()) {
+      final Resource r = iter.next();
+      if (!r.isExists()) { 
+        throw new BuildException("JAR resource does not exist: " + r.getName());
+      }
+      if (!(r instanceof FileResource)) {
+        throw new BuildException("Only filesystem resource are supported: " + r.getName()
+            + ", was: " + r.getClass().getName());
+      }
+
+      File jarFile = ((FileResource) r).getFile();
+      if (!checkJarFile(jarFile)) {
+        errors++;
+      }
+      checked++;
+    }
+
+    log(String.format(Locale.ENGLISH, 
+        "Scanned %d JAR file(s) for licenses (in %.2fs.), %d error(s).",
+        checked, (System.currentTimeMillis() - start) / 1000.0, errors),
+        errors > 0 ? Project.MSG_ERR : Project.MSG_INFO);
+  }
+
+  /**
+   * Check a single JAR file.
+   */
+  private boolean checkJarFile(File jarFile) {
+    log("Scanning: " + jarFile.getPath(), verboseLevel);
+
+    // Get the expected license path base from the mapper and search for license files.
+    Map<File, LicenseType> foundLicenses = new LinkedHashMap<File, LicenseType>();
+    List<File> expectedLocations = new ArrayList<File>();
+outer:
+    for (String mappedPath : licenseMapper.mapFileName(jarFile.getPath())) {
+      for (LicenseType licenseType : LicenseType.values()) {
+        File licensePath = new File(mappedPath + licenseType.licenseFileSuffix());
+        if (licensePath.exists()) {
+          foundLicenses.put(licensePath, licenseType);
+          log(" FOUND " + licenseType.name() + " license at " + licensePath.getPath(), 
+              verboseLevel);
+          // We could continue scanning here to detect duplicate associations?
+          break outer;
+        } else {
+          expectedLocations.add(licensePath);
+        }
+      }
+    }
+
+    // Check for NOTICE files.
+    for (Map.Entry<File, LicenseType> e : foundLicenses.entrySet()) {
+      LicenseType license = e.getValue();
+      String licensePath = e.getKey().getAbsolutePath();
+      String baseName = licensePath.substring(
+          0, licensePath.length() - license.licenseFileSuffix().length());
+      File noticeFile = new File(baseName + license.noticeFileSuffix());
+
+      if (noticeFile.exists()) {
+        log(" FOUND NOTICE file at " + noticeFile.getAbsolutePath(), verboseLevel);
+      } else {
+        if (license.isNoticeRequired()) {
+            this.failures = true;
+            log("MISSING NOTICE for the license file:\n  "
+                + licensePath + "\n  Expected location below:\n  "
+                + noticeFile.getAbsolutePath(), Project.MSG_ERR);
+        }
+      }
+    }
+
+    // In case there is something missing, complain.
+    if (foundLicenses.isEmpty()) {
+      this.failures = true;
+      StringBuilder message = new StringBuilder();
+      message.append(
+          "MISSING LICENSE for the following file:\n  " + jarFile.getAbsolutePath()
+          + "\n  Expected locations below:\n");
+      for (File location : expectedLocations) {
+        message.append("  => ").append(location.getAbsolutePath()).append("\n");
+      }
+      log(message.toString(), Project.MSG_ERR);
+      return false;
+    }
+
+    return true;
+  }
+}

Modified: lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseType.java?rev=1243824&r1=1243823&r2=1243824&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseType.java (original)
+++ lucene/dev/branches/branch_3x/lucene/tools/src/java/org/apache/lucene/validation/LicenseType.java Tue Feb 14 08:35:07 2012
@@ -23,7 +23,6 @@ package org.apache.lucene.validation;
  *
  **/
 public enum LicenseType {
-
   ASL("Apache Software License 2.0", true),
   BSD("Berkeley Software Distribution", true),
   BSD_LIKE("BSD like license", true),//BSD like just means someone has taken the BSD license and put in their name, copyright, or it's a very similar license.
@@ -34,14 +33,13 @@ public enum LicenseType {
   MPL("Mozilla Public License", false), //NOT SURE on the required notice
   PD("Public Domain", false),
   //SUNBCLA("Sun Binary Code License Agreement"),
-  SUN("Sun Open Source License", false)
-          ;
+  SUN("Sun Open Source License", false),
+  COMPOUND("Compound license (see NOTICE).", true),
+  FAKE("FAKE license - not needed", false);
 
   private String display;
-
   private boolean noticeRequired;
 
-
   LicenseType(String display, boolean noticeRequired) {
     this.display = display;
     this.noticeRequired = noticeRequired;
@@ -55,11 +53,24 @@ public enum LicenseType {
     return display;
   }
 
-
   public String toString() {
     return "LicenseType{" +
             "display='" + display + '\'' +
             '}';
   }
+
+  /**
+   * Expected license file suffix for a given license type.
+   */
+  public String licenseFileSuffix() {
+    return "-LICENSE-" + this.name() + ".txt";
+  }
+
+  /**
+   * Expected notice file suffix for a given license type.
+   */
+  public String noticeFileSuffix() {
+    return "-NOTICE.txt";
+  }
 }
 

Modified: lucene/dev/branches/branch_3x/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/build.xml?rev=1243824&r1=1243823&r2=1243824&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/build.xml Tue Feb 14 08:35:07 2012
@@ -128,7 +128,7 @@
   <target name="compile" description="Compile the source code."
           depends="compile-core, compile-contrib"/>
   <target name="test" description="Validate, then run core, solrj, and contrib unit tests."
-          depends="validate-solr, test-jsp, test-core, test-contrib"/>
+          depends="validate, test-jsp, test-core, test-contrib"/>
   <target name="test-core" description="Runs the core and solrj unit tests."
           depends="test-solr-core, test-solrj"/>
   <target name="compile-test" description="Compile unit tests."
@@ -175,6 +175,27 @@
     </ant>
   </target>
   
+  <!-- Validation (license/ notice checks). -->
+  <target name="validate" depends="compile-tools" description="Validate legal stuff.">
+    <license-check-macro dir="${basedir}">
+      <additional-excludes>
+        <!-- Exclude start.jar only (it'd be weird to have a license file there?) -->
+        <exclude name="example/start.jar" />
+        <exclude name="example/exampledocs/post.jar" />
+        <exclude name="example/work/**" />
+      </additional-excludes>
+      <additional-filters>
+        <replaceregex pattern="/hppc([^/]+)$" replace="/hppc" flags="gi" />
+        <replaceregex pattern="/langdetect([^/]+)$" replace="/langdetect" flags="gi" />
+        <replaceregex pattern="/geronimo-stax([^/]+)$" replace="/geronimo-stax" flags="gi" />
+        <replaceregex pattern="/jetty-util([^/]+)$" replace="/jetty-util" flags="gi" />
+        <replaceregex pattern="/jetty-6([^/]+)$" replace="/jetty" flags="gi" />
+        <replaceregex pattern="/jsp-2.1-glassfish([^/]+)$" replace="/jsp-2.1-glassfish" flags="gi" />
+        <replaceregex pattern="/jsp-api-2.1-glassfish([^/]+)$" replace="/jsp-api-2.1-glassfish" flags="gi" />
+      </additional-filters>
+    </license-check-macro>
+  </target>
+  
   <!-- Clean targets -->
   <target name="clean" description="Cleans compiled files and other temporary artifacts.">
     <delete dir="build" />
@@ -182,9 +203,12 @@
     <delete dir="package" />
     <delete dir="example/solr/lib" />
     <delete includeemptydirs="true">
-      <fileset dir="example" includes="**/data/**/*" excludes="**/.gitignore" />
-      <fileset dir="example/webapps" includes="**/*" excludes="**/.gitignore" />
-      <fileset dir="example/work" includes="**/*" excludes="**/.gitignore" />
+      <fileset dir="example">
+        <include name="**/data/**/*" />
+        <include name="webapps/**/*" />
+        <include name="work/**/*" />
+        <exclude name="**/.gitignore" />
+      </fileset>
     </delete>
     <echo message="TODO: fix tests to not write files to 'core/src/test-files/solr/data'!" />
     <delete dir="core/src/test-files/solr/data" />
@@ -257,6 +281,7 @@
     </clover-report>
   </target>
 
+  
   <!-- ========================================================================= -->
   <!-- ===================== DISTRIBUTION-RELATED TASKS ======================== -->
   <!-- ========================================================================= -->

Modified: lucene/dev/branches/branch_3x/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/common-build.xml?rev=1243824&r1=1243823&r2=1243824&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/common-build.xml (original)
+++ lucene/dev/branches/branch_3x/solr/common-build.xml Tue Feb 14 08:35:07 2012
@@ -116,46 +116,8 @@
     </sequential>
   </macrodef>
 
-  <target name="validate" depends="validate-solr"/>
-  <target name="validate-solr" depends="check-legal-solr" unless="validated-solr.uptodate"/>
-
-  <target name="check-legal-solr" depends="compile-tools">
-    <java classname="org.apache.lucene.validation.DependencyChecker" failonerror="true" fork="true">
-      <classpath>
-        <path refid="tools.runtime.classpath" />
-      </classpath>
-      <!-- TODO: it might be better to just automatically find all directories that contain jar files, but that could take a
-       long time.  This should be faster, but we could miss a directory
-       -->
-      <!-- Solr -->
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/contrib/analysis-extras/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/contrib/clustering/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/contrib/dataimporthandler/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/contrib/dataimporthandler-extras/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/contrib/extraction/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/contrib/uima/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/example/example-DIH/solr/db/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/example/example-DIH/solr/mail/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/example/example/lib" />
-      <arg value="-c" />
-      <arg value="${common-solr.dir}/core/src/test-files/solr/lib" />
-    </java>
-    <property name="validated-solr.uptodate" value="true"/>
-  </target>
-  <path id="tools.runtime.classpath">
-    <pathelement location="${common.dir}/build/tools/classes/java"/>
-  </path>
+  <target name="validate" depends="compile-tools">
+  </target>
 
   <target name="init-dist" >
     <mkdir dir="${build.dir}"/>

Copied: lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-asl-LICENSE-ASL.txt (from r1243738, lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-LICENSE-ASL.txt)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-asl-LICENSE-ASL.txt?p2=lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-asl-LICENSE-ASL.txt&p1=lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-LICENSE-ASL.txt&r1=1243738&r2=1243824&rev=1243824&view=diff
==============================================================================
    (empty)

Copied: lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-asl-NOTICE.txt (from r1243738, lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-NOTICE.txt)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-asl-NOTICE.txt?p2=lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-asl-NOTICE.txt&p1=lucene/dev/branches/branch_3x/solr/contrib/clustering/lib/jackson-core-NOTICE.txt&r1=1243738&r2=1243824&rev=1243824&view=diff
==============================================================================
    (empty)

Copied: lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-LICENSE-ASL.txt (from r1243738, lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-LICENSE.txt)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-LICENSE-ASL.txt?p2=lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-LICENSE-ASL.txt&p1=lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-LICENSE.txt&r1=1243738&r2=1243824&rev=1243824&view=diff
==============================================================================
    (empty)

Added: lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-NOTICE.txt?rev=1243824&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-NOTICE.txt (added)
+++ lucene/dev/branches/branch_3x/solr/contrib/langid/lib/jsonic-NOTICE.txt Tue Feb 14 08:35:07 2012
@@ -0,0 +1,3 @@
+
+jsonic - simple json encoder/decoder for java
+http://jsonic.sourceforge.jp/
\ No newline at end of file

Copied: lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-LICENSE-ASL.txt (from r1243738, lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-LICENSE.txt)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-LICENSE-ASL.txt?p2=lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-LICENSE-ASL.txt&p1=lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-LICENSE.txt&r1=1243738&r2=1243824&rev=1243824&view=diff
==============================================================================
    (empty)

Added: lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-NOTICE.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-NOTICE.txt?rev=1243824&view=auto
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-NOTICE.txt (added)
+++ lucene/dev/branches/branch_3x/solr/contrib/langid/lib/langdetect-NOTICE.txt Tue Feb 14 08:35:07 2012
@@ -0,0 +1,3 @@
+langdetect
+
+http://code.google.com/p/language-detection/
\ No newline at end of file