-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gradle Execution Customizer with Runtime #5158
Gradle Execution Customizer with Runtime #5158
Conversation
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Outdated
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Show resolved
Hide resolved
java/gradle.java/src/org/netbeans/modules/gradle/java/JavaRuntimeManagerImpl.java
Outdated
Show resolved
Hide resolved
java/gradle.java/src/org/netbeans/modules/gradle/java/JavaRuntimeManagerImpl.java
Outdated
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/GradleBrokenRuntimeProblemProvider.java
Outdated
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/customizer/Bundle.properties
Outdated
Show resolved
Hide resolved
* | ||
* @author Laszlo Kishalmi | ||
*/ | ||
public interface JavaRuntimeManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Show resolved
Hide resolved
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java
Show resolved
Hide resolved
0c8406d
to
f4bf735
Compare
So this moves the item in UI wise i would consider swapping the Java Runtime panel with Trust Level panel. |
@mbien Yes, we are going to loose the per sub-project level of the Java Runtime Setting. I think that's a happy loss. |
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. |
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you are asked so nicely I approve.
But I ran only rudimentary tests today. Code looks good to me.
final String displayName; | ||
final File javaHome; | ||
|
||
private JavaRuntime(@NonNull String id, String displayName, File javaHome) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like it could use Path?
* Moved Gradle Java Runtime Selection into Gradle Projects * GradleJavaPlatformProviderImpl uses the JavaRuntimeManager now. * Moved GradleJavaProjectProblemProvider to Gradle Project * Added change aware bridge between JavaRuntime and JavaPlatform * Removed unloadable project warning from customizer, other fixes * Polishing the code according suggestions. * Adjusted Bundle.properties for the customizers. * Added API documentation. * Mage JavaRuntime on top of Gradle Execution Customizer
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 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
andJavaRuntime
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.
Changed to
While the
Build/Compile
customizer got removed.