You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2019/08/21 09:55:14 UTC

[GitHub] [netbeans] lkishalmi commented on a change in pull request #1425: add gradle support org.gradle.jvmargs

lkishalmi commented on a change in pull request #1425: add gradle support org.gradle.jvmargs 
URL: https://github.com/apache/netbeans/pull/1425#discussion_r316098292
 
 

 ##########
 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){}
+        } 
+    }
+
+    public void configure(ConfigurableLauncher launcher, File projectDir) {
 
 Review comment:
   This is API change, shall be documented with at least a ```@since``` 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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

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