Skip to content
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

added support for gradle 8.5 #108

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<property name="nbplatform.default.harness.dir" location="${nbplatform.default.netbeans.dest.dir}/harness" />
<property name="nbantext.jar" location="netbeans/nbbuild/build/nbantext.jar" />
<property name="nb_all" location="netbeans" />
<property name="patches" value="patches/6133.diff patches/6330.diff patches/6481.diff patches/6615.diff patches/6631.diff patches/6637.diff patches/6642.diff patches/6649.diff patches/6690.diff patches/6771.diff patches/6329.diff patches/6742.diff patches/6780.diff patches/6834.diff patches/mvn-sh.diff patches/rename-debugger.diff" />
<property name="patches" value="patches/6133.diff patches/6330.diff patches/6481.diff patches/6615.diff patches/6631.diff patches/6637.diff patches/6642.diff patches/6649.diff patches/6690.diff patches/6771.diff patches/6329.diff patches/6742.diff patches/6780.diff patches/6807.diff patches/6834.diff patches/mvn-sh.diff patches/rename-debugger.diff" />
<condition property="cmd.suffix" value=".cmd" else="">
<os family="windows"/>
</condition>
Expand Down
37 changes: 37 additions & 0 deletions patches/6807.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java b/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
index 1cc156d0f622..c90316077493 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java
@@ -100,6 +100,7 @@ public final class GradleDistributionManager {
GradleVersion.version("7.5"), // JDK-18
GradleVersion.version("7.6"), // JDK-19
GradleVersion.version("8.3"), // JDK-20
+ GradleVersion.version("8.5"), // JDK-21
};

final File gradleUserHome;
@@ -484,12 +485,22 @@ public String getVersion() {
* Checks if this Gradle distribution is compatible with the given
* major version of Java. Java 1.6, 1.7 and 1.8 are treated as major
* version 6, 7, and 8.
- *
+ * <p>
+ * NetBeans uses a built in fixed list of compatibility matrix. That
+ * means it might not know about the compatibility of newer Gradle
+ * versions. Optimistic bias would return {@code true} on these
+ * versions form 2.37.
+ * </p>
* @param jdkMajorVersion the major version of the JDK
* @return <code>true</code> if this version is supported with that JDK.
*/
public boolean isCompatibleWithJava(int jdkMajorVersion) {
- return jdkMajorVersion <= lastSupportedJava();
+
+ GradleVersion lastKnown = JDK_COMPAT[JDK_COMPAT.length - 1];
+ // Optimistic bias, if the GradleVersion is newer than the last NB
+ // knows, we say it's compatible with any JDK
+ return lastKnown.compareTo(version.getBaseVersion()) < 0
+ || jdkMajorVersion <= lastSupportedJava();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make use of Gradle compatibility table given here https://docs.gradle.org/current/userguide/compatibility.html ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes maybe I don't know for sure, but currently it is manually handled in netbeans for every release. This patch is taken from apache/netbeans#6807

}

/**