Skip to content
Open
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 .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference
version: 2
updates:
- package-ecosystem: github-actions
Expand Down
94 changes: 83 additions & 11 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax
name: Validate

on:
on: # https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows
push:
branches-ignore: # build all branches except:
- 'dependabot/**' # prevent workflow being triggered twice (once for commit to the branch and once for opening/syncing the PR)
tags-ignore: # don't build tags
tags-ignore: # don't build tags
- '**'
paths-ignore:
- '**/*.md'
Expand All @@ -18,27 +18,99 @@ on:
- '.editorconfig'
- '.git*'
- '.github/*.yml'
workflow_dispatch: # https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
workflow_dispatch:
# https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#workflow_dispatch
inputs:
debug-with-ssh:
description: "When to open an SSH session for post-build debugging:"
default: never
type: choice
options: [ always, on_failure, on_failure_or_cancelled, never ]
debug-with-ssh-only-for-actor:
description: "Restrict SSH debug session access to the GitHub user who triggered the workflow"
default: true
type: boolean


defaults:
run:
shell: bash


jobs:

###########################################################
build:
runs-on: ${{ matrix.os }}
###########################################################

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: # https://github.com/actions/runner-images#available-images
- ubuntu-latest
- macos-15-intel # Intel
- macos-latest # ARM
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 20

steps:
- name: "Show: GitHub context"
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo $GITHUB_CONTEXT


- name: "Show: environment variables"
run: env | sort


- name: Git Checkout
uses: actions/checkout@v4 # https://github.com/actions/checkout
uses: actions/checkout@v5 # https://github.com/actions/checkout


- name: Set up JDK 11 ☕
uses: actions/setup-java@v4
- name: "Install: JDK 11 ☕ for compilation/tests"
uses: actions/setup-java@v5 # https://github.com/actions/setup-java
with:
distribution: temurin
java-version: 11
distribution: 'temurin'
cache: gradle


- name: "Install: JDK 21 ☕ for running gradle"
uses: actions/setup-java@v5 # https://github.com/actions/setup-java
with:
distribution: temurin
java-version: 21
cache: gradle


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


##################################################
# Setup SSH debug session
##################################################
- name: "SSH session for debugging: check"
id: DEBUG_SSH_SESSSION_CHECK
if: always()
run: |
set -eu

when="${{ inputs.debug-with-ssh }}"

if [[ $when == "always" ]] || case "${{ job.status }}" in
success) [[ $when == "always" ]] ;;
cancelled) [[ $when == "on_failure_or_cancelled" ]] ;;
failure) [[ $when == "on_failure"* ]] ;;
esac; then
echo "start_ssh_session=true" | tee -a "$GITHUB_OUTPUT"
fi


- name: "SSH session for debugging: start"
uses: mxschmitt/action-tmate@v3 # https://github.com/mxschmitt/action-tmate
if: always() && steps.DEBUG_SSH_SESSSION_CHECK.outputs.start_ssh_session
with:
limit-access-to-actor: ${{ inputs.debug-with-ssh-only-for-actor }}
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ 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"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:7.1.0" // https://github.com/bndtools/bnd/releases
classpath "org.xtext:xtext-gradle-plugin:4.0.0" // https://github.com/xtext/xtext-gradle-plugin/releases
}
}

Expand Down Expand Up @@ -175,7 +175,7 @@ subprojects {
}

task clean(type: Delete) {
group 'Build'
description 'Deletes the local repositories'
group = 'Build'
description = 'Deletes the local repositories'
delete 'build'
}
9 changes: 9 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
org.gradle.daemon=false
org.gradle.java.installations.auto-detect=true
org.gradle.java.installations.auto-download=true

# Optionally, you can hint custom JDK locations (semicolon-separated on Windows):
# org.gradle.java.installations.paths=C:\\jdks\\jdk-11;C:\\jdks\\jdk-21

# To run Gradle itself on a specific JDK (machine-specific), prefer setting JAVA_HOME
# before invoking Gradle or use --java-home on the command line.
54 changes: 37 additions & 17 deletions gradle/java-compiler-settings.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
/******************************************************************************
* Copyright (c) 2016 TypeFox and others.
*
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
******************************************************************************/

// Use central version from gradle/versions.gradle

java {
sourceCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.toVersion(versions.java)
// Use same Java version for compilation and task launches
toolchain {
languageVersion = JavaLanguageVersion.of(versions.java as Integer)
}
}

tasks.withType(Javadoc) {
Expand All @@ -21,31 +27,40 @@ tasks.withType(Javadoc) {

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
// Ensure cross-compilation targets specified Java version
options.release = versions.java as Integer
}

// Ensure tests run on the targeted JDK (not the Gradle JVM)
tasks.withType(Test).configureEach {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(versions.java as Integer)
}
}

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 ->
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'

ProcessBuilder curl_pb = new ProcessBuilder("curl",
ProcessBuilder curl_pb = new ProcessBuilder("curl",
"--fail", "--silent", "--show-error", "--output",
"${jarfile}-signed", "--form", "file=@${jarfile}",
"--write-out", STDOUT_FORMAT,
"--write-out", STDOUT_FORMAT,
SIGNING_SERVICE);
println String.join(" ", curl_pb.command());
curl_pb.directory(new File("${project.buildDir}"));
Expand All @@ -56,26 +71,31 @@ ext.signMethod = { jarfile ->
println curl_process.text

if (curl_process.exitValue() != 0) {
throw new GradleException("Failed to run curl");
throw new GradleException("Failed to run curl");
}

ProcessBuilder mv_pb = new ProcessBuilder("mv",
ProcessBuilder mv_pb = new ProcessBuilder("mv",
"${jarfile}-signed", jarfile)
println String.join(" ", mv_pb.command());
mv_pb.directory(new File("${project.buildDir}"));
Process mv_process = mv_pb.start()
mv_process.waitFor()

if (curl_process.exitValue() != 0) {
throw new GradleException("Failed to run mv");
throw new GradleException("Failed to run mv");
}
}

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")
def projectBase = "${project.buildDir}/libs/${project.name}-${project.version}"

// Declare inputs/outputs for config-cache friendliness
inputs.property('projectBase', projectBase)

doLast {
signMethod("${projectBase}.jar")
signMethod("${projectBase}-sources.jar")
signMethod("${projectBase}-javadoc.jar")
}
}
signJar.dependsOn jar, sourcesJar, javadocJar
Expand Down
38 changes: 31 additions & 7 deletions gradle/manifest-gen.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/******************************************************************************
* Copyright (c) 2016 TypeFox and others.
*
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
******************************************************************************/
apply plugin: "biz.aQute.bnd.builder"
Expand All @@ -21,32 +21,56 @@ def qualifiedVersion = baseVersion + '.v' + buildTime
jar.bundle.bnd (
'Bundle-Version': qualifiedVersion,
'Bundle-Vendor': 'Eclipse LSP4J',
'Bundle-RequiredExecutionEnvironment': 'JavaSE-11',
'Bundle-RequiredExecutionEnvironment': "JavaSE-${versions.java}",
"-exportcontents": "org.eclipse.lsp4j.*",
"-savemanifest": "build/tmp/bnd/MANIFEST.MF",
)

// Workaround for Gradle 8 deprecation: avoid Bnd accessing Task.project at execution time
// by supplying needed Gradle Project properties via Providers to the Bnd builder.
// See: https://github.com/bndtools/bnd/issues/6346#issuecomment-2450176628
tasks.named('jar') {
// The bnd plugin contributes a 'bundle { }' configuration on Jar tasks
bundle {
properties.put('project.group', providers.provider { project.group?.toString() ?: '' })
properties.put('project.name', providers.provider { project.name })
properties.put('project.version', providers.provider { project.version?.toString() ?: '' })
properties.put('project.path', providers.provider { project.path })
properties.put('projectDir', providers.provider { project.projectDir?.absolutePath ?: '' })
properties.put('rootDir', providers.provider { project.rootDir?.absolutePath ?: '' })
properties.put('buildDir', providers.provider { project.buildDir?.absolutePath ?: '' })
}
}

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

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

task genSourcesManifest {
def projectName = project.name
def projectTitle = project.findProperty('title') ?: ''

// Declare inputs/outputs for config-cache friendliness
inputs.property('projectName', projectName)
inputs.property('projectTitle', projectTitle)
inputs.property('qualifiedVersion', qualifiedVersion)
outputs.file(sourcesManifestFile)

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 Down
4 changes: 3 additions & 1 deletion gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

version = '1.0.0-SNAPSHOT'

ext.versions = [
ext.versions = [
'java': 11,

'xtend_lib': '2.32.0',
'guava': '[32.1.2,34)',
'gson': '[2.9.1,3.0)',
Expand Down
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.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading