mcdonnell-john closed pull request #1054: [NETBEANS-1803] Don't list ALv2 
licensed files in LICENSE file
URL: https://github.com/apache/incubator-netbeans/pull/1054
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/CreateLicenseSummary.java 
b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/CreateLicenseSummary.java
index ad23612deb..806eb9067a 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/CreateLicenseSummary.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/CreateLicenseSummary.java
@@ -65,6 +65,19 @@
  * Creates a list of external binaries and their licenses.
  */
 public class CreateLicenseSummary extends Task {
+    /**
+     * License for which no explicit entry is generated in the license file.
+     * <p>
+     * The license file that is generated contains the ALv2 as the "primary"
+     * license. Files that are licensed as ALv2 don't need to be mentioned
+     * explicitly in the file.
+     * <p>
+     * Currently there are two variants that need to be considered:
+     * the Apache License version 2.0 and the Apache License version 2.0 with
+     * the "licensed to the ASF" preamble.
+     *
+     */
+    private static final Set<String> ALV2_LICENSES = new 
HashSet<>(Arrays.asList("Apache-2.0", "Apache-2.0-ASF"));
 
     private File nball;
 
@@ -229,48 +242,49 @@ private void evaluateLicenseInfo(final PrintWriter 
licenseWriter, final PrintWri
             Licenseinfo licenseInfo = Licenseinfo.parse(licenseInfoFile);
             
             for(Fileset fs: licenseInfo.getFilesets()) {
-                if("Apache-2.0-ASF".equals(fs.getLicenseRef())) {
-                    continue;
-                }
                 if(binary && fs.isSourceOnly()) {
                     continue;
                 }
 
-                if (!headerPrinted) {
-                    licenseWriter.println();
-                    
licenseWriter.println("******************************************************************************************************************************************************");
-                    licenseWriter.println("Apache NetBeans includes a number 
of source files that are not covered by the apache license. The following files 
are part of this distribution.");
-                    
licenseWriter.println("******************************************************************************************************************************************************");
-                    licenseWriter.println();
+                // Exclude ALv2 licensed files from listing here -- see 
definition
+                // of ALV2_LICENSES for more information
+                if (! ALV2_LICENSES.contains(fs.getLicenseRef())) {
+                    if (!headerPrinted) {
+                        licenseWriter.println();
+                        
licenseWriter.println("******************************************************************************************************************************************************");
+                        licenseWriter.println("Apache NetBeans includes a 
number of source files that are not covered by the apache license. The 
following files are part of this distribution.");
+                        
licenseWriter.println("******************************************************************************************************************************************************");
+                        licenseWriter.println();
+
+                        licenseWriter.printf("%-100s%40s%10s\n", "Sourcefile", 
"LICENSE", "NOTES");
+                        if (licenseTargetDir != null) {
+                            licenseWriter.printf("%-100s%40s\n", "(path in the 
source)", "(text is in file in licenses directory)");
+                        } else {
+                            licenseWriter.printf("%-100s%40s\n", "(path in the 
source)", "(see license text reproduced below)");
+                        }
+                        
licenseWriter.println("------------------------------------------------------------------------------------------------------------------------------------------------------");
+                        headerPrinted = true;
+                    }
 
-                    licenseWriter.printf("%-100s%40s%10s\n", "Sourcefile", 
"LICENSE", "NOTES");
-                    if(licenseTargetDir != null) {
-                        licenseWriter.printf("%-100s%40s\n", "(path in the 
source)", "(text is in file in licenses directory)");
-                    } else {
-                        licenseWriter.printf("%-100s%40s\n", "(path in the 
source)", "(see license text reproduced below)");
+                    String notes = "";
+                    if (fs.getLicenseInfo() != null) {
+                        int idx = footnotes.indexOf(fs.getLicenseInfo());
+                        if (idx < 0) {
+                            footnotes.add(fs.getLicenseInfo());
+                            idx = footnotes.size() - 1;
+                        }
+                        notes = Integer.toString(idx + 1);
+                    }
+                    for (File f : fs.getFiles()) {
+                        Path relativePath = 
nball.toPath().relativize(f.toPath());
+                        licenseWriter.printf("%-120s%20s%10s\n", relativePath, 
fs.getLicenseRef(), notes);
                     }
-                    
licenseWriter.println("------------------------------------------------------------------------------------------------------------------------------------------------------");
-                    headerPrinted = true;
-                }
 
-                String notes = "";
-                if(fs.getLicenseInfo() != null) {
-                    int idx = footnotes.indexOf(fs.getLicenseInfo());
-                    if(idx < 0) {
-                        footnotes.add(fs.getLicenseInfo());
-                        idx = footnotes.size() - 1;
+                    if (fs.getLicenseRef() != null) {
+                        licenseNames.add(fs.getLicenseRef());
                     }
-                    notes = Integer.toString(idx + 1);
                 }
-                for(File f: fs.getFiles()) {
-                    Path relativePath = nball.toPath().relativize(f.toPath());
-                    licenseWriter.printf("%-120s%20s%10s\n", relativePath, 
fs.getLicenseRef(), notes);
-                }
-                
-                if(fs.getLicenseRef() != null) {
-                    licenseNames.add(fs.getLicenseRef());
-                }
-                
+
                 addNotice(noticeWriter, fs.getNotice(), notices);
             }
         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to