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

Upgrade Gradle Tooling API to 8.7 #7215

Merged
merged 1 commit into from
Apr 3, 2024
Merged
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
16 changes: 16 additions & 0 deletions extide/gradle/apichanges.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ is the proper place.
<!-- ACTUAL CHANGES BEGIN HERE: -->

<changes>
<change id="gradle-init-javaversion">
<api name="general"/>
<summary>Gradle InitOperation now Supports --java-version and --comments flags</summary>
mbien marked this conversation as resolved.
Show resolved Hide resolved
<version major="2" minor="40"/>
<date day="31" month="3" year="2024"/>
<author login="lkishalmi"/>
<compatibility semantic="compatible" addition="yes"/>
<description>
<p>
Added <code>comments(Boolean comments)</code> and <code>javaVersion(String version)</code> to
<a href="@TOP@/org/netbeans/modules/gradle/spi/newproject/TemplateOperation.InitOperation.html">TemplateOperation.InitOperation</a>
allowing more detailed project creation.
</p>
</description>
<class package="org.netbeans.modules.gradle.spi.newproject" name="TemplateOperation"/>
</change>
<change id="gradle-report-severity">
<api name="general"/>
<summary>Gradle project problems have severity and stacktraces</summary>
Expand Down
2 changes: 1 addition & 1 deletion extide/gradle/manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ AutoUpdate-Show-In-Client: true
OpenIDE-Module: org.netbeans.modules.gradle/2
OpenIDE-Module-Layer: org/netbeans/modules/gradle/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/gradle/Bundle.properties
OpenIDE-Module-Specification-Version: 2.39
OpenIDE-Module-Specification-Version: 2.40
4 changes: 3 additions & 1 deletion extide/gradle/nbproject/org-netbeans-modules-gradle.sig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Signature file v4.1
#Version 2.38
#Version 2.40

CLSS public abstract interface java.io.Serializable

Expand Down Expand Up @@ -1100,7 +1100,9 @@ hcls BaseOperationStep,ConfigureProjectStep,CopyFromFileTemplate,CopyFromTemplat
CLSS public abstract org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitOperation
outer org.netbeans.modules.gradle.spi.newproject.TemplateOperation
meth public abstract org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitOperation basePackage(java.lang.String)
meth public abstract org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitOperation comments(java.lang.Boolean)
meth public abstract org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitOperation dsl(java.lang.String)
meth public abstract org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitOperation javaVersion(java.lang.String)
meth public abstract org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitOperation projectName(java.lang.String)
meth public abstract org.netbeans.modules.gradle.spi.newproject.TemplateOperation$InitOperation testFramework(java.lang.String)
meth public final void add()
Expand Down
2 changes: 1 addition & 1 deletion extide/gradle/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<compile-dependency/>
<run-dependency>
<release-version>8</release-version>
<specification-version>8.0.1</specification-version>
<specification-version>8.7</specification-version>
</run-dependency>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ public enum Flag implements GradleOptionItem {
NO_CONFIGURE_ON_DEMAND(PARAM, "--no-configure-on-demand"),
NO_DAEMON(UNSUPPORTED, "--no-daemon"),
NO_PARALLEL(PARAM, "--no-parallel"),
NO_REBUILD(PARAM, GradleVersionRange.until("8.0"), "-a", "--no-rebuild"),
NO_REBUILD(PARAM, "-a", "--no-rebuild"),
NO_SCAN(PARAM, GradleVersionRange.from("4.3"), "--no-scan"),
NO_SEARCH_UPWARD(UNSUPPORTED, GradleVersionRange.until("5.0"), "--no-search-upward", "-u"),
NO_WATCH_FS(PARAM, GradleVersionRange.from("6.7"), "--no-watch-fs"),
OFFLINE(PARAM, "--offline"),
PARALLEL(PARAM, "--parallel"),
PROFILE(PARAM, "--profile"),
RECOMPILE_SCRIPTS(UNSUPPORTED, GradleVersionRange.until("5.0"), "--recompile-scripts"),
REFRESH_DEPENDENCIES(PARAM, "--refresh-dependencies"),
REFRESH_DEPENDENCIES(PARAM, "-U", "--refresh-dependencies"),
REFRESH_KEYS(PARAM, GradleVersionRange.from("6.2"), "--refresh-keys"),
RERUN_TASKS(PARAM, "--rerun-tasks"),
SCAN(PARAM, GradleVersionRange.from("4.3"), "--scan"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public final class GradleDistributionManager {
GradleVersion.version("8.5"), // JDK-21
};

private static final GradleVersion LAST_KNOWN_GRADLE = GradleVersion.version("8.6"); //NOI18N
private static final GradleVersion LAST_KNOWN_GRADLE = GradleVersion.version("8.7"); //NOI18N
Comment on lines 103 to +106
Copy link
Member

Choose a reason for hiding this comment

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

looks like groovy is holding up gradle again:
https://docs.gradle.org/8.7/release-notes.html#java-22

Copy link
Contributor

Choose a reason for hiding this comment

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

Damn! Why did no one tell groovy that this should not work:

matthias@enterprise:~/Downloads$ ~/bin/groovy-4/bin/groovy -v
Groovy Version: 4.0.20 JVM: 22 Vendor: Oracle Corporation OS: Linux
matthias@enterprise:~/Downloads$ ~/bin/groovy-4/bin/groovy -e 'print "Hello World\n"'
Hello World
matthias@enterprise:~/Downloads$

http://groovy-lang.org/changelogs/changelog-4.0.16.html references support for JDK 22. That release was created about 4 months ago.

I think this might be a bit more involved, than "groovy does not support JDK 22", maybe it is "we did not manage to integrate the groovy version that support JDK 22".

Copy link
Member

@mbien mbien Apr 3, 2024

Choose a reason for hiding this comment

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

i think the release notes are a bit oversimplified which caused issues in past since they were not clear what is supposed to work and what doesn't work on current jdks.

gradle/gradle#26162 this issue tracks JDK 22 progress. Groovy isn't the only item holding them back.


final File gradleUserHome;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
import org.openide.util.NbBundle;

/**
*
* Steps, that a New Gradle Project Wizard can perform.
*
* @author Laszlo Kishalmi
*/
public final class TemplateOperation implements Runnable {
Expand Down Expand Up @@ -236,6 +237,21 @@ public final void add() {
* @since 2.20
*/
public abstract InitOperation projectName(String name);

/** Specify the Java version the project would be compiled, tested,
* and executed with.
* @param version the Java version to be used
* @return this builder to chain the calls.
* @since 2.40
*/
public abstract InitOperation javaVersion(String version);

/** Specify whether create comments in the generated files.
* @param comments set {@code false} to generate more compact project files.
* @return this builder to chain the calls.
* @since 2.40
*/
public abstract InitOperation comments(Boolean comments);
}

private final class InitStep extends InitOperation implements OperationStep {
Expand All @@ -245,6 +261,8 @@ private final class InitStep extends InitOperation implements OperationStep {
private String testFramework;
private String basePackage;
private String projectName;
private String javaVersion;
private Boolean comments;

InitStep(File target, String type) {
this.target = target;
Expand Down Expand Up @@ -315,6 +333,20 @@ public Set<FileObject> execute() {
args.add(projectName);
}

// --java-version 21
if (javaVersion != null) {
args.add("--java-version");
args.add(javaVersion);
}

if (comments != null) {
args.add(comments ? "--comments" : "--no-comments");
}

// gradle init is non-interactive inside the IDE
args.add("--use-defaults");


if (GradleSettings.getDefault().isOffline()) {
pconn.newBuild().withArguments("--offline").forTasks(args.toArray(new String[0])).run(); //NOI18N
} else {
Expand All @@ -326,6 +358,18 @@ public Set<FileObject> execute() {
gconn.disconnect();
return Collections.singleton(FileUtil.toFileObject(target));
}

@Override
public InitOperation javaVersion(String version) {
this.javaVersion = version;
return this;
}

@Override
public InitOperation comments(Boolean comments) {
this.comments = comments;
return this;
}
}

public void copyFromFile(String templateName, File target, Map<String, ? extends Object> tokens) {
Expand Down
2 changes: 1 addition & 1 deletion extide/libs.gradle/external/binaries-list
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.

1B1A733327BD5EFE9813DD0590C21865C0EDC954 https://repo.gradle.org/artifactory/libs-releases/org/gradle/gradle-tooling-api/8.6/gradle-tooling-api-8.6.jar gradle-tooling-api-8.6.jar
5F48B9BB9099B900FC33864A3794F31C439D9F73 https://repo.gradle.org/artifactory/libs-releases/org/gradle/gradle-tooling-api/8.7/gradle-tooling-api-8.7.jar gradle-tooling-api-8.7.jar
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: Gradle Tooling API
Description: Gradle Tooling API
Version: 8.6
Files: gradle-tooling-api-8.6.jar
Version: 8.7
Files: gradle-tooling-api-8.7.jar
License: Apache-2.0
Origin: Gradle Inc.
URL: https://gradle.org/
Expand Down
2 changes: 1 addition & 1 deletion extide/libs.gradle/manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Manifest-Version: 1.0
AutoUpdate-Show-In-Client: false
OpenIDE-Module: org.netbeans.modules.libs.gradle/8
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/libs/gradle/Bundle.properties
OpenIDE-Module-Specification-Version: 8.6
OpenIDE-Module-Specification-Version: 8.7
2 changes: 1 addition & 1 deletion extide/libs.gradle/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ javac.compilerargs=-Xlint -Xlint:-serial
# Sigtest fails to read the classes in the gradle-tooling-api
sigtest.skip.gen=true

release.external/gradle-tooling-api-8.6.jar=modules/gradle/gradle-tooling-api.jar
release.external/gradle-tooling-api-8.7.jar=modules/gradle/gradle-tooling-api.jar
2 changes: 1 addition & 1 deletion extide/libs.gradle/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</public-packages>
<class-path-extension>
<runtime-relative-path>gradle/gradle-tooling-api.jar</runtime-relative-path>
<binary-origin>external/gradle-tooling-api-8.6.jar</binary-origin>
<binary-origin>external/gradle-tooling-api-8.7.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
Expand Down
Loading