Skip to content
Draft
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
12 changes: 8 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
url = "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:6.4.0"
classpath "org.xtext:xtext-gradle-plugin:4.0.0"
}
}

plugins {
id "biz.aQute.bnd.builder" version "7.2.1" apply false
}

ext.buildTime = DateTimeFormatter.ofPattern('yyyyMMdd-HHmm').format(LocalDateTime.now())

apply from: "${rootDir}/gradle/versions.gradle"
Expand All @@ -41,6 +44,7 @@ subprojects {
apply plugin: 'org.xtext.xtend'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'biz.aQute.bnd.builder'

apply from: "${rootDir}/gradle/java-compiler-settings.gradle"
apply from: "${rootDir}/gradle/xtend-compiler-settings.gradle"
Expand Down Expand Up @@ -186,7 +190,7 @@ subprojects {
}

task clean(type: Delete) {
group 'Build'
description 'Deletes the local repositories'
group = 'Build'
description = 'Deletes the local repositories'
delete 'build'
}
33 changes: 19 additions & 14 deletions gradle/java-compiler-settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ tasks.withType(JavaCompile) {
}

task sourcesJar(type: Jar, dependsOn: classes) {
group 'Build'
description 'Assembles a jar archive containing the sources.'
group = 'Build'
description = 'Assembles a jar archive containing the sources.'
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
group 'Build'
description 'Assembles a jar archive containing the JavaDoc output.'
group = 'Build'
description = 'Assembles a jar archive containing the JavaDoc output.'
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

ext.signMethod = { jarfile ->
ext.signMethod = { jarfile, buildDir ->
println "Signing $jarfile"
def SIGNING_SERVICE = 'https://cbi.eclipse.org/jarsigner/sign'
def STDOUT_FORMAT = ' %{size_upload} bytes uploaded, %{size_download} bytes downloaded (%{time_total} s)\\n'
Expand All @@ -74,7 +74,7 @@ ext.signMethod = { jarfile ->
"--write-out", STDOUT_FORMAT,
SIGNING_SERVICE);
println String.join(" ", curl_pb.command());
curl_pb.directory(new File("${project.buildDir}"));
curl_pb.directory(new File("${buildDir}"));
Process curl_process = curl_pb.start()
curl_process.waitFor()

Expand All @@ -88,7 +88,7 @@ ext.signMethod = { jarfile ->
ProcessBuilder mv_pb = new ProcessBuilder("mv",
"${jarfile}-signed", jarfile)
println String.join(" ", mv_pb.command());
mv_pb.directory(new File("${project.buildDir}"));
mv_pb.directory(new File("${buildDir}"));
Process mv_process = mv_pb.start()
mv_process.waitFor()

Expand All @@ -97,16 +97,21 @@ ext.signMethod = { jarfile ->
}
}

task signJar(description: 'Sign JARs with Eclipse Signing Service', group: 'Build'){
doLast {
signMethod("${project.buildDir}/libs/${project.name}-${project.version}.jar")
signMethod("${project.buildDir}/libs/${project.name}-${project.version}-sources.jar")
signMethod("${project.buildDir}/libs/${project.name}-${project.version}-javadoc.jar")
tasks.register('signJar') {
description = 'Sign JARs with Eclipse Signing Service'
group = 'Build'
def buildDir = project.buildDir
def projectName = project.name
def projectVersion = project.version
dependsOn jar, sourcesJar, javadocJar
doLast {
signMethod("${buildDir}/libs/${projectName}-${projectVersion}.jar", buildDir)
signMethod("${buildDir}/libs/${projectName}-${projectVersion}-sources.jar", buildDir)
signMethod("${buildDir}/libs/${projectName}-${projectVersion}-javadoc.jar", buildDir)
}
}
signJar.dependsOn jar, sourcesJar, javadocJar

artifacts.archives sourcesJar, javadocJar


if (findProperty('ignoreTestFailures') == 'true') {
tasks.withType(Test) {
Expand Down
38 changes: 22 additions & 16 deletions gradle/manifest-gen.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,48 @@
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
******************************************************************************/
apply plugin: "biz.aQute.bnd.builder"

def baseVersion = project.version
if (baseVersion.endsWith('-SNAPSHOT'))
baseVersion = baseVersion.substring(0, baseVersion.length() - 9)
else if (baseVersion.split('\\.').length == 4)
baseVersion = baseVersion.substring(0, baseVersion.lastIndexOf('.'))
def qualifiedVersion = baseVersion + '.v' + buildTime

jar.bundle.bnd (
'Bundle-Version': qualifiedVersion,
'Bundle-Vendor': 'Eclipse LSP4J',
'Bundle-RequiredExecutionEnvironment': "JavaSE-${versions.java}",
"-exportcontents": "org.eclipse.lsp4j.*",
"-savemanifest": "build/tmp/bnd/MANIFEST.MF",
)
tasks.named('jar') {
bundle {
bnd(
'Bundle-Version': qualifiedVersion,
'Bundle-Vendor': 'Eclipse LSP4J',
'Bundle-RequiredExecutionEnvironment': "JavaSE-${versions.java}",
"-exportcontents": "org.eclipse.lsp4j.*",
"-savemanifest": "build/tmp/bnd/MANIFEST.MF",
)
}
}

//------------------------------------------------------
// Generate a manifest for the source bundle

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

task genSourcesManifest {
tasks.register('genSourcesManifest') {
outputs.file(sourcesManifestFile)
def projectName = project.name
def projectTitle = project.hasProperty('title') ? project.title : null
doLast {
def f = new File(sourcesManifestFile)
f.parentFile.mkdirs()
def writer = new PrintWriter(f)
writer.println("Manifest-Version: 1.0")
writer.println("Bundle-ManifestVersion: 2")
writer.println("Bundle-SymbolicName: ${project.name}.source")
writer.println("Bundle-SymbolicName: ${projectName}.source")
writer.println("Bundle-Version: ${qualifiedVersion}")
if (project.hasProperty('title'))
writer.println("Bundle-Name: ${project.title} Sources")
if (projectTitle)
writer.println("Bundle-Name: ${projectTitle} Sources")
else
writer.println("Bundle-Name: Sources")
writer.println("Bundle-Vendor: Eclipse LSP4J")
writer.println("Eclipse-SourceBundle: ${project.name};version=\"${qualifiedVersion}\"")
writer.println("Eclipse-SourceBundle: ${projectName};version=\"${qualifiedVersion}\"")
writer.close()
}
}
Expand All @@ -62,10 +66,12 @@ sourcesJar {
//------------------------------------------------------
// Task to copy the generated manifest into the project

task eclipseManifest(type: Copy) {
tasks.register('eclipseManifest', Copy) {
dependsOn(jar)
from "$buildDir/tmp/bnd/MANIFEST.MF"
into 'META-INF'
}

tasks['eclipse'].dependsOn(eclipseManifest)
tasks.named('eclipse') {
dependsOn('eclipseManifest')
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
10 changes: 7 additions & 3 deletions org.eclipse.lsp4j.debug/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ dependencies {
testImplementation "com.tngtech.archunit:archunit:$versions.archunit"
}

jar.bundle.bnd (
'Import-Package': "com.google.gson.*;version=\"$versions.gson\",*",
)
tasks.named('jar') {
bundle {
bnd(
'Import-Package': "com.google.gson.*;version=\"$versions.gson\",*"
)
}
}
10 changes: 7 additions & 3 deletions org.eclipse.lsp4j.generator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ dependencies {
api "org.eclipse.xtend:org.eclipse.xtend.lib:$versions.xtend_lib"
}

jar.bundle.bnd (
'Import-Package': "com.google.common.*;version=\"$versions.guava\",com.google.gson.*;version=\"$versions.gson\",*"
)
tasks.named('jar') {
bundle {
bnd(
'Import-Package': "com.google.common.*;version=\"$versions.guava\",com.google.gson.*;version=\"$versions.gson\",*"
)
}
}
10 changes: 7 additions & 3 deletions org.eclipse.lsp4j.jsonrpc.debug/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ dependencies {
testImplementation "junit:junit:$versions.junit"
}

jar.bundle.bnd(
'Import-Package': "com.google.gson.*;version=\"$versions.gson\",*"
)
tasks.named('jar') {
bundle {
bnd(
'Import-Package': "com.google.gson.*;version=\"$versions.gson\",*"
)
}
}

10 changes: 7 additions & 3 deletions org.eclipse.lsp4j.jsonrpc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ dependencies {
testImplementation "junit:junit:$versions.junit"
}

jar.bundle.bnd(
'Import-Package': "com.google.gson.*;version=\"$versions.gson\",*"
)
tasks.named('jar') {
bundle {
bnd(
'Import-Package': "com.google.gson.*;version=\"$versions.gson\",*"
)
}
}

// Add, for example, -PjmhIncludes=StreamMessageProducerBenchmark, to command line
// to only run that one benchmark
Expand Down
10 changes: 7 additions & 3 deletions org.eclipse.lsp4j.websocket.jakarta/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ dependencies {
testImplementation "junit:junit:$versions.junit"
}

jar.bundle.bnd (
'Import-Package': '*'
)
tasks.named('jar') {
bundle {
bnd(
'Import-Package': '*'
)
}
}
10 changes: 7 additions & 3 deletions org.eclipse.lsp4j/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ dependencies {
testImplementation "com.tngtech.archunit:archunit:$versions.archunit"
}

jar.bundle.bnd (
'Import-Package': "com.google.gson.*;version=\"$versions.gson\",*"
)
tasks.named('jar') {
bundle {
bnd(
'Import-Package': "com.google.gson.*;version=\"$versions.gson\",*"
)
}
}
Loading