Index: common-build.xml
===================================================================
--- common-build.xml	(revision 0)
+++ common-build.xml	(revision 0)
@@ -0,0 +1,28 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project name="all-common" default="default" basedir="."
+         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+  <target name="compile" description="Compile Validation tools">
+    <sequential>
+      <subant target="compile" inheritall="false" failonerror="true">
+        <fileset dir="dev-tools/validation" includes="build.xml" />
+      </subant>
+    </sequential>
+  </target>
+</project>
\ No newline at end of file
Index: dev-tools/validation/lib/commons-cli-1.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: dev-tools/validation/lib/commons-cli-1.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: dev-tools/validation/src/main/java/org/apache/lucene/validation/LicenseChecker.java
===================================================================
--- dev-tools/validation/src/main/java/org/apache/lucene/validation/LicenseChecker.java	(revision 0)
+++ dev-tools/validation/src/main/java/org/apache/lucene/validation/LicenseChecker.java	(revision 0)
@@ -0,0 +1,193 @@
+package org.apache.lucene.validation;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.cli.PosixParser;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ *
+ **/
+public class LicenseChecker {
+  private static Set<String> excludes = new HashSet<String>();
+
+  static {
+    //Collections.addAll(excludes, );
+  }
+
+  public static void main(String[] args) throws IOException {
+    Options options = new Options();
+    Option dumpOpt = OptionBuilder.withLongOpt("dump").hasArg().withDescription("Print the JAR and it's license to a file.  Arg is the name of the file").create("d");
+    options.addOption(dumpOpt);
+    Option checkOpt = OptionBuilder.withLongOpt("check").hasArg().withDescription("Check that every jar in the specified dir has an associated license file").create("c");
+    options.addOption(checkOpt);
+    CommandLine cmdLine = null;
+    try {
+      PosixParser parser = new PosixParser();
+      cmdLine = parser.parse(options, args);
+
+      boolean dump = cmdLine.hasOption(dumpOpt.getOpt());
+      FileWriter writer = null;
+      if (dump == true) {
+        File out = new File(cmdLine.getOptionValue(dumpOpt.getOpt()));
+        System.out.println("Dumping to " + out);
+        writer = new FileWriter(out);
+      }
+      boolean check = cmdLine.hasOption(checkOpt.getOpt());
+
+      File dir = new File(cmdLine.getOptionValue(checkOpt.getOpt()));
+      if (dir.exists()) {
+        File[] list = dir.listFiles();
+        File[] licFiles = dir.listFiles(new FileFilter() {
+          public boolean accept(File file) {
+            return file.getName().indexOf("-license") != -1;
+          }
+        });
+        if (licFiles.length == 0) {
+          System.out.println("No license files found");
+          return;
+        }
+        Map<String, UpdateableInt> licenseNames = new HashMap<String, UpdateableInt>();
+        for (int i = 0; i < licFiles.length; i++) {
+          licenseNames.put(licFiles[i].getName(), new UpdateableInt());
+        }
+        int numFailed = 0;
+        for (int i = 0; i < list.length; i++) {
+          File file = list[i];
+          String fileName = file.getName();
+          if (fileName.endsWith(".jar") && excludes.contains(fileName) == false) {
+            File licFile = getLicenseFile(file, licenseNames);
+            if (licFile != null && licFile.exists()) {
+              String licName = licFile.getName();
+              LicenseType[] types = getLicenseTypes(licName);
+              if (types != null && types.length > 0) {
+                for (int j = 0; j < types.length; j++) {
+                  LicenseType type = types[j];
+                  if (dump == true) {
+                    writer.write(file.getName() + "," + type.getDisplay() + StringUtils.LINE_SEPARATOR);
+                  }
+                }
+              } else {
+                System.out.println("!!!!!! Couldn't determine license type for file: " + file);
+                if (dump == true) {
+                  writer.write("Invalid license for file: " + file + StringUtils.LINE_SEPARATOR);
+                }
+                numFailed++;
+              }
+            } else {
+              System.out.println("!!!!!!! Couldn't get license file for " + file);
+              if (dump == true) {
+                writer.write("Couldn't get license file for " + file + StringUtils.LINE_SEPARATOR);
+              }
+              numFailed++;
+            }
+          }
+        }
+        if (dump == true) {
+          writer.write(StringUtils.LINE_SEPARATOR + StringUtils.LINE_SEPARATOR);
+          writer.write("Other Licenses (installer, javascript, etc." + StringUtils.LINE_SEPARATOR);
+        }
+
+        if (dump == true) {
+          for (Map.Entry<String, UpdateableInt> entry : licenseNames.entrySet()) {
+            if (entry.getValue().theInt == 0) {
+              LicenseType[] types = getLicenseTypes(entry.getKey());
+              if (types != null && types.length > 0) {
+                for (int i = 0; i < types.length; i++) {
+                  writer.write(entry.getKey() + "," + types[i].getDisplay() + StringUtils.LINE_SEPARATOR);
+                }
+              } else {
+                System.out.println("Couldn't determine license for: " + entry.getKey());
+              }
+            }
+          }
+        }
+        if (writer != null) {
+          writer.close();
+        }
+        if (numFailed > 0) {
+          System.out.println("At least one file does not have a license, or it's license name is not in the proper format.  See the logs.");
+          System.exit(-1);
+        } else {
+          System.out.println("Found a license for every file.");
+        }
+      } else {
+        System.out.println("Could not find directory:" + dir);
+      }
+    } catch (ParseException exp) {
+      exp.printStackTrace(System.err);
+    }
+  }
+
+  private static LicenseType[] getLicenseTypes(String licName) {
+    LicenseType[] result = new LicenseType[0];
+    int idx = licName.lastIndexOf("-");
+    if (idx != -1) {
+      String licAbbrev = licName.substring(idx + 1, licName.length() - ".txt".length());
+      String[] lics = licAbbrev.split("_");
+      result = new LicenseType[lics.length];
+      for (int j = 0; j < lics.length; j++) {
+        try {
+          result[j] = LicenseType.valueOf(lics[j].toUpperCase());
+        } catch (IllegalArgumentException e) {
+          System.out.println("Invalid license: " + lics[j].toUpperCase() + " for " + licName);
+        }
+      }
+    }
+    return result;
+  }
+
+  private static File getLicenseFile(File file, Map<String, UpdateableInt> licenseNames) {
+    File result = null;
+    String filename = file.getName();
+    int length = 0;
+    for (String licName : licenseNames.keySet()) {
+      String prefix = licName.substring(0, licName.indexOf("-license"));
+      String name = null;
+
+      if (filename.toLowerCase().startsWith(prefix.toLowerCase())) {
+        result = new File(file.getParentFile(), licName);
+        UpdateableInt ui = licenseNames.get(licName);
+        ui.theInt++;
+      }
+
+    }
+    // System.out.println("License File: " + result + " for file: " + file);
+
+    return result;
+  }
+
+}
+
+class UpdateableInt {
+  public int theInt;
+}
Index: dev-tools/validation/build.xml
===================================================================
--- dev-tools/validation/build.xml	(revision 0)
+++ dev-tools/validation/build.xml	(revision 0)
@@ -0,0 +1,74 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<project name="validation" default="check-legal" basedir="."
+         xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+  <property name="build.dir" value="build"/>
+  <property name="dest.dir" value="${build.dir}/classes"/>
+  <property name="src.dir" value="src/main/java"/>
+  <property name="java.compat.version" value="1.5"/>
+
+  <path id="classpath">
+    <pathelement location="lib"/>
+  </path>
+
+
+  <target name="compile">
+    <mkdir dir="${dest.dir}" />
+      <javac destdir="${dest.dir}"
+             target="${java.compat.version}"
+             source="${java.compat.version}"
+             debug="on"
+             encoding="utf8"
+             includeAntRuntime="${javac.includeAntRuntime}"
+             srcdir="${src.dir}"
+             classpathref="classpath">
+         <compilerarg line="-Xlint -Xlint:-deprecation -Xlint:-serial"/>
+      </javac>
+  </target>
+
+  <target name="check-legal" depends="">
+    <delete dir="${assembly.base.dir}/legal" />
+    <copy todir="${assembly.base.dir}/legal" flatten="true">
+      <path refid="compile-libraries" />
+      <path refid="runtime-libraries" />
+      <path refid="gcm-libraries" />
+      <fileset dir="legal" />
+    </copy>
+  	<unzip dest="${build.dir}/tmp/sp" src="gcm/connectors/connector-sharepoint-2.6.8.zip"/>
+    <copy todir="${assembly.base.dir}/legal" flatten="true">
+    	<fileset dir="${build.dir}/tmp/sp" includes="**/*.jar"/>
+    </copy>
+    <java classname="LicenseHelper" failonerror="true" fork="true">
+      <classpath>
+        <path refid="compile-libraries" />
+        <path refid="runtime-libraries" />
+        <path refid="test-libraries" />
+        <pathelement path="${assembly.base.dir}/classes" />
+        <pathelement path="${assembly.base.dir}/utils-classes" />
+      </classpath>
+      <arg value="-c" />
+      <arg value="${assembly.base.dir}/legal" />
+    </java>
+    <!-- delete jars that are not needed there -->
+    <delete>
+      <fileset dir="${assembly.base.dir}/legal" includes="*.jar"/>
+    </delete>
+  </target>
+
+</project>
Index: build.xml
===================================================================
--- build.xml	(revision 1079013)
+++ build.xml	(working copy)
@@ -18,6 +18,7 @@
  -->
 
 <project name="lucene-solr" default="test" basedir=".">
+  <import file="common-build.xml"/>
   <target name="test" description="Test both Lucene and Solr">
     <sequential>
       <subant target="test" inheritall="false" failonerror="true">
