Apache Lucene open-source search software
LUCENE-6732: Improve javadoc-style license checker to use Apache RAT
Uwe Schindlerfa48923d5d95
diff --git a/build.xml b/build.xmlindex fcd8a9efcd3..daeb82fa857 100644--- a/build.xml+++ b/build.xml@@ -124,11 +124,14 @@</subant></target>- <target name="-validate-source-patterns" unless="disable.source-patterns" depends="resolve-groovy">+ <target name="-validate-source-patterns" unless="disable.source-patterns" depends="resolve-groovy,rat-sources-typedef"><!-- check that there are no @author javadoc tags, tabs, svn keywords, javadoc-style licenses, or nocommits: --><property name="validate.baseDir" location="."/>- <groovy taskname="source-patterns"><![CDATA[+ <groovy taskname="source-patterns" classpathref="rat.classpath"><![CDATA[import org.apache.tools.ant.BuildException;+ import org.apache.rat.Defaults;+ import org.apache.rat.document.impl.FileDocument;+ import org.apache.rat.api.MetaData;def extensions = ['java', 'jflex', 'py', 'pl', 'g4', 'jj', 'html', 'js', 'xml', 'xsl'@@ -146,8 +149,6 @@(~$/\$$Header\b/$) : 'svn keyword',(~$/\$$Source\b/$) : 'svn keyword',];- def licenseOuterPattern = ~$/(?sm)^\Q/**\E(.*?)\Q*/\E/$;- def licenseInnerPattern = ~$/\bLicensed\s+(to|under)\b/$;def baseDir = properties['validate.baseDir'];def baseDirLen = baseDir.length() + 1;@@ -160,6 +161,10 @@found++;}+ def javadocsPattern = ~$/(?sm)^\Q/**\E(.*?)\Q*/\E/$;+ def lineSplitter = ~$/[\r\n]+/$;+ def licenseMatcher = Defaults.createDefaultMatcher();+ant.fileScanner{fileset(dir: baseDir){extensions.each{@@ -178,10 +183,13 @@reportViolation(f, name);}}- def m = licenseOuterPattern.matcher(text);- while (m.find()) {- if (licenseInnerPattern.matcher(m.group(1)).find()) {- reportViolation(f, 'javadoc-style license header');+ def javadocsMatcher = javadocsPattern.matcher(text);+ while (javadocsMatcher.find()) {+ def ratDocument = new FileDocument(f);+ licenseMatcher.reset();+ if (lineSplitter.split(javadocsMatcher.group(1)).any{ licenseMatcher.match(ratDocument, it) }) {+ reportViolation(f, String.format(Locale.ENGLISH, 'javadoc-style license header [%s]',+ ratDocument.getMetaData().value(MetaData.RAT_URL_LICENSE_FAMILY_NAME)));}}};diff --git a/solr/webapp/web/libs/angular-cookies.js b/solr/webapp/web/libs/angular-cookies.jsindex d9108cf030b..6afabd6d142 100644--- a/solr/webapp/web/libs/angular-cookies.js+++ b/solr/webapp/web/libs/angular-cookies.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.orgdiff --git a/solr/webapp/web/libs/angular-cookies.min.js b/solr/webapp/web/libs/angular-cookies.min.jsindex b88c40c0782..cb1fce672e5 100644--- a/solr/webapp/web/libs/angular-cookies.min.js+++ b/solr/webapp/web/libs/angular-cookies.min.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.orgdiff --git a/solr/webapp/web/libs/angular-resource.min.js b/solr/webapp/web/libs/angular-resource.min.jsindex 8700cfa79ca..05b6d4ce9c0 100644--- a/solr/webapp/web/libs/angular-resource.min.js+++ b/solr/webapp/web/libs/angular-resource.min.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.orgdiff --git a/solr/webapp/web/libs/angular-route.js b/solr/webapp/web/libs/angular-route.jsindex 0d45b29b63b..1846bcc8d0f 100644--- a/solr/webapp/web/libs/angular-route.js+++ b/solr/webapp/web/libs/angular-route.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.orgdiff --git a/solr/webapp/web/libs/angular-route.min.js b/solr/webapp/web/libs/angular-route.min.jsindex 7574057fe51..b7f33a8b979 100644--- a/solr/webapp/web/libs/angular-route.min.js+++ b/solr/webapp/web/libs/angular-route.min.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.orgdiff --git a/solr/webapp/web/libs/angular-sanitize.js b/solr/webapp/web/libs/angular-sanitize.jsindex 11f193a47c2..5daf27dff4f 100644--- a/solr/webapp/web/libs/angular-sanitize.js+++ b/solr/webapp/web/libs/angular-sanitize.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.orgdiff --git a/solr/webapp/web/libs/angular-sanitize.min.js b/solr/webapp/web/libs/angular-sanitize.min.jsindex e4eecf4f286..e657c5b75ed 100644--- a/solr/webapp/web/libs/angular-sanitize.min.js+++ b/solr/webapp/web/libs/angular-sanitize.min.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.orgdiff --git a/solr/webapp/web/libs/angular.js b/solr/webapp/web/libs/angular.jsindex 7d57b5b6e90..aebeef16522 100644--- a/solr/webapp/web/libs/angular.js+++ b/solr/webapp/web/libs/angular.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.orgdiff --git a/solr/webapp/web/libs/angular.min.js b/solr/webapp/web/libs/angular.min.jsindex f095ac89211..411bbd975b1 100644--- a/solr/webapp/web/libs/angular.min.js+++ b/solr/webapp/web/libs/angular.min.js@@ -1,4 +1,4 @@-/**+/*The MIT LicenseCopyright (c) 2010-2015 Google, Inc. http://angularjs.org