junichi11 commented on a change in pull request #1425: [NETBEANS-3041] Add 
gradle support org.gradle.jvmargs 
URL: https://github.com/apache/netbeans/pull/1425#discussion_r324379456
 
 

 ##########
 File path: 
groovy/gradle/src/org/netbeans/modules/gradle/api/execute/GradleCommandLine.java
 ##########
 @@ -802,13 +810,57 @@ public void setStackTrace(StackTrace st) {
         }
     }
 
-    public void configure(ConfigurableLauncher launcher) {
-        launcher.setJvmArguments(getArgs(EnumSet.of(SYSTEM)));
+    private void addGradleSettingJvmargs(File projectDir, List<String> 
jvmargs) {
+        List<File> gpfs = null; 
+
+        if (projectDir == null){ 
+            File guh = GradleSettings.getDefault().getGradleUserHome();
+            File f = new File(guh, GradleFiles.GRADLE_PROPERTIES_NAME);
+            if (f.exists()){
+                gpfs = new ArrayList<File>();
+                gpfs.add(f);
+            }
+        } else {
+            GradleFiles gf = new GradleFiles(projectDir);
+            gpfs = gf.getPropertyFiles();
+        }
+        
+        if (gpfs == null || gpfs.isEmpty()){
+            return;
+        }
+
+        for (File gpf : gpfs){
+            try (BufferedInputStream in = new BufferedInputStream(new 
FileInputStream(gpf))){
+                Properties pps = new Properties();
+                pps.load(in);
+                final String jvmargsKey = "org.gradle.jvmargs"; // NOI18N
+                if (pps.containsKey(jvmargsKey)){
+                    String jvmargsProperty = pps.getProperty(jvmargsKey); 
+                    String [] jvmargsValues = jvmargsProperty.split(" "); 
//NOI18N
+                    for (String value : jvmargsValues){
+                        jvmargs.add(value);
+                    }
+                    return;
+                }
+            }
+            catch(FileNotFoundException ex){}
+            catch(IOException ex){}
 
 Review comment:
   Should add a logger?

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

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

Reply via email to