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 2015/08/12 14:52:24 UTC

svn commit: r1695499 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/webapp/ solr/webapp/web/libs/

Author: uschindler
Date: Wed Aug 12 12:52:24 2015
New Revision: 1695499

URL: http://svn.apache.org/r1695499
Log:
Merged revision(s) 1695496 from lucene/dev/trunk:
LUCENE-6732: Improve javadoc-style license checker to use Apache RAT

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/build.xml
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/webapp/   (props changed)
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.js
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.min.js
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-resource.min.js
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.js
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.min.js
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.js
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.min.js
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.js
    lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.min.js

Modified: lucene/dev/branches/branch_5x/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/build.xml?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/build.xml (original)
+++ lucene/dev/branches/branch_5x/build.xml Wed Aug 12 12:52:24 2015
@@ -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)));
           }
         }
       };

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.min.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.min.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.min.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-cookies.min.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-resource.min.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-resource.min.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-resource.min.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-resource.min.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.min.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.min.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.min.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-route.min.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.min.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.min.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.min.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular-sanitize.min.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org

Modified: lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.min.js
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.min.js?rev=1695499&r1=1695498&r2=1695499&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.min.js (original)
+++ lucene/dev/branches/branch_5x/solr/webapp/web/libs/angular.min.js Wed Aug 12 12:52:24 2015
@@ -1,4 +1,4 @@
-/**
+/*
 The MIT License
 
 Copyright (c) 2010-2015 Google, Inc. http://angularjs.org