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/12/29 08:12:58 UTC

[GitHub] [netbeans] lkishalmi opened a new pull request, #5158: Gradle Execution Customizer with Runtime

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

   This one is about evolving the Java Runtime selection further, beyond the recent patches, that made it possible in NB16u1. 
   
   The old implementation was mimicking what Maven/Ant does at the Build/Compile customizer. Those days the runtime platform pretty much determined the compile platform as well. The introduction of [JVM Toolchains](https://docs.gradle.org/current/userguide/toolchains.html) made that different. 
   
   Nowadays it is enough to have the JRE installed to start a Gradle build, Gradle can download and use different JVM-s if needed.
   
   I also made the Java Runtime selection available on root project only, sub-projects would take the root project setting.
   
   That's why the `GradleJavaRuntimeManager` and `JavaRuntime` got introduced as an API. Feedbacks on that are welcome, I think it's good enough, but could be improved to be more future proof.
   
   I've implemented this as a series of commits, so reviewing might be easier that way. JavaDoc and API doc would be provided later and in this PR.
   
   Eventually I would like to deprecate all the methods in JavaRunUtils, but they are used in the BootClasspath support at the moment. The bootclasspath support is not JVM Toolchain aware now, so that needs to be addressed, though I thought that would be a separate PR.
   
   ![image](https://user-images.githubusercontent.com/1381701/209917831-85bfe2a8-f027-4431-ba1e-8bd6669597b6.png)
   
    Changed to
   
   ![image](https://user-images.githubusercontent.com/1381701/209917955-42956db1-1974-40a1-acc5-b3d90c265786.png)
   
   While the `Build/Compile` customizer got removed.


-- 
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] mbien commented on pull request #5158: Gradle Execution Customizer with Runtime

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

   looks good to me. Layout is also working. The setting is also successfully changing the runtime JDK of the project.
   
   The "release" version (javac --release) can't be changed via the gradle UI?
   
   I don't see "Compile" options in the UI btw which is on the last screenshot you posted.
   
   The options window likely needs a scrollpane for the sub options since some don't fit the window (e.g Formatting options) - but this is also the case for maven project and out of the scope of this PR.


-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/GradleBrokenRuntimeProblemProvider.java:
##########
@@ -54,10 +56,10 @@ public GradleJavaProjectProblemProvider(Project project) {
     @NbBundle.Messages({
         "LBL_BrokenPlatform=Broken Platform.",
     })
-    public Collection<? extends ProjectProblem> getProblems() {
-        List<ProjectProblem> ret = new ArrayList<>();
-        if (JavaRunUtils.getActivePlatform(project) == null) {
-            ret.add(ProjectProblem.createWarning(Bundle.LBL_BrokenPlatform(), Bundle.LBL_BrokenPlatform()));
+    public Collection<? extends ProjectProblemsProvider.ProjectProblem> getProblems() {
+        List<ProjectProblemsProvider.ProjectProblem> ret = new ArrayList<>();

Review Comment:
   True. Code changed.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/GradleBrokenRuntimeProblemProvider.java:
##########
@@ -54,10 +56,10 @@ public GradleJavaProjectProblemProvider(Project project) {
     @NbBundle.Messages({
         "LBL_BrokenPlatform=Broken Platform.",
     })
-    public Collection<? extends ProjectProblem> getProblems() {
-        List<ProjectProblem> ret = new ArrayList<>();
-        if (JavaRunUtils.getActivePlatform(project) == null) {
-            ret.add(ProjectProblem.createWarning(Bundle.LBL_BrokenPlatform(), Bundle.LBL_BrokenPlatform()));
+    public Collection<? extends ProjectProblemsProvider.ProjectProblem> getProblems() {
+        List<ProjectProblemsProvider.ProjectProblem> ret = new ArrayList<>();

Review Comment:
   if this line is moved into if block, Collections.emptyList() could be returned in else block to avoid unnecessary allocation in case the default runtime is not broken 



-- 
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 a diff in pull request #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N

Review Comment:
   Question: how to handle if this ID clashes with some real JavaPlatform's ID ?



-- 
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 #5158: Gradle Execution Customizer with Runtime

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

   I've posted the screenshot with only the Gradle Project recompiled, so the Gradle Java Projects were on master, so that provided the Compile Customizer.
   
   The Gradle UI is kind of read-only. Yes, the runtime setting can affect the java release/platform used in projects. Though that is a bad practice. That means that the Gradle build files does not set that by any other means. It's possible to set the Java release version per source set. Since the introduction of Java Toolchains, the actual platform in use can be specified even on task level.
   
   
   It's getting close to the freeze. Any approver?


-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;
+            this.displayName = displayName;
+            this.javaHome = javaHome;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getDisplayName() {
+            return displayName != null ? displayName : id;

Review Comment:
   True. Code changed.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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

   ![image](https://user-images.githubusercontent.com/1381701/212496502-a94ec878-cbaa-4a61-9a1a-992ec343267a.png)
   


-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;
+            this.displayName = displayName;
+            this.javaHome = javaHome;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getDisplayName() {
+            return displayName != null ? displayName : id;
+        }
+
+        public File getJavaHome() {
+            return javaHome;
+        }
+
+        public boolean isBroken() {
+            return javaHome == null || !javaHome.isDirectory();

Review Comment:
   since this is an immutable class - this can be calculated in constructor



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;
+            this.displayName = displayName;
+            this.javaHome = javaHome;

Review Comment:
   can it be null?



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;

Review Comment:
   can it be null?



-- 
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] mbien commented on a diff in pull request #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ * JavaRuntimeManager is to provide Java Runtime for Gradle execution. Gradle
+ * is not just a build system for JVM based languages, but can build C, C++,
+ * NodeJS projects as well.
+ * <p>
+ * Gradle just requires a suitable JRE to run on.
+ * </p>
+ * <p>Most cases though Gradle build Java libraries/applications, and by default
+ * Gradle uses the JVM, that it is running on.</p>
+ *
+ * <p>This manager separates the JavaRuntime on which Gradle can run from
+ * the JavaPlatform on which Gradle Java project can be built. Every JavaPlatform
+ * is a JavaRuntime, but not every JavaRuntime is a JavaPlatform way.
+ * </p>
+ *
+ * @author Laszlo Kishalmi
+ * @since 2.32
+ */
+public interface JavaRuntimeManager {
+
+    /**
+     * The ID that the Runtime shall use for the Java Runtime the IDE is runnoing on.
+     */
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+
+    /**
+     * Return the available runtimes stored in the IDE with their respective Id-s.
+     *
+     * @return the available runtimes stored in the IDE.
+     */
+    Map<String, JavaRuntime> getAvailableRuntimes();
+
+    /**
+     * This method is called from the Gradle Execution Customizer when
+     * the "Manage Runtimes..." button is called.
+     *
+     * @return can provide a runnable to configure the available runtimes.
+     */
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    /**
+     * Register a change listener to this manager.
+     * Implementations shall fire a change event when the available runtimes
+     * changed.
+     * <p>
+     * The default implementation does nothing.
+     * </p>
+     *
+     * @param l the listener to be registered.
+     */
+    default void addChangeListener(ChangeListener l) {}
+
+    /**
+     * Removes a change listener from this manager.
+     * <p>
+     * The default implementation does nothing.
+     * </p>
+     * @param l the listener to be removed.
+     */
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    /**
+     * This class represents a java home directory with and id,
+     * and an optional display name.
+     *
+     * @since 2.32
+     */
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(@NonNull String id, String displayName, File javaHome) {

Review Comment:
   this looks like it could use Path?



-- 
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] neilcsmith-net commented on a diff in pull request #5158: Gradle Execution Customizer with Runtime

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on code in PR #5158:
URL: https://github.com/apache/netbeans/pull/5158#discussion_r1063435593


##########
extide/gradle/src/org/netbeans/modules/gradle/customizer/Bundle.properties:
##########
@@ -54,3 +54,27 @@ BuildActionsCustomizer.btnDisableAction.text=&Disable
 BuildActionsCustomizer.jLabel2.text=The action is disabled in this configuration.
 BuildActionsCustomizer.btnRestore.text=&Restore
 BuildActionsCustomizer.btnRemove2.text=Re&set
+GradleExecutionPanel.cbAugmentedBuild.text=&Augmented Build Execution
+GradleExecutionPanel.lbIncludeOpenProjects.text=<html>Create a composite project from this project and the other open Gradle projects by generating '--include-build' parameters.
+GradleExecutionPanel.cbIncludeOpenProjects.text=Include Open Projects
+GradleExecutionPanel.lbTrustTerms.text=<html><p>Executing Gradle can be potentially un-safe as it allows arbitrary code execution.</p>\n<p/>\n<p>By trusting this project, and with that all its subprojects, you entitle NetBeans to invoke Gradle to load project details without further confirmation.</p><p></p><p>Invoking any build related actions, would mark this project automatically trusted.</p>
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.

Review Comment:
   Something weird going on with license 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] lkishalmi commented on a diff in pull request #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/GradleBrokenRuntimeProblemProvider.java:
##########
@@ -54,10 +56,10 @@ public GradleJavaProjectProblemProvider(Project project) {
     @NbBundle.Messages({
         "LBL_BrokenPlatform=Broken Platform.",
     })
-    public Collection<? extends ProjectProblem> getProblems() {
-        List<ProjectProblem> ret = new ArrayList<>();
-        if (JavaRunUtils.getActivePlatform(project) == null) {
-            ret.add(ProjectProblem.createWarning(Bundle.LBL_BrokenPlatform(), Bundle.LBL_BrokenPlatform()));
+    public Collection<? extends ProjectProblemsProvider.ProjectProblem> getProblems() {
+        List<ProjectProblemsProvider.ProjectProblem> ret = new ArrayList<>();

Review Comment:
   There is no `JavaRuntimeManagerImpl` in the final PR. That was just good enough to get the things goin. Later on it was replaced by `JavaRuntimePlatformBridge`



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N

Review Comment:
   this variable seems unused both here and in JavaRuntimeManagerImpl



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;
+            this.displayName = displayName;
+            this.javaHome = javaHome;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getDisplayName() {
+            return displayName != null ? displayName : id;
+        }
+
+        public File getJavaHome() {
+            return javaHome;
+        }
+
+        public boolean isBroken() {
+            return javaHome == null || !javaHome.isDirectory();
+        }
+
+        @Override
+        public int compareTo(JavaRuntime o) {
+            return getDisplayName().compareToIgnoreCase(o.getDisplayName());
+        }
+
+        @Override
+        public String toString() {
+            return getDisplayName();
+        }
+
+        @Override
+        public int hashCode() {
+            return id.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            final JavaRuntime other = (JavaRuntime) obj;
+            return Objects.equals(this.id, other.id);

Review Comment:
   if id cannot be null (see previous comment) then you could write
   return this.id.equals(other.id);



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {

Review Comment:
   can the caller of this method use the explicit information that there is no Runnable available?
   if not then maybe just return () -> {} (empty runnable) and let the caller be ignorant



-- 
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] mbien commented on pull request #5158: Gradle Execution Customizer with Runtime

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

   So this moves the item in `build -> compile` to `build -> gradle execution`. This seems to have the side effect that something which was configurable on a per-sup-project basis is now only configurable in the root project?
   
   UI wise i would consider swapping the Java Runtime panel with Trust Level panel.


-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {

Review Comment:
   Sure.
   



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/customizer/Bundle.properties:
##########
@@ -54,3 +54,27 @@ BuildActionsCustomizer.btnDisableAction.text=&Disable
 BuildActionsCustomizer.jLabel2.text=The action is disabled in this configuration.
 BuildActionsCustomizer.btnRestore.text=&Restore
 BuildActionsCustomizer.btnRemove2.text=Re&set
+GradleExecutionPanel.cbAugmentedBuild.text=&Augmented Build Execution
+GradleExecutionPanel.lbIncludeOpenProjects.text=<html>Create a composite project from this project and the other open Gradle projects by generating '--include-build' parameters.
+GradleExecutionPanel.cbIncludeOpenProjects.text=Include Open Projects
+GradleExecutionPanel.lbTrustTerms.text=<html><p>Executing Gradle can be potentially un-safe as it allows arbitrary code execution.</p>\n<p/>\n<p>By trusting this project, and with that all its subprojects, you entitle NetBeans to invoke Gradle to load project details without further confirmation.</p><p></p><p>Invoking any build related actions, would mark this project automatically trusted.</p>
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#   http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.

Review Comment:
   It seems the form designer took the license header as a comment belonging to the first property item, when I did copy+paste between the panels. Fixed now.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;
+            this.displayName = displayName;
+            this.javaHome = javaHome;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getDisplayName() {
+            return displayName != null ? displayName : id;

Review Comment:
   since this is immutable class this can be calculated in constructor



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
java/gradle.java/src/org/netbeans/modules/gradle/java/JavaRuntimeManagerImpl.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.java;
+
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeSet;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.netbeans.api.java.platform.PlatformsCustomizer;
+import org.netbeans.modules.gradle.spi.execute.JavaRuntimeManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+@ServiceProvider(service = JavaRuntimeManager.class, position = 0)
+public class JavaRuntimeManagerImpl implements JavaRuntimeManager {
+    private static final String PROP_PLATFORM_ID = "platform.ant.name"; //NOI18N
+
+    @Override
+    public Set<JavaRuntime> getAvailableRuntimes() {
+        Set<JavaRuntime> ret = new TreeSet<>();
+        JavaPlatformManager jpm = JavaPlatformManager.getDefault();
+        JavaPlatform defaultPlatform = jpm.getDefaultPlatform();

Review Comment:
   defaultPlatform seems unused



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Map<String, JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {

Review Comment:
   Well, that's mean I do not really plan that the JavaRuntime as an API, just an SPI.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Map<String, JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {

Review Comment:
   Well, that means, I do not really plan to use/expose JavaRuntime as an API, just an SPI.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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

   @mbien Yes, we are going to loose the per sub-project level of the Java Runtime Setting. I think that's a happy loss.
   I'm switching the panels...


-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;
+            this.displayName = displayName;
+            this.javaHome = javaHome;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getDisplayName() {
+            return displayName != null ? displayName : id;
+        }
+
+        public File getJavaHome() {
+            return javaHome;
+        }
+
+        public boolean isBroken() {
+            return javaHome == null || !javaHome.isDirectory();
+        }
+
+        @Override
+        public int compareTo(JavaRuntime o) {
+            return getDisplayName().compareToIgnoreCase(o.getDisplayName());
+        }
+
+        @Override
+        public String toString() {
+            return getDisplayName();
+        }
+
+        @Override
+        public int hashCode() {
+            return id.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            final JavaRuntime other = (JavaRuntime) obj;
+            return Objects.equals(this.id, other.id);

Review Comment:
   Can it create infinite recursion?
   According to documentation of Object.equals
   "Otherwise, equality is determined by using the [equals](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) method of the first argument."



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
java/gradle.java/src/org/netbeans/modules/gradle/java/JavaRuntimeManagerImpl.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.java;
+
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeSet;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.netbeans.api.java.platform.PlatformsCustomizer;
+import org.netbeans.modules.gradle.spi.execute.JavaRuntimeManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+@ServiceProvider(service = JavaRuntimeManager.class, position = 0)
+public class JavaRuntimeManagerImpl implements JavaRuntimeManager {
+    private static final String PROP_PLATFORM_ID = "platform.ant.name"; //NOI18N
+
+    @Override
+    public Set<JavaRuntime> getAvailableRuntimes() {
+        Set<JavaRuntime> ret = new TreeSet<>();
+        JavaPlatformManager jpm = JavaPlatformManager.getDefault();
+        JavaPlatform defaultPlatform = jpm.getDefaultPlatform();

Review Comment:
   There is no JavaRuntimeManagerImpl in the final PR. That was just good enough to get the things going. Later on it was replaced by JavaRuntimePlatformBridge



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Map<String, JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {

Review Comment:
   Well, I have an upcoming plan, to add the JavaPlatform to GradleJavaProject, as well as add that to SourceSets. With the Java Toolchain usage becoming more and more popular, we can see projects with sourcesets using different Java Toolchain, also the used Java toolchain is othen does not match the JavaRuntime Gradle is running on.
   
   I do not know if that could fit into NB17 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 commented on a diff in pull request #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N

Review Comment:
   Well, it is planned to be "clashing". That's the ID actually used by the IDE to mark the default JavaPlatform. The ID-s are never really made into the JavaPlatform API, though used a lot of places. I'm a bit unsure if the ID-s need to be part of this API, as it could be implemented without exposing them this much, though it made some use cases more simple.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {

Review Comment:
   Yes it is actually used that way in the Customizer.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
java/gradle.java/src/org/netbeans/modules/gradle/java/JavaRuntimeManagerImpl.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.java;
+
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeSet;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.netbeans.api.java.platform.PlatformsCustomizer;
+import org.netbeans.modules.gradle.spi.execute.JavaRuntimeManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+@ServiceProvider(service = JavaRuntimeManager.class, position = 0)
+public class JavaRuntimeManagerImpl implements JavaRuntimeManager {
+    private static final String PROP_PLATFORM_ID = "platform.ant.name"; //NOI18N
+
+    @Override
+    public Set<JavaRuntime> getAvailableRuntimes() {
+        Set<JavaRuntime> ret = new TreeSet<>();
+        JavaPlatformManager jpm = JavaPlatformManager.getDefault();

Review Comment:
   There is no JavaRuntimeManagerImpl in the final PR. That was just good enough to get the things going. Later on it was replaced by JavaRuntimePlatformBridge



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
java/gradle.java/src/org/netbeans/modules/gradle/java/JavaRuntimeManagerImpl.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.java;
+
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeSet;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.netbeans.api.java.platform.PlatformsCustomizer;
+import org.netbeans.modules.gradle.spi.execute.JavaRuntimeManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+@ServiceProvider(service = JavaRuntimeManager.class, position = 0)
+public class JavaRuntimeManagerImpl implements JavaRuntimeManager {
+    private static final String PROP_PLATFORM_ID = "platform.ant.name"; //NOI18N
+
+    @Override
+    public Set<JavaRuntime> getAvailableRuntimes() {
+        Set<JavaRuntime> ret = new TreeSet<>();
+        JavaPlatformManager jpm = JavaPlatformManager.getDefault();

Review Comment:
   Not necessary. And what do you mean on `injecting` 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] lkishalmi commented on a diff in pull request #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;
+            this.displayName = displayName;
+            this.javaHome = javaHome;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getDisplayName() {
+            return displayName != null ? displayName : id;
+        }
+
+        public File getJavaHome() {
+            return javaHome;
+        }
+
+        public boolean isBroken() {
+            return javaHome == null || !javaHome.isDirectory();

Review Comment:
   Not really. `javaHome.isDirectory()` can change out of the object lifecycle.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
java/gradle.java/src/org/netbeans/modules/gradle/java/JavaRuntimeManagerImpl.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.java;
+
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeSet;
+import org.netbeans.api.java.platform.JavaPlatform;
+import org.netbeans.api.java.platform.JavaPlatformManager;
+import org.netbeans.api.java.platform.PlatformsCustomizer;
+import org.netbeans.modules.gradle.spi.execute.JavaRuntimeManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+@ServiceProvider(service = JavaRuntimeManager.class, position = 0)
+public class JavaRuntimeManagerImpl implements JavaRuntimeManager {
+    private static final String PROP_PLATFORM_ID = "platform.ant.name"; //NOI18N
+
+    @Override
+    public Set<JavaRuntime> getAvailableRuntimes() {
+        Set<JavaRuntime> ret = new TreeSet<>();
+        JavaPlatformManager jpm = JavaPlatformManager.getDefault();

Review Comment:
   wouldn't injecting JavaPlatformMaganer through constructor be more flexible?



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N

Review Comment:
   this variable seems unused both here and in JavaRuntimeManagerImpl



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Set<JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {
+        final String id;
+        final String displayName;
+        final File javaHome;
+
+        private JavaRuntime(String id, String displayName, File javaHome) {
+            this.id = id;
+            this.displayName = displayName;
+            this.javaHome = javaHome;
+        }
+
+        public String getId() {
+            return id;
+        }
+
+        public String getDisplayName() {
+            return displayName != null ? displayName : id;
+        }
+
+        public File getJavaHome() {
+            return javaHome;
+        }
+
+        public boolean isBroken() {
+            return javaHome == null || !javaHome.isDirectory();
+        }
+
+        @Override
+        public int compareTo(JavaRuntime o) {
+            return getDisplayName().compareToIgnoreCase(o.getDisplayName());
+        }
+
+        @Override
+        public String toString() {
+            return getDisplayName();
+        }
+
+        @Override
+        public int hashCode() {
+            return id.hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            final JavaRuntime other = (JavaRuntime) obj;
+            return Objects.equals(this.id, other.id);

Review Comment:
   Can it create infinite recursion?
   According to documentation of Object.equals
   "Otherwise, equality is determined by using the [equals](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) method of the first argument."



-- 
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 a diff in pull request #5158: Gradle Execution Customizer with Runtime

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


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Map<String, JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {

Review Comment:
   I'd advise to split this UI - related action from the data level. Reason: in headless / LSP / embedded scenario, the distribution could reimplement the chooser somehow, but leave all other logic intact
   
   Second thought: currently the JRPB is just a tiny wrapper around JavaPlatform - so potential override is just as simple. I assume it is because it is 'java artifact' in a lang-agnostic layer. If that's the intention, please make a doc comment in the JRPB implementation and the JavaRuntime API stating that, so no one gets clever idea to bloat the wrapper in the future :)



##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Map<String, JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, File javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, String displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {

Review Comment:
   I'd add a Lookup to the Runtime, so java-aware clients might eventually find the actual `JavaPlatform` and can work with its specifics.
   
   There's JavaRunUtils that can extract JavaPlatform, but is not public.



##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {

Review Comment:
   If intending to merge before NB17 branching, javadocs + apichanges should be added for this + other API changes. Maybe some overview javadoc that explains purpose / difference between JavaPlatform and JavaRuntime.



-- 
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 #5158: Gradle Execution Customizer with Runtime

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


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