You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2021/01/11 16:29:23 UTC

[netbeans] branch release120 updated: [NETBEANS-4722] Add JAVA_HOME to Gradle build environment variables

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

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


The following commit(s) were added to refs/heads/release120 by this push:
     new 63ca800  [NETBEANS-4722] Add JAVA_HOME to Gradle build environment variables
63ca800 is described below

commit 63ca8004dc498a4497516ead979dc137f7173e4b
Author: Laszlo Kishalmi <la...@gmail.com>
AuthorDate: Tue Aug 18 23:33:53 2020 -0700

    [NETBEANS-4722] Add JAVA_HOME to Gradle build environment variables
---
 groovy/gradle/manifest.mf                                     |  2 +-
 .../netbeans/modules/gradle/execute/GradleDaemonExecutor.java | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/groovy/gradle/manifest.mf b/groovy/gradle/manifest.mf
index b4ef608..9456627 100644
--- a/groovy/gradle/manifest.mf
+++ b/groovy/gradle/manifest.mf
@@ -3,5 +3,5 @@ AutoUpdate-Show-In-Client: false
 OpenIDE-Module: org.netbeans.modules.gradle/2
 OpenIDE-Module-Layer: org/netbeans/modules/gradle/layer.xml
 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/gradle/Bundle.properties
-OpenIDE-Module-Specification-Version: 2.0.1
+OpenIDE-Module-Specification-Version: 2.0.2
 OpenIDE-Module-Requires: cnb.org.netbeans.modules.groovy.kit
diff --git a/groovy/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java b/groovy/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java
index 029c0dd..e2f0596 100644
--- a/groovy/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java
+++ b/groovy/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java
@@ -34,6 +34,8 @@ import java.io.OutputStream;
 import java.io.StreamCorruptedException;
 import java.nio.file.Path;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.swing.AbstractAction;
@@ -155,7 +157,14 @@ public final class GradleDaemonExecutor extends AbstractGradleExecutor {
             }
             if (!activePlatform.second().getInstallFolders().isEmpty()) {
                 File javaHome = FileUtil.toFile(activePlatform.second().getInstallFolders().iterator().next());
-                buildLauncher.setJavaHome(javaHome);
+                try {
+                    buildLauncher.setJavaHome(javaHome);
+                    Map<String, String> envs = new HashMap<>(System.getenv());
+                    envs.put("JAVA_HOME", javaHome.getCanonicalPath());
+                    buildLauncher.setEnvironmentVariables(envs);
+                } catch (IOException ex) {
+                    LOGGER.log(Level.WARNING, "Could not set JAVA_HOME='" + javaHome + "' for Gradle Execution", ex);
+                }
             }
 
             outStream = new EscapeProcessingOutputStream(new GradlePlainEscapeProcessor(io, config, false));


---------------------------------------------------------------------
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