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 2022/11/18 18:30:51 UTC

[GitHub] [netbeans] lkishalmi opened a new pull request, #4985: Minimal support to use project JVM for Gradle Discovery

lkishalmi opened a new pull request, #4985:
URL: https://github.com/apache/netbeans/pull/4985

   There would be more commits after this one. Need to iron out the following things:
   
   * Use the Project dictated Gradle Version in most cases. Revert back to the supplied one only if the project JVM is misaligned.
   * Project problem provider should only report misaligned project JVM and Gradle version, also offer a fix to select project JVM
   * Move Gradle Compile customizer options to Gradle Execution
   * Offer better Gradle JVM Selection made it available on Root project only.
   


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] matthiasblaesing commented on pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#issuecomment-1322519840

   My personal worst-case is developing for liferay-portal. It uses a custom patched gradle version and requires JDK 8 to build. This seems to improve the situation a lot! This is not yet a comprehensive test, but this is what I did:
   
   I build NetBeans from this branch. Additionally I had to adjust the gradle deamon settings like this (`~/.gradle/gradle.properties`):
   
   ```properties
   org.gradle.jvmargs=-Xms512m -Xmx4g
   liferay.home=/home/matthias/src/liferay-portal/bundles/
   ```
   
   The first option give the gradle daemon enough space to handle the projects and the second is needed as the liferay build system sets this property from the ant invocation that starts the build. I have to restructure the build minimally, so that the grade wrapper is found. I build liferay once using `ant all`, then I copy the `gradle` directory from the main directory to `modules`. In the ` modules/gradle/wrapper/gradle-wrapper.properties`  I change the `distributionUrl` to `distributionUrl=../../../tools/gradle-6.9.2-LIFERAY-PATCHED1-bin.zip`. Finally the patched gradle needs to be renamed to fit the gradle versioning scheme from ` gradle-6.9.2.LIFERAY-PATCHED-1-bin.zip` to `gradle-6.9.2-LIFERAY-PATCHED1-bin.zip` .
   
   Project loading takes time, but it feels nice to be able to open the projects in a sane manner. Thank you!


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] lkishalmi commented on pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#issuecomment-1324286320

   Yes, that's a trivial patch for the first bulletpoint. It's on my radar, just got slammed with work in the last few weeks.
   
   


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] lbownik commented on a diff in pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
lbownik commented on code in PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#discussion_r1027795678


##########
extide/gradle/src/org/netbeans/modules/gradle/loaders/LegacyProjectLoader.java:
##########
@@ -472,8 +474,20 @@ private static NbProjectInfo retrieveProjectInfo(NbGradleProjectImpl projectImpl
             offline.addFlag(GradleCommandLine.Flag.OFFLINE);
         }
 
+        File javaHome = null;
+        GradleJavaPlatformProvider jvmProvider = projectImpl.getLookup().lookup(GradleJavaPlatformProvider.class);
+        try {
+            if (jvmProvider != null) {
+                javaHome = jvmProvider.getJavaHome();
+                LOG.log(Level.FINE, "Using JAVA_HOME=''{0}'' for project info load for: {1}", new Object[]{javaHome, projectImpl});
+            }
+        } catch (FileNotFoundException ex) {
+            LOG.log(Level.WARNING, "JAVA_HOME for project " + projectImpl + " not found.", ex);
+        }
+
         if (goOnline == GoOnline.NEVER || goOnline == GoOnline.ON_DEMAND) {
             BuildActionExecuter<NbProjectInfo> action = createInfoAction(pconn, offline, token, pl);
+            action.setJavaHome(javaHome);

Review Comment:
   what if javaHome variable is null here?



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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] matthiasblaesing commented on pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#issuecomment-1324234090

   As an update: I noticed, that I tested running on OpenJDK 11, but it also works on JDK 17 if I patch the `GradleDistributionManager`
   
   ```diff
   diff --git a/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java b/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
   index c468f0737a1e..366b0574a8b1 100644
   --- a/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
   +++ b/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
   @@ -532,7 +532,8 @@ public final class GradleDistributionManager {
             * @return <code>true</code> if this version is supported with the runtime JDK.
             */
            public boolean isCompatibleWithSystemJava() {
   -            return isCompatibleWithJava(JAVA_VERSION);
   +            return true;
   +//            return isCompatibleWithJava(JAVA_VERSION);
            }
    
            /**
   ```


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] lkishalmi commented on pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#issuecomment-1338717503

   > Question: should be https://github.com/lkishalmi/netbeans/blob/gradle-use-project-java-for-discovery/extide/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java#L312 still a warning message ?
   > 
   > (link corrected)
   
   I think yes, it should be a Warning message. Though it is now displayed if the JVM set on project is not compatible with the Gradle in use. In that case the IDE would still try to use the "built-in" Gradle. It would be elegant to have a resolver for this problem. That's for a later time though...


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] lkishalmi merged pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
lkishalmi merged PR #4985:
URL: https://github.com/apache/netbeans/pull/4985


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] lkishalmi commented on a diff in pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on code in PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#discussion_r1028225285


##########
extide/gradle/src/org/netbeans/modules/gradle/loaders/LegacyProjectLoader.java:
##########
@@ -472,8 +474,20 @@ private static NbProjectInfo retrieveProjectInfo(NbGradleProjectImpl projectImpl
             offline.addFlag(GradleCommandLine.Flag.OFFLINE);
         }
 
+        File javaHome = null;
+        GradleJavaPlatformProvider jvmProvider = projectImpl.getLookup().lookup(GradleJavaPlatformProvider.class);
+        try {
+            if (jvmProvider != null) {
+                javaHome = jvmProvider.getJavaHome();
+                LOG.log(Level.FINE, "Using JAVA_HOME=''{0}'' for project info load for: {1}", new Object[]{javaHome, projectImpl});
+            }
+        } catch (FileNotFoundException ex) {
+            LOG.log(Level.WARNING, "JAVA_HOME for project " + projectImpl + " not found.", ex);
+        }
+
         if (goOnline == GoOnline.NEVER || goOnline == GoOnline.ON_DEMAND) {
             BuildActionExecuter<NbProjectInfo> action = createInfoAction(pconn, offline, token, pl);
+            action.setJavaHome(javaHome);

Review Comment:
   From: https://docs.gradle.org/current/javadoc/org/gradle/tooling/ConfigurableLauncher.html#setJavaHome-java.io.File-
   
   > If not configured or null is passed, then the sensible default will be used.



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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] matthiasblaesing commented on pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
matthiasblaesing commented on PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#issuecomment-1328217773

   Works for me. Build from this branch, ensured JDK 17 is active and was able to load liferay project after setting its JDK to 8. Thank you!


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] errael commented on pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
errael commented on PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#issuecomment-1331231751

   @sdedic 
   > Question: should <some_link> still a warning message ?
   
   I think the link is messed up.


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] lkishalmi commented on pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
lkishalmi commented on PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#issuecomment-1328150120

   Well, this form is a good enough implementation, without major changes.
   
   The `GradleProjectConnection` got rid of the "compatible" connection thing, So NetBeans does not try override the Gradle distribution in any case. The `javaHome` is set there so other places where `ProjectConnection` is needed, has the Java home and the Gradle Distribution set.
   
   The Java vs Gradle version mismatch problem only triggered, if the Project Java setting is off.
   
   I'm going to create a new update branch for NB16, where this and a few other fixes would go, as I think the Gradle support in base NB16 is not that great.


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [netbeans] sdedic commented on pull request #4985: Use Project Dictated JVM for Gradle Discovery

Posted by GitBox <gi...@apache.org>.
sdedic commented on PR #4985:
URL: https://github.com/apache/netbeans/pull/4985#issuecomment-1331128138

   Question: should be https://github.com/apache/netbeans/pull/4985/files#diff-3c58a0a0828b9926f6fc248e3020e6552233d2abe62b93fc0481dae7701dd1feR312 this still a warning message ?


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

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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