You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by po...@apache.org on 2016/11/08 22:24:21 UTC

svn commit: r1768796 - in /creadur/rat/trunk: ./ apache-rat-core/src/main/java/org/apache/rat/annotation/ apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/ apache-rat-core/src/test/java/org/apache/rat/annotation/ src/changes/

Author: pottlinger
Date: Tue Nov  8 22:24:21 2016
New Revision: 1768796

URL: http://svn.apache.org/viewvc?rev=1768796&view=rev
Log:
RAT-223: Add support for Golang and Perl modules
(contributed by Eric Friedrich)

* Manually added pull request from Github and adapted change log.

Modified:
    creadur/rat/trunk/RELEASE_NOTES.txt
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java
    creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
    creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenseAppender.java
    creadur/rat/trunk/src/changes/changes.xml

Modified: creadur/rat/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/RELEASE_NOTES.txt?rev=1768796&r1=1768795&r2=1768796&view=diff
==============================================================================
--- creadur/rat/trunk/RELEASE_NOTES.txt (original)
+++ creadur/rat/trunk/RELEASE_NOTES.txt Tue Nov  8 22:24:21 2016
@@ -1,4 +1,4 @@
-Rat 0.12 (SNAPSHOT)
+Rat 0.12
 ===================
 
  * We now require Maven 3.0.5+ to build Rat, but as before we only require

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java?rev=1768796&r1=1768795&r2=1768796&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/annotation/AbstractLicenseAppender.java Tue Nov  8 22:24:21 2016
@@ -67,6 +67,8 @@ public abstract class AbstractLicenseApp
     private static final int TYPE_BEANSHELL = 23;
     private static final int TYPE_JSP = 24;
     private static final int TYPE_FML = 25;
+    private static final int TYPE_GO = 26;
+    private static final int TYPE_PM = 27;    
 
     /**
      * the line separator for this OS
@@ -76,14 +78,14 @@ public abstract class AbstractLicenseApp
     private static final int[] FAMILY_C = new int[]{
             TYPE_JAVA, TYPE_JAVASCRIPT, TYPE_C, TYPE_H, TYPE_SCALA,
             TYPE_CSS, TYPE_CPP, TYPE_CSHARP, TYPE_PHP, TYPE_GROOVY,
-            TYPE_BEANSHELL,
+            TYPE_BEANSHELL, TYPE_GO,
     };
     private static final int[] FAMILY_SGML = new int[]{
             TYPE_XML, TYPE_HTML, TYPE_JSP, TYPE_FML,
     };
     private static final int[] FAMILY_SH = new int[]{
             TYPE_PROPERTIES, TYPE_PYTHON, TYPE_SH, TYPE_RUBY, TYPE_PERL,
-            TYPE_TCL, TYPE_VISUAL_STUDIO_SOLUTION,
+            TYPE_TCL, TYPE_VISUAL_STUDIO_SOLUTION, TYPE_PM,
     };
     private static final int[] FAMILY_BAT = new int[]{
             TYPE_BAT,
@@ -95,13 +97,13 @@ public abstract class AbstractLicenseApp
             TYPE_VM,
     };
     private static final int[] EXPECTS_HASH_PLING = new int[]{
-            TYPE_PYTHON, TYPE_SH, TYPE_RUBY, TYPE_PERL, TYPE_TCL
+            TYPE_PYTHON, TYPE_SH, TYPE_RUBY, TYPE_PERL, TYPE_TCL,
     };
     private static final int[] EXPECTS_AT_ECHO = new int[]{
             TYPE_BAT,
     };
     private static final int[] EXPECTS_PACKAGE = new int[]{
-            TYPE_JAVA,
+            TYPE_JAVA, TYPE_GO, TYPE_PM,
     };
     private static final int[] EXPECTS_XML_DECL = new int[]{
             TYPE_XML,
@@ -149,6 +151,7 @@ public abstract class AbstractLicenseApp
         EXT2TYPE.put("fxcop", Integer.valueOf(TYPE_XML));
         EXT2TYPE.put("fml", Integer.valueOf(TYPE_FML));
         EXT2TYPE.put("groovy", Integer.valueOf(TYPE_GROOVY));
+        EXT2TYPE.put("go", Integer.valueOf(TYPE_GO));
         EXT2TYPE.put("h", Integer.valueOf(TYPE_H));
         EXT2TYPE.put("hh", Integer.valueOf(TYPE_H));
         EXT2TYPE.put("hpp", Integer.valueOf(TYPE_H));
@@ -161,6 +164,7 @@ public abstract class AbstractLicenseApp
         EXT2TYPE.put("nunit", Integer.valueOf(TYPE_XML));
         EXT2TYPE.put("php", Integer.valueOf(TYPE_PHP));
         EXT2TYPE.put("pl", Integer.valueOf(TYPE_PERL));
+        EXT2TYPE.put("pm", Integer.valueOf(TYPE_PM));
         EXT2TYPE.put("properties", Integer.valueOf(TYPE_PROPERTIES));
         EXT2TYPE.put("py", Integer.valueOf(TYPE_PYTHON));
         EXT2TYPE.put("rb", Integer.valueOf(TYPE_RUBY));
@@ -617,4 +621,4 @@ class BOMInputStream extends FilterInput
         return true;
     }
 
-}
+}
\ No newline at end of file

Modified: creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java?rev=1768796&r1=1768795&r2=1768796&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/main/java/org/apache/rat/document/impl/guesser/BinaryGuesser.java Tue Nov  8 22:24:21 2016
@@ -282,6 +282,7 @@ public class BinaryGuesser {
             "FV",
             "GRM",
             "G",
+            "GO",
             "H",
             "HTACCESS",
             "HTML",
@@ -291,11 +292,12 @@ public class BinaryGuesser {
             "JMX",
             "JSP",
             "JS",
+            "JSON",
             "JUNIT",
             "JX",
+            "M4",            
             "MANIFEST",
-            "M4",
-            "MF",
+            "MD",
             "MF",
             "META",
             "MOD",
@@ -361,5 +363,4 @@ public class BinaryGuesser {
                 isBinaryDocument(document);
     }
 
-
 }

Modified: creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenseAppender.java
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenseAppender.java?rev=1768796&r1=1768795&r2=1768796&view=diff
==============================================================================
--- creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenseAppender.java (original)
+++ creadur/rat/trunk/apache-rat-core/src/test/java/org/apache/rat/annotation/TestLicenseAppender.java Tue Nov  8 22:24:21 2016
@@ -403,6 +403,23 @@ public class TestLicenseAppender {
     }
 
     @Test
+    public void addLicenseToPerlModule() throws IOException {
+        String filename = "tmp.pm";
+        final String firstLine = "package API::TestAPI;";
+        final String secondLine = ""; 
+        final String thirdLine = "#" + FIRST_LICENSE_LINE;
+
+        commonTestTemplate(filename, new FileCreator() {
+                    public void createFile(Writer writer)
+                            throws IOException {
+                        writer.write(firstLine + "\n");
+                        writer.write("print \"Hello world\"\n");
+                    }
+                },
+                checkLines(firstLine, secondLine, thirdLine));
+    }    
+
+    @Test
     public void addLicenseToTclWithoutHashBang()
             throws IOException {
         String filename = "tmp.tcl";
@@ -502,6 +519,27 @@ public class TestLicenseAppender {
     }
 
     @Test
+    public void addLicenseToGo() throws IOException {
+        String filename = "tmp.go";
+        final String firstLine = "package main";
+        String secondLine = "";
+        String thirdLine = "/*";
+        
+        		
+
+        commonTestTemplate(filename, new FileCreator() {
+                    public void createFile(Writer writer)
+                            throws IOException {
+                        writer.write(firstLine + "\n");
+                        writer.write("import (\n");
+                        writer.write("    log\n");
+                        writer.write(")\n");
+                    }
+                },
+                checkLines(firstLine, secondLine, thirdLine));
+    }    
+
+    @Test
     public void fileWithBOM() throws IOException {
         File f = Resources.getResourceFile("violations/FilterTest.cs");
         try {

Modified: creadur/rat/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/creadur/rat/trunk/src/changes/changes.xml?rev=1768796&r1=1768795&r2=1768796&view=diff
==============================================================================
--- creadur/rat/trunk/src/changes/changes.xml (original)
+++ creadur/rat/trunk/src/changes/changes.xml Tue Nov  8 22:24:21 2016
@@ -20,7 +20,7 @@
 This file is also used by the maven-changes-plugin to generate the release notes.
 Useful ways of finding items to add to this file are:
 
-1.  Add items when you fix a bug or add a feature (this makes the 
+1.  Add items when you fix a bug or add a feature (this makes the
 release process easy :-).
 
 2.  Do a JIRA search for tickets closed since the previous release.
@@ -31,7 +31,7 @@ SVN commits. TBA how to use this with SV
 To generate the release notes from this file:
 
 mvn changes:announcement-generate -Prelease-notes [-Dchanges.version=nn]
-then tweak the formatting if necessary 
+then tweak the formatting if necessary
 and commit
 
 The <action> type attribute can be add,update,fix,remove.
@@ -40,7 +40,7 @@ The <action> type attribute can be add,u
     issue - required
     type - required
     the rest are optional; order not important
-    
+
     having the issue number first makes it easier to read the XML outline
 
 -->
@@ -54,11 +54,17 @@ The <action> type attribute can be add,u
   </properties>
 
   <body>
+    <release version="0.13" date="2016-xx-xx" description="Current SNAPSHOT - to be done">
+      <action issue="RAT-223" type="fix" due-to="Eric Friedrich" dev="pottlinger">
+        Add support for Golang and Perl module files.
+      </action>
+    </release>
+
     <release version="0.12" date="2015-09-30" description=
 " We now require Maven 3.0.5+ to build Rat, but as before we only require
  Maven 2.2.1+ if you want to use Rat in your own Maven projects.
 
-We've integrated Rat into the ASF Jenkins to ensure continuous builds with various JDK versions. 
+We've integrated Rat into the ASF Jenkins to ensure continuous builds with various JDK versions.
 ">
       <action issue="RAT-215" type="fix" dev="pottlinger">
         Add WOFF2, WOFF, TTF and EOT font file extensions to binary file collection to allow faster detection as binary without reading in the files.
@@ -102,7 +108,7 @@ We've integrated Rat into the ASF Jenkin
         Maven plugin and Ant task do not support adding extra approved licenses.
       </action>
       <action issue="RAT-180" type="fix" dev="pottlinger">
-        Generify and beautify texts in RAT report. 
+        Generify and beautify texts in RAT report.
       </action>
       <action issue="RAT-196" type="add" due-to="Karl Heinz Marbais" dev="pottlinger">
         Minor refactoring in pom.xml.
@@ -185,7 +191,7 @@ We've integrated Rat into the ASF Jenkin
     <action issue="RAT-165" type="add">Use a maven defaultGoal for RAT's base pom.xml</action>
     </release>
     <release version="0.10" date="2013-09-05" description=
-"The 0.10 version includes several bug fixes, 
+"The 0.10 version includes several bug fixes,
 most notably a fix for 0.9 performance issues.
  * Simpler binary archive
  * Updated dependencies and plugins