You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "lkishalmi (via GitHub)" <gi...@apache.org> on 2024/02/04 15:29:51 UTC
[PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
lkishalmi opened a new pull request, #7024:
URL: https://github.com/apache/netbeans/pull/7024
Gradle Java tooling is the recommended way to set the Java version for source sets since provably version 7.x. Java Tooling has been introduced in Gradle 6.7. In order to be able to split the Java compilation form the java runtime.
NetBeans haven't respected the tooling version from Gradle so far, rlied on that people would use the same tooling as runtime. This really needed to be fixed.
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1926430692
Did some limited testing on Java 20, and Java 21 as toolchains with Gradle 8.3 and Gradle 8.4 running NetBeans with Java 21
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1952199760
Would it be possible to *retain* the java platform node, provided that all source groups share the same JDK setting ? Removal would make the project view inconsistent compared to Maven project view -- there is also "Java Depenendencies" node that shows the JDK.
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1931207330
> please make sure that tests don't start to install JDKs
>
> edit: what i mean by that is that existing tests should not suddenly start setting up their own env
This PR has no effect on the existing tests.
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1927803046
please make sure that tests don't start to install JDKs
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1967573447
It seems the paperwork check needs #7117
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#discussion_r1477789717
##########
java/gradle.java/src/org/netbeans/modules/gradle/java/classpath/BootClassPathImpl.java:
##########
@@ -19,57 +19,44 @@
package org.netbeans.modules.gradle.java.classpath;
-import org.netbeans.modules.gradle.api.NbGradleProject;
-import org.netbeans.modules.gradle.api.execute.RunUtils;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
+import org.netbeans.modules.gradle.java.spi.support.JavaToolchainSupport;
+import java.io.File;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
-import java.util.prefs.PreferenceChangeEvent;
-import java.util.prefs.PreferenceChangeListener;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.api.java.platform.JavaPlatform;
-import org.netbeans.api.java.platform.JavaPlatformManager;
import org.netbeans.api.project.Project;
+import org.netbeans.modules.gradle.java.api.GradleJavaSourceSet;
+import static org.netbeans.modules.gradle.java.api.GradleJavaSourceSet.SourceType.JAVA;
import org.netbeans.modules.gradle.java.execute.JavaRunUtils;
-import org.openide.util.WeakListeners;
/**
*
* @author Laszlo Kishalmi
*/
-public final class BootClassPathImpl extends AbstractGradleClassPathImpl implements PropertyChangeListener {
+public final class BootClassPathImpl extends AbstractSourceSetClassPathImpl {
private static final String PROTOCOL_NBJRT = "nbjrt"; //NOI18N
- JavaPlatformManager platformManager;
final boolean modulesOnly;
- public BootClassPathImpl(Project proj) {
- this(proj, false);
+ public BootClassPathImpl(Project proj, String group) {
+ this(proj, group, false);
}
@SuppressWarnings("LeakingThisInConstructor")
- public BootClassPathImpl(Project proj, boolean modulesOnly) {
- super(proj);
+ public BootClassPathImpl(Project proj, String group, boolean modulesOnly) {
+ super(proj, group);
this.modulesOnly = modulesOnly;
- platformManager = JavaPlatformManager.getDefault();
- platformManager.addPropertyChangeListener(WeakListeners.propertyChange(this, platformManager));
- NbGradleProject.getPreferences(project, false).addPreferenceChangeListener((PreferenceChangeEvent evt) -> {
- if (RunUtils.PROP_JDK_PLATFORM.equals(evt.getKey())) {
- clearResourceCache();
- }
- });
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- clearResourceCache();
}
@Override
protected List<URL> createPath() {
- JavaPlatform platform = JavaRunUtils.getActivePlatform(project).second();
+ JavaToolchainSupport toolchain = JavaToolchainSupport.getDefault();
+ GradleJavaSourceSet ss = getSourceSet();
+ File jh = ss != null ? ss.getCompilerJavaHome(JAVA) : null;
Review Comment:
Question: group is not used here, but NbProjectInfoBuilder reports java home for language + group. Not sure if the added complexity in GradleJavaSourceSet is worth that - whether different source sets can and are configured for different Java levels.
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi merged PR #7024:
URL: https://github.com/apache/netbeans/pull/7024
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1926434360
I wonder if some more integration with NB IDE would be useful: suggest to install gradle-detected JVMs as java platforms into the IDE, or pass Java platforms configured in the IDE to the gradle build to choose from.
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#discussion_r1477789717
##########
java/gradle.java/src/org/netbeans/modules/gradle/java/classpath/BootClassPathImpl.java:
##########
@@ -19,57 +19,44 @@
package org.netbeans.modules.gradle.java.classpath;
-import org.netbeans.modules.gradle.api.NbGradleProject;
-import org.netbeans.modules.gradle.api.execute.RunUtils;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
+import org.netbeans.modules.gradle.java.spi.support.JavaToolchainSupport;
+import java.io.File;
import java.net.URL;
import java.util.LinkedList;
import java.util.List;
-import java.util.prefs.PreferenceChangeEvent;
-import java.util.prefs.PreferenceChangeListener;
import org.netbeans.api.java.classpath.ClassPath;
import org.netbeans.api.java.platform.JavaPlatform;
-import org.netbeans.api.java.platform.JavaPlatformManager;
import org.netbeans.api.project.Project;
+import org.netbeans.modules.gradle.java.api.GradleJavaSourceSet;
+import static org.netbeans.modules.gradle.java.api.GradleJavaSourceSet.SourceType.JAVA;
import org.netbeans.modules.gradle.java.execute.JavaRunUtils;
-import org.openide.util.WeakListeners;
/**
*
* @author Laszlo Kishalmi
*/
-public final class BootClassPathImpl extends AbstractGradleClassPathImpl implements PropertyChangeListener {
+public final class BootClassPathImpl extends AbstractSourceSetClassPathImpl {
private static final String PROTOCOL_NBJRT = "nbjrt"; //NOI18N
- JavaPlatformManager platformManager;
final boolean modulesOnly;
- public BootClassPathImpl(Project proj) {
- this(proj, false);
+ public BootClassPathImpl(Project proj, String group) {
+ this(proj, group, false);
}
@SuppressWarnings("LeakingThisInConstructor")
- public BootClassPathImpl(Project proj, boolean modulesOnly) {
- super(proj);
+ public BootClassPathImpl(Project proj, String group, boolean modulesOnly) {
+ super(proj, group);
this.modulesOnly = modulesOnly;
- platformManager = JavaPlatformManager.getDefault();
- platformManager.addPropertyChangeListener(WeakListeners.propertyChange(this, platformManager));
- NbGradleProject.getPreferences(project, false).addPreferenceChangeListener((PreferenceChangeEvent evt) -> {
- if (RunUtils.PROP_JDK_PLATFORM.equals(evt.getKey())) {
- clearResourceCache();
- }
- });
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- clearResourceCache();
}
@Override
protected List<URL> createPath() {
- JavaPlatform platform = JavaRunUtils.getActivePlatform(project).second();
+ JavaToolchainSupport toolchain = JavaToolchainSupport.getDefault();
+ GradleJavaSourceSet ss = getSourceSet();
+ File jh = ss != null ? ss.getCompilerJavaHome(JAVA) : null;
Review Comment:
Question: group is not used here, but NbProjectInfoBuilder reports java home for language + group. Not sure if the added complexity in GradleJavaSourceSet is worth that - whether different source sets can and are configured for different Java levels.
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1965372382
Thanks !
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#discussion_r1536767236
##########
java/gradle.java/src/org/netbeans/modules/gradle/java/classpath/AbstractGradleClassPathImpl.java:
##########
@@ -105,10 +105,7 @@ private boolean hasChanged(List<URL> oldValue, List<URL> newValue) {
@Override
public final synchronized List<? extends PathResourceImplementation> getResources() {
if (resources == null) {
- resources = new ArrayList<>();
- for (URL url : createPath()) {
- resources.add(ClassPathSupport.createResource(url));
- }
+ resources = createPath().stream().map(ClassPathSupport::createResource).collect(Collectors.toList());
Review Comment:
since this module uses JDK 17 now, you could call `toList()` directly on the stream.
##########
extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java:
##########
@@ -1274,7 +1285,7 @@ private void detectSources(NbProjectInfoModel model) {
model.getInfo().put(propBase + "output_resources", sourceSet.getOutput().getResourcesDir());
sinceGradle("5.2", () -> {
model.getInfo().put(propBase + "GENERATED", storeSet(getProperty(sourceSet, "output", "generatedSourcesDirs", "files")));
- });
+ });
Review Comment:
nitpick: whitespace anomaly :)
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-2016679175
The build is finally green now. If no one objects, I'm going to merge this tomorrow!
--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1965355844
Well, @sdedic I've put that node back.

--
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
Re: [PR] Gradle Project shall use the Java from the tooling not runtime. [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on PR #7024:
URL: https://github.com/apache/netbeans/pull/7024#issuecomment-1926404401
The `Java Dependencies` node in Java projects was removed.

The Java Platform is displayed per source group in the project Properties Sources:

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