Skip to content

Commit 312307d

Browse files
authored
Merge pull request #8710 from apache/delivery
Sync delivery to release270 for 27-rc3
2 parents 1e53285 + e2eb87d commit 312307d

File tree

15 files changed

+161
-63
lines changed

15 files changed

+161
-63
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ jobs:
520520
if: ${{ (matrix.config == 'release') && success() }}
521521
uses: actions/setup-node@v4
522522
with:
523-
node-version: 18
523+
node-version: 20.18.1
524524

525525
- name: Build NBVSCodeExt from ${{ matrix.config }}-src zip
526526
if: ${{ (matrix.config == 'release') && success() }}
@@ -2627,7 +2627,7 @@ jobs:
26272627
- name: Set up node
26282628
uses: actions/setup-node@v4
26292629
with:
2630-
node-version: 18
2630+
node-version: 20.18.1
26312631

26322632
- name: Setup Xvfb
26332633
run: |

extide/gradle/apichanges.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ is the proper place.
8585
<changes>
8686
<change id="current-gradle-version-discovery">
8787
<api name="general"/>
88-
<summary>GradleDistributionManager can query latest available version and use in init</summary>
88+
<summary>GradleDistributionManager can query latest available and latest supported versions and use in init</summary>
8989
<version major="2" minor="47"/>
9090
<date day="20" month="6" year="2025"/>
9191
<author login="neilcsmith"/>
9292
<compatibility semantic="compatible" addition="yes"/>
9393
<description>
9494
Added <code><a href="@TOP@/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.html#currentDistribution()">GradleDistributionManager.currentDistribution()</a></code>
9595
method to query the current (latest) release available from the Gradle web service.
96+
Added <code><a href="@TOP@/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.html#latestSupportedDistribution()">GradleDistributionManager.latestSupportedDistribution()</a></code>
97+
method to query the latest supported release from the Gradle web service.
9698
Added <code>gradleVersion(String version)</code> to
9799
<a href="@TOP@/org/netbeans/modules/gradle/spi/newproject/TemplateOperation.InitOperation.html">TemplateOperation.InitOperation</a>.
98100
</description>

extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/GradleInternalAdapter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import org.gradle.api.logging.Logging;
3838
import org.gradle.api.reflect.HasPublicType;
3939
import org.gradle.plugin.use.PluginId;
40-
import org.gradle.util.VersionNumber;
40+
import org.gradle.util.GradleVersion;
4141
import org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.ExceptionCallable;
4242
import org.netbeans.modules.gradle.tooling.NbProjectInfoBuilder.ValueAndType;
4343

@@ -53,11 +53,11 @@ public class GradleInternalAdapter {
5353
private static final Logger LOG = Logging.getLogger(NbProjectInfoBuilder.class);
5454

5555
private final Project project;
56-
private final VersionNumber gradleVersion;
56+
private final GradleVersion gradleVersion;
5757
/**
58-
* Accummulates error messages, so that just one problem is logger a given type of error.
58+
* Accumulates error messages, so that just one problem is logger a given type of error.
5959
*/
60-
private Set<String> reportedIncompatibilities = new HashSet<>();
60+
private final Set<String> reportedIncompatibilities = new HashSet<>();
6161

6262
protected NbProjectInfoModel model;
6363

@@ -70,7 +70,7 @@ public class GradleInternalAdapter {
7070

7171
public GradleInternalAdapter(Project project) {
7272
this.project = project;
73-
this.gradleVersion = VersionNumber.parse(project.getGradle().getGradleVersion());
73+
this.gradleVersion = GradleVersion.version(project.getGradle().getGradleVersion());
7474
}
7575

7676
boolean initPlugins() {
@@ -143,7 +143,7 @@ private static <T extends Throwable> void sneakyThrow(Throwable exception) throw
143143
}
144144

145145
private <T, E extends Throwable> T sinceGradleOrDefault(String version, NbProjectInfoBuilder.ExceptionCallable<T, E> c, Supplier<T> def) {
146-
if (gradleVersion.compareTo(VersionNumber.parse(version)) >= 0) {
146+
if (gradleVersion.compareTo(GradleVersion.version(version)) >= 0) {
147147
try {
148148
return c.call();
149149
} catch (RuntimeException | Error e) {

extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
import org.gradle.api.provider.Provider;
9898
import org.gradle.api.reflect.HasPublicType;
9999
import org.gradle.api.reflect.TypeOf;
100-
import org.gradle.api.specs.Specs;
101100
import org.gradle.api.tasks.SourceSet;
102101
import org.gradle.api.tasks.SourceSetContainer;
103102
import org.gradle.api.tasks.TaskDependency;
@@ -308,7 +307,8 @@ private String getTaskInheritance(Task t) {
308307
"shouldRunAfter",
309308
"enabled",
310309
"description",
311-
"group"
310+
"group",
311+
"toolchainDownloadUrls" // UpdateDaemonJvm fron org.gradle.toolchains.foojay-resolver-convention accesses online sevice for URLs
312312
));
313313

314314
private void detectTaskProperties(NbProjectInfoModel model) {
@@ -587,7 +587,7 @@ private void inspectObjectAndValues(Class clazz, Object object, String prefix, M
587587
try {
588588
if (depth++ >= MAX_INTROSPECTION_DEPTH) {
589589
if (!suppressDepthWarning) {
590-
LOG.warn("Too deep structure, truncating");
590+
LOG.warn("Too deep structure, truncating: " + String.format("path: %s, value: %s", prefix, object));
591591
model.noteProblem(Report.Severity.WARNING,
592592
String.format("Object structure too deep encountered in class %s", clazz),
593593
String.format("Object structure is too deep for the project model builder. This is unlikely to affect basic project operations. "
@@ -718,6 +718,11 @@ private void inspectObjectAndValues0(Class clazz, Object object, String prefix,
718718
if ((mp.getModifiers() & Modifier.PUBLIC) == 0) {
719719
continue;
720720
}
721+
// ignore static properties for now. If needed, they must be exported somehow per-class and protected
722+
// against recursion.
723+
if ((mp.getModifiers() & Modifier.STATIC) != 0) {
724+
continue;
725+
}
721726
if (object != null) {
722727
// Provider must NOT be asked for a value, otherwise it might run a Task in order to compute
723728
// the value.
@@ -1701,7 +1706,7 @@ private void detectDependencies(NbProjectInfoModel model) {
17011706
try {
17021707
it.getResolvedConfiguration()
17031708
.getLenientConfiguration()
1704-
.getFirstLevelModuleDependencies(Specs.SATISFIES_ALL)
1709+
.getFirstLevelModuleDependencies()
17051710
.forEach(rd -> collectArtifacts(rd, resolvedJvmArtifacts));
17061711
} catch (ArtifactResolveException ex) {
17071712
convertOfflineException(ex);

extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NetBeansRunSinglePlugin.java

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.netbeans.modules.gradle.tooling;
2121

2222
import static java.util.Arrays.asList;
23+
import java.util.List;
2324
import java.util.Set;
2425
import org.gradle.api.DefaultTask;
2526
import org.gradle.api.logging.Logger;
@@ -76,15 +77,8 @@ private void configureJavaExec(Project project, JavaExec je) {
7677
je.setArgs(asList(project.property(RUN_SINGLE_ARGS).toString().split(" ")));
7778
}
7879
if (project.hasProperty(RUN_SINGLE_JVM_ARGS)) {
79-
// Property jvmArgumentProviders should not be implemented as a lambda to allow execution optimizations.
80-
// See https://docs.gradle.org/current/userguide/validation_problems.html#implementation_unknown
81-
je.getJvmArgumentProviders().add(new CommandLineArgumentProvider() {
82-
// Do not convert to lambda.
83-
@Override
84-
public Iterable<String> asArguments() {
85-
return asList(project.property(RUN_SINGLE_JVM_ARGS).toString().split(" "));
86-
}
87-
});
80+
// do not use plain setter, as other Plugins may provide their own JVM flags + providers.
81+
je.getJvmArgumentProviders().add(new JvmArgumentsHolder(asList(project.property(RUN_SINGLE_JVM_ARGS).toString().split(" "))));
8882
}
8983
try {
9084
je.setStandardInput(System.in);
@@ -112,4 +106,22 @@ private void addTask(Project project, Task runTask) {
112106
runSingle.configure((task) -> task.doFirst((action) -> project.getLogger().warn(DEPRECATE_RUN_SINGLE)));
113107
}
114108

109+
/**
110+
* A simple holder to add JVM arguments on top of other args provide by other plugins.
111+
* DO NOT store Project or other resource-bound references here, keep static. It is attached to a task
112+
* as a provider and serialized/cached. See Micronaut Configuration
113+
* Cache requirements.
114+
*/
115+
private static class JvmArgumentsHolder implements CommandLineArgumentProvider {
116+
private final List<String> jvmArguments;
117+
118+
public JvmArgumentsHolder(List<String> jvmArguments) {
119+
this.jvmArguments = jvmArguments;
120+
}
121+
122+
@Override
123+
public Iterable<String> asArguments() {
124+
return jvmArguments;
125+
}
126+
}
115127
}

extide/gradle/src/org/netbeans/modules/gradle/api/execute/GradleDistributionManager.java

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ public final class GradleDistributionManager {
104104
GradleVersion.version("8.14"),// JDK-24
105105
};
106106

107-
private static final GradleVersion LAST_KNOWN_GRADLE = GradleVersion.version("8.14"); //NOI18N
107+
private static final GradleVersion LAST_KNOWN_GRADLE = GradleVersion.version("9.0"); //NOI18N
108+
109+
private static final int LATEST_SUPPORTED_MAJOR = 9;
108110

109111
final File gradleUserHome;
110112

@@ -283,6 +285,41 @@ public GradleDistribution currentDistribution() throws IOException {
283285
}
284286
}
285287

288+
/**
289+
* Returns the latest {@link GradleDistribution} which is supported by this
290+
* {@link GradleDistributionManager}. This method uses the
291+
* <a href="https://services.gradle.org/versions">https://services.gradle.org/versions</a>
292+
* web service to query the version.
293+
*
294+
* @return the latest Gradle distribution which can still be supported
295+
* @throws java.io.IOException if information on the current Gradle release
296+
* cannot be accessed
297+
*/
298+
public GradleDistribution latestSupportedDistribution() throws IOException {
299+
JSONParser parser = new JSONParser();
300+
URL versionsCurrent = URI.create("https://services.gradle.org/versions/" + LATEST_SUPPORTED_MAJOR).toURL(); //NOI18N
301+
try (InputStreamReader is = new InputStreamReader(versionsCurrent.openStream(), StandardCharsets.UTF_8)) {
302+
JSONArray releases = (JSONArray) parser.parse(is);
303+
for (Object obj : releases) {
304+
JSONObject release = (JSONObject) obj;
305+
if (release.get("snapshot") instanceof Boolean snapshot && !snapshot //NOI18N
306+
&& release.get("nightly") instanceof Boolean nightly && !nightly //NOI18N
307+
&& release.get("releaseNightly") instanceof Boolean releaseNightly && !releaseNightly //NOI18N
308+
&& release.get("activeRc") instanceof Boolean activeRc && !activeRc //NOI18N
309+
&& release.get("broken") instanceof Boolean broken && !broken //NOI18N
310+
&& release.get("rcFor") instanceof String rcFor && rcFor.isBlank() //NOI18N
311+
&& release.get("milestoneFor") instanceof String milestoneFor && milestoneFor.isBlank()) { //NOI18N
312+
URI downloadURL = new URI((String) release.get("downloadUrl")); //NOI18N
313+
String version = (String) release.get("version"); //NOI18N
314+
return new GradleDistribution(distributionBaseDir(downloadURL, version), downloadURL, version);
315+
}
316+
}
317+
throw new IOException("no release found with major version " + LATEST_SUPPORTED_MAJOR);
318+
} catch (ParseException | URISyntaxException | ClassCastException ex) {
319+
throw new IOException(ex);
320+
}
321+
}
322+
286323
/**
287324
* Create a {@link GradleDistribution} from the Gradle version distributed
288325
* with the Gradle Tooling of the IDE. This should be the most IDE compatible

extide/gradle/src/org/netbeans/modules/gradle/spi/newproject/GradleInitWizard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ protected void collectOperations(TemplateOperation ops, Map<String, Object> para
212212

213213
if (!GradleSettings.getDefault().isOffline()) {
214214
try {
215-
init.gradleVersion(GradleDistributionManager.get().currentDistribution().getVersion());
215+
init.gradleVersion(GradleDistributionManager.get().latestSupportedDistribution().getVersion());
216216
} catch (IOException ex) {
217217
Exceptions.printStackTrace(ex);
218218
}

java/java.disco/external/binaries-list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
4FCCADF37F1C61A0895BAC3D42FE0C530438826C org.checkerframework:checker-qual:3.9.1
18-
CE10D968585304A7463430DD53254E6D6893DF16 io.foojay.api:discoclient:2.0.24
19-
F66F9FC72A84FCAB1579202728EE572BDBB46DD7 eu.hansolo:jdktools:11.0.11
18+
BB975ACE8403330DCC7ABF61A3142B0B59ADC755 io.foojay.api:discoclient:2.0.39
19+
AD117688D24FACCF74D3B76AFFFC2693C4F5D122 eu.hansolo:jdktools:11.0.19

java/java.disco/external/discoclient-2.0.24-license.txt renamed to java/java.disco/external/discoclient-2.0.39-license.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: DiscoClient
22
Origin: Gerrit Grunwald
3-
Version: 2.0.24
3+
Version: 2.0.39
44
License: Apache-2.0
55
Description: Library to access the Foojay.io Discovery API service.
66
Origin: https://github.com/foojayio/discoclient

java/java.disco/external/jdktools-11.0.11-license.txt renamed to java/java.disco/external/jdktools-11.0.19-license.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: JDKTools
22
Origin: Gerrit Grunwald
3-
Version: 11.0.11
3+
Version: 11.0.19
44
License: Apache-2.0
55
Description: Collection of classes for working with OpenJDK related things.
66
Origin: https://github.com/HanSolo/jdktools

0 commit comments

Comments
 (0)