You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ne...@apache.org on 2019/07/03 11:17:52 UTC

[netbeans] branch master updated: [NETBEANS-2756] Added root project relative license file search.

This is an automated email from the ASF dual-hosted git repository.

neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new fa9482e  [NETBEANS-2756] Added root project relative license file search.
     new 481a6ad  Merge pull request #1336 from lkishalmi/NETBEANS-2756
fa9482e is described below

commit fa9482e04b8a74b9bdaf10224892579ad7629093
Author: Laszlo Kishalmi <la...@gmail.com>
AuthorDate: Thu Jun 27 09:49:18 2019 -0700

    [NETBEANS-2756] Added root project relative license file search.
---
 .../modules/gradle/TemplateAttrProvider.java        | 21 +++++++++++----------
 .../modules/gradle/customizer/Bundle.properties     |  2 +-
 .../gradle/customizer/LicenseHeadersPanel.form      |  2 +-
 .../gradle/customizer/LicenseHeadersPanel.java      |  2 +-
 4 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/groovy/gradle/src/org/netbeans/modules/gradle/TemplateAttrProvider.java b/groovy/gradle/src/org/netbeans/modules/gradle/TemplateAttrProvider.java
index 94148dc..b83bca4 100644
--- a/groovy/gradle/src/org/netbeans/modules/gradle/TemplateAttrProvider.java
+++ b/groovy/gradle/src/org/netbeans/modules/gradle/TemplateAttrProvider.java
@@ -69,14 +69,15 @@ public class TemplateAttrProvider implements  CreateFromTemplateAttributes {
             String license = prj.getLicense();
             String licensePath = findLicensePathInTemplates(license);
 
-            //Test it against local filesystem
-            if (licensePath == null) {
-                File local = new File(prj.getProjectDir(), license);
-                if (!local.isFile()) {
-                    local = new File(license);
-                }
-                if (local.isFile()) {
-                    licensePath = FileUtil.normalizeFile(local).toURI().toString();
+            File[] licenseFiles = new File[] {
+                new File(prj.getProjectDir(), license),
+                new File(prj.getRootDir(), license),
+                new File(license)
+            };
+            for (File licenseFile : licenseFiles) {
+                if (licenseFile.isFile()) {
+                    licensePath = FileUtil.normalizeFile(licenseFile).toURI().toString();
+                    break;
                 }
             }
             //Test it as if that were an URL
@@ -95,8 +96,8 @@ public class TemplateAttrProvider implements  CreateFromTemplateAttributes {
     }
 
     public static String findLicensePathInTemplates(String lic) {
-        FileObject fo = FileUtil.getConfigFile("Templates/Licenses/license-" + lic + ".txt");
-        return fo != null ? DEFAULT_LICENSE_PREFIX + lic + ".txt" : null;
+        FileObject fo = FileUtil.getConfigFile("Templates/Licenses/license-" + lic + ".txt"); //NOI18N
+        return fo != null ? DEFAULT_LICENSE_PREFIX + lic + ".txt" : null; //NOI18N
     }
 
     public static String findLicenseByMavenProjectContent(String url) {
diff --git a/groovy/gradle/src/org/netbeans/modules/gradle/customizer/Bundle.properties b/groovy/gradle/src/org/netbeans/modules/gradle/customizer/Bundle.properties
index a7c34a8..eab5097 100644
--- a/groovy/gradle/src/org/netbeans/modules/gradle/customizer/Bundle.properties
+++ b/groovy/gradle/src/org/netbeans/modules/gradle/customizer/Bundle.properties
@@ -39,7 +39,7 @@ BuildActionsCustomizer.lbTitle.text=Override IDE Default Action Binding and Cust
 LicenseHeadersPanel.jLabel1.text=License Header
 LicenseHeadersPanel.rbGlobalLicense.text=Use Global License:
 LicenseHeadersPanel.rbCustomFile.text=Use Gradle Defined License:
-LicenseHeadersPanel.jLabel2.text=<html>Use the value of <b>netbeans.license</b> or in its absence <b>license</b>\nproperty of the project (or it's parent). It is recommended to set this property on the\nroot project only. The value of the license property can be:\n<ul>\n  <li>Short name of a NetBeans Global license<br/>(e.g.: apache20)</li>\n  <li>Project directory relative path to a file.</li>\n  <li>Absolute path to a file.</li>\n  <li>URI to a registered global license<br/>(e.g.: http [...]
+LicenseHeadersPanel.jLabel2.text=<html>Use the value of <b>netbeans.license</b> or in its absence <b>license</b>\nproperty of the project (or it's parent). It is recommended to set this property on the\nroot project only. The value of the license property can be:\n<ul>\n  <li>Short name of a NetBeans Global license<br/>(e.g.: apache20)</li>\n  <li>Project directory relative path to a file.</li>\n  <li>Root project directory relative path to a file.</li>\n  <li>Absolute path to a file.</l [...]
 BuildActionsCustomizer.jLabel1.text=Configure Action:
 ProjectInfoPanel.jLabel6.text=Included Builds:
 BuildActionsCustomizer.cbRepeatable.toolTipText=Is this action allowed to be rerun from the output tab?
diff --git a/groovy/gradle/src/org/netbeans/modules/gradle/customizer/LicenseHeadersPanel.form b/groovy/gradle/src/org/netbeans/modules/gradle/customizer/LicenseHeadersPanel.form
index fa1453a..10dd59f 100644
--- a/groovy/gradle/src/org/netbeans/modules/gradle/customizer/LicenseHeadersPanel.form
+++ b/groovy/gradle/src/org/netbeans/modules/gradle/customizer/LicenseHeadersPanel.form
@@ -89,7 +89,7 @@
               <EmptySpace min="-2" max="-2" attributes="0"/>
               <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
               <EmptySpace min="-2" max="-2" attributes="0"/>
-              <Component id="jScrollPane1" pref="228" max="32767" attributes="0"/>
+              <Component id="jScrollPane1" pref="243" max="32767" attributes="0"/>
           </Group>
       </Group>
     </DimensionLayout>
diff --git a/groovy/gradle/src/org/netbeans/modules/gradle/customizer/LicenseHeadersPanel.java b/groovy/gradle/src/org/netbeans/modules/gradle/customizer/LicenseHeadersPanel.java
index 82281f3..d818c11 100644
--- a/groovy/gradle/src/org/netbeans/modules/gradle/customizer/LicenseHeadersPanel.java
+++ b/groovy/gradle/src/org/netbeans/modules/gradle/customizer/LicenseHeadersPanel.java
@@ -176,7 +176,7 @@ public class LicenseHeadersPanel extends javax.swing.JPanel {
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(jLabel1)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE))
+                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE))
         );
     }// </editor-fold>//GEN-END:initComponents
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

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