Skip to content

Commit b53e117

Browse files
committed
build: upgrade to Gradle 8.14.3, Bnd Gradle Plugins 7.1.0, Gradle JDK 21
- Use JDK 21 to run Gradle - Fix all Gradle deprecation warnings, e.g. "Invocation of Task.project at execution time has been deprecated."
1 parent 3e289b0 commit b53e117

File tree

6 files changed

+65
-34
lines changed

6 files changed

+65
-34
lines changed

.github/workflows/validate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,16 @@ jobs:
7777
cache: gradle
7878

7979

80-
- name: "Install: JDK 17 ☕ for running gradle"
80+
- name: "Install: JDK 21 ☕ for running gradle"
8181
uses: actions/setup-java@v5 # https://github.com/actions/setup-java
8282
with:
8383
distribution: temurin
84-
java-version: 17
84+
java-version: 21
8585
cache: gradle
8686

8787

8888
- name: Build with Gradle 🏗️
89-
run: ./gradlew build
89+
run: ./gradlew build --warning-mode=all
9090

9191

9292
##################################################

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ buildscript {
1717
repositories {
1818
mavenCentral()
1919
maven {
20-
url "https://plugins.gradle.org/m2/"
20+
url = "https://plugins.gradle.org/m2/"
2121
}
2222
}
2323
dependencies {
24-
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0"
25-
classpath "org.xtext:xtext-gradle-plugin:4.0.0"
24+
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:7.1.0" // https://github.com/bndtools/bnd/releases
25+
classpath "org.xtext:xtext-gradle-plugin:4.0.0" // https://github.com/xtext/xtext-gradle-plugin/releases
2626
}
2727
}
2828

@@ -175,7 +175,7 @@ subprojects {
175175
}
176176

177177
task clean(type: Delete) {
178-
group 'Build'
179-
description 'Deletes the local repositories'
178+
group = 'Build'
179+
description = 'Deletes the local repositories'
180180
delete 'build'
181181
}

gradle/java-compiler-settings.gradle

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/******************************************************************************
22
* Copyright (c) 2016 TypeFox and others.
3-
*
3+
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
66
* http://www.eclipse.org/legal/epl-2.0,
77
* or the Eclipse Distribution License v. 1.0 which is available at
88
* http://www.eclipse.org/org/documents/edl-v10.php.
9-
*
9+
*
1010
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
1111
******************************************************************************/
1212

@@ -39,28 +39,28 @@ tasks.withType(Test).configureEach {
3939
}
4040

4141
task sourcesJar(type: Jar, dependsOn: classes) {
42-
group 'Build'
43-
description 'Assembles a jar archive containing the sources.'
42+
group = 'Build'
43+
description = 'Assembles a jar archive containing the sources.'
4444
archiveClassifier = 'sources'
4545
from sourceSets.main.allSource
4646
}
4747

4848
task javadocJar(type: Jar, dependsOn: javadoc) {
49-
group 'Build'
50-
description 'Assembles a jar archive containing the JavaDoc output.'
49+
group = 'Build'
50+
description = 'Assembles a jar archive containing the JavaDoc output.'
5151
archiveClassifier = 'javadoc'
5252
from javadoc.destinationDir
5353
}
5454

55-
ext.signMethod = { jarfile ->
55+
ext.signMethod = { jarfile ->
5656
println "Signing $jarfile"
5757
def SIGNING_SERVICE = 'https://cbi.eclipse.org/jarsigner/sign'
5858
def STDOUT_FORMAT = ' %{size_upload} bytes uploaded, %{size_download} bytes downloaded (%{time_total} s)\\n'
5959

60-
ProcessBuilder curl_pb = new ProcessBuilder("curl",
60+
ProcessBuilder curl_pb = new ProcessBuilder("curl",
6161
"--fail", "--silent", "--show-error", "--output",
6262
"${jarfile}-signed", "--form", "file=@${jarfile}",
63-
"--write-out", STDOUT_FORMAT,
63+
"--write-out", STDOUT_FORMAT,
6464
SIGNING_SERVICE);
6565
println String.join(" ", curl_pb.command());
6666
curl_pb.directory(new File("${project.buildDir}"));
@@ -71,26 +71,31 @@ ext.signMethod = { jarfile ->
7171
println curl_process.text
7272

7373
if (curl_process.exitValue() != 0) {
74-
throw new GradleException("Failed to run curl");
74+
throw new GradleException("Failed to run curl");
7575
}
7676

77-
ProcessBuilder mv_pb = new ProcessBuilder("mv",
77+
ProcessBuilder mv_pb = new ProcessBuilder("mv",
7878
"${jarfile}-signed", jarfile)
7979
println String.join(" ", mv_pb.command());
8080
mv_pb.directory(new File("${project.buildDir}"));
8181
Process mv_process = mv_pb.start()
8282
mv_process.waitFor()
8383

8484
if (curl_process.exitValue() != 0) {
85-
throw new GradleException("Failed to run mv");
85+
throw new GradleException("Failed to run mv");
8686
}
8787
}
8888

8989
task signJar(description: 'Sign JARs with Eclipse Signing Service', group: 'Build'){
90-
doLast {
91-
signMethod("${project.buildDir}/libs/${project.name}-${project.version}.jar")
92-
signMethod("${project.buildDir}/libs/${project.name}-${project.version}-sources.jar")
93-
signMethod("${project.buildDir}/libs/${project.name}-${project.version}-javadoc.jar")
90+
def projectBase = "${project.buildDir}/libs/${project.name}-${project.version}"
91+
92+
// Declare inputs/outputs for config-cache friendliness
93+
inputs.property('projectBase', projectBase)
94+
95+
doLast {
96+
signMethod("${projectBase}.jar")
97+
signMethod("${projectBase}-sources.jar")
98+
signMethod("${projectBase}-javadoc.jar")
9499
}
95100
}
96101
signJar.dependsOn jar, sourcesJar, javadocJar

gradle/manifest-gen.gradle

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/******************************************************************************
22
* Copyright (c) 2016 TypeFox and others.
3-
*
3+
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
66
* http://www.eclipse.org/legal/epl-2.0,
77
* or the Eclipse Distribution License v. 1.0 which is available at
88
* http://www.eclipse.org/org/documents/edl-v10.php.
9-
*
9+
*
1010
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
1111
******************************************************************************/
1212
apply plugin: "biz.aQute.bnd.builder"
@@ -26,27 +26,51 @@ jar.bundle.bnd (
2626
"-savemanifest": "build/tmp/bnd/MANIFEST.MF",
2727
)
2828

29+
// Workaround for Gradle 8 deprecation: avoid Bnd accessing Task.project at execution time
30+
// by supplying needed Gradle Project properties via Providers to the Bnd builder.
31+
// See: https://github.com/bndtools/bnd/issues/6346#issuecomment-2450176628
32+
tasks.named('jar') {
33+
// The bnd plugin contributes a 'bundle { }' configuration on Jar tasks
34+
bundle {
35+
properties.put('project.group', providers.provider { project.group?.toString() ?: '' })
36+
properties.put('project.name', providers.provider { project.name })
37+
properties.put('project.version', providers.provider { project.version?.toString() ?: '' })
38+
properties.put('project.path', providers.provider { project.path })
39+
properties.put('projectDir', providers.provider { project.projectDir?.absolutePath ?: '' })
40+
properties.put('rootDir', providers.provider { project.rootDir?.absolutePath ?: '' })
41+
properties.put('buildDir', providers.provider { project.buildDir?.absolutePath ?: '' })
42+
}
43+
}
44+
2945
//------------------------------------------------------
3046
// Generate a manifest for the source bundle
3147

3248
def sourcesManifestFile = "$buildDir/tmp/sourcesJar/MANIFEST.MF"
3349

3450
task genSourcesManifest {
51+
def projectName = project.name
52+
def projectTitle = project.findProperty('title') ?: ''
53+
54+
// Declare inputs/outputs for config-cache friendliness
55+
inputs.property('projectName', projectName)
56+
inputs.property('projectTitle', projectTitle)
57+
inputs.property('qualifiedVersion', qualifiedVersion)
3558
outputs.file(sourcesManifestFile)
59+
3660
doLast {
3761
def f = new File(sourcesManifestFile)
3862
f.parentFile.mkdirs()
3963
def writer = new PrintWriter(f)
4064
writer.println("Manifest-Version: 1.0")
4165
writer.println("Bundle-ManifestVersion: 2")
42-
writer.println("Bundle-SymbolicName: ${project.name}.source")
66+
writer.println("Bundle-SymbolicName: ${projectName}.source")
4367
writer.println("Bundle-Version: ${qualifiedVersion}")
44-
if (project.hasProperty('title'))
45-
writer.println("Bundle-Name: ${project.title} Sources")
68+
if (projectTitle)
69+
writer.println("Bundle-Name: ${projectTitle} Sources")
4670
else
4771
writer.println("Bundle-Name: Sources")
4872
writer.println("Bundle-Vendor: Eclipse LSP4J")
49-
writer.println("Eclipse-SourceBundle: ${project.name};version=\"${qualifiedVersion}\"")
73+
writer.println("Eclipse-SourceBundle: ${projectName};version=\"${qualifiedVersion}\"")
5074
writer.close()
5175
}
5276
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

org.eclipse.lsp4j.generator/src/main/java/org/eclipse/lsp4j/generator/JsonRpcDataTransformationContext.xtend

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/******************************************************************************
22
* Copyright (c) 2016 TypeFox and others.
3-
*
3+
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0 which is available at
66
* http://www.eclipse.org/legal/epl-2.0,
77
* or the Eclipse Distribution License v. 1.0 which is available at
88
* http://www.eclipse.org/org/documents/edl-v10.php.
9-
*
9+
*
1010
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
1111
******************************************************************************/
1212
package org.eclipse.lsp4j.generator
@@ -51,7 +51,9 @@ class JsonRpcDataTransformationContext implements TransformationContext {
5151
def TypeReference getRightType(TypeReference typeReference) {
5252
val type = typeReference.type
5353
if (type === eitherType.type) {
54-
return typeReference.actualTypeArguments.last
54+
// not using "return typeReference.actualTypeArguments.last"
55+
// as workaround for https://github.com/eclipse-xtext/xtext/issues/3535
56+
return org.eclipse.xtext.xbase.lib.IterableExtensions.last(typeReference.actualTypeArguments)
5557
}
5658
if (type instanceof InterfaceDeclaration) {
5759
return type.extendedInterfaces.map[rightType].filterNull.head

0 commit comments

Comments
 (0)