From 412b0d9c97c8c70e34cdbb7e4f5ec7594b822143 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 12:45:03 +0200 Subject: [PATCH 01/11] Scope JBang cache to OS --- .github/actions/setup-gradle/action.yml | 2 +- .github/workflows/tests-code.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-gradle/action.yml b/.github/actions/setup-gradle/action.yml index 7bca5ca161be..6bae0fd79792 100644 --- a/.github/actions/setup-gradle/action.yml +++ b/.github/actions/setup-gradle/action.yml @@ -30,7 +30,7 @@ runs: id: cache-key shell: bash run: | - echo "cache_key=jbang-$(date +%Y-%m)" >> $GITHUB_OUTPUT + echo "cache_key=jbang-${{ runner.os }}-$(date +%Y-%m)" >> $GITHUB_OUTPUT - name: Cache JBang uses: actions/cache@v6 with: diff --git a/.github/workflows/tests-code.yml b/.github/workflows/tests-code.yml index 936927e3f894..14bc84bee73f 100644 --- a/.github/workflows/tests-code.yml +++ b/.github/workflows/tests-code.yml @@ -238,7 +238,7 @@ jobs: id: cache-key shell: bash run: | - echo "cache_key=jbang-madrlint-$(date +%Y-%m)" >> $GITHUB_OUTPUT + echo "cache_key=jbang-madrlint-${{ runner.os }}-$(date +%Y-%m)" >> $GITHUB_OUTPUT - name: Cache JBang # Combined cache action: restores at start and saves ~/.jbang on a # cache miss in the post-job step. A madrlint-specific key keeps this @@ -295,7 +295,7 @@ jobs: id: cache-key shell: bash run: | - echo "cache_key=jbang-heylogs-$(date +%Y-%m)" >> $GITHUB_OUTPUT + echo "cache_key=jbang-heylogs-${{ runner.os }}-$(date +%Y-%m)" >> $GITHUB_OUTPUT - name: Use cache uses: actions/cache/restore@v6 with: From e55c8297b54746e8b9bcea3bd4ea34d6fc7e8868 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 12:45:18 +0200 Subject: [PATCH 02/11] Add debug for jbang.cmd --- .github/workflows/binaries.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index e8aede75d94f..aa54b0756eca 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -632,6 +632,8 @@ jobs: javac -version which jlink jlink --version + jbang --version + where jbang.cmd || whereis jbang.cmd || echo "jbang.cmd not found" - name: Setup macOS key chain if: needs.conditions.outputs.should-build == 'true' && (startsWith(matrix.os, 'macos')) && (needs.conditions.outputs.secretspresent == 'true') From ed550c8a48afa63bb29a409915bd806f656a6129 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 13:28:33 +0200 Subject: [PATCH 03/11] Use Google Mirror --- build-logic/build.gradle.kts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 4c14e0131922..851426a4b3cd 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -3,6 +3,12 @@ plugins { } repositories { + // Workaround for Maven Central rate limiting (HTTP 429). + // gradlePluginPortal() redirects non-portal artifacts (kotlin-stdlib, ...) + // to repo.maven.apache.org, which enforces consumption limits since 2026. + // See https://central.sonatype.org/faq/429-error/ and gradle/gradle#37880. + maven { url = uri("https://maven-central.storage-download.googleapis.com/maven2/") } + gradlePluginPortal() maven { url = uri("https://jitpack.io") } } From cfbd9924f739ab631c5fffe1367316bf906bd1ee Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 13:47:06 +0200 Subject: [PATCH 04/11] Pin JBang version used by the JBang gradle tasks With the default version "latest", the dev.jbang plugin fetches version.txt from jbang.dev whenever jbang is not on the PATH -- with a 10 s timeout and no retries. A CI run already failed on exactly that. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XubvYCwnYXvmX8ZbRoBovx --- jablib/build.gradle.kts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jablib/build.gradle.kts b/jablib/build.gradle.kts index f199ae445669..7d970188daa5 100644 --- a/jablib/build.gradle.kts +++ b/jablib/build.gradle.kts @@ -100,6 +100,12 @@ tasks.generateGrammarSource { arguments = arguments + listOf("-visitor", "-long-messages") } +// Pinned instead of the default "latest": with "latest", the dev.jbang plugin fetches +// https://www.jbang.dev/releases/latest/download/version.txt (10 s timeout, no retries) on every +// PATH miss, which already made CI fail. A pinned version skips that request entirely. +// See https://github.com/jbangdev/jbang-gradle-plugin/blob/main/plugin/src/main/java/dev/jbang/gradle/tasks/JBangTask.java +val jbangVersion = "0.141.0" + val abbrvJabRefOrgDir = layout.projectDirectory.dir("src/main/abbrv.jabref.org") val generatedJournalFile = layout.buildDirectory.file("generated/resources/journals/journal-list.mv") @@ -107,6 +113,7 @@ var taskGenerateJournalListMV = tasks.register("generateJournalListMV group = "JabRef" description = "Converts the comma-separated journal abbreviation file to a H2 MVStore" dependsOn(tasks.named("generateGrammarSource")) + version = jbangVersion script = '"' + rootProject.layout.projectDirectory.file("build-support/src/main/java/JournalListMvGenerator.java").asFile.absolutePath + '"' @@ -121,6 +128,7 @@ var taskGenerateCitationStyleCatalog = tasks.register("generateCitati description = "Generates a catalog of all available citation styles" // The JBang gradle plugin doesn't handle parallization well - thus we enforce sequential execution mustRunAfter(taskGenerateJournalListMV) + version = jbangVersion script = '"' + rootProject.layout.projectDirectory.file("build-support/src/main/java/CitationStyleCatalogGenerator.java").asFile.absolutePath + '"' @@ -136,6 +144,7 @@ var taskGenerateLtwaListMV = tasks.register("generateLtwaListMV") { description = "Converts the LTWA CSV file to a H2 MVStore" // The JBang gradle plugin doesn't handle parallization well - thus we enforce sequential execution mustRunAfter(taskGenerateCitationStyleCatalog) + version = jbangVersion script = '"' + rootProject.layout.projectDirectory.file("build-support/src/main/java/LtwaListMvGenerator.java").asFile.absolutePath + '"' From 79e9828cec36ac60fafb04effbebda97015c66f2 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 13:48:10 +0200 Subject: [PATCH 05/11] Route JBang's Maven artifacts into the cached Gradle user home JBang resolves script //DEPS into ~/.m2, which no cache in this repository covers, so every job re-downloads them from Maven Central. Setting JBANG_REPO into the Gradle user home's caches/ directory reuses the cache gradle/actions/setup-gradle already maintains. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XubvYCwnYXvmX8ZbRoBovx --- .github/actions/setup-gradle/action.yml | 15 +++++++++++++++ .github/workflows/tests-code.yml | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-gradle/action.yml b/.github/actions/setup-gradle/action.yml index 6bae0fd79792..5605d630c904 100644 --- a/.github/actions/setup-gradle/action.yml +++ b/.github/actions/setup-gradle/action.yml @@ -26,6 +26,21 @@ runs: gradle-version: current env: GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: false + # JBang resolves the //DEPS of a script into the local Maven repository (~/.m2 by default), + # which nothing in this repository caches. Point it into the Gradle user home's "caches" + # directory instead - gradle/actions/setup-gradle caches that one out of the box. + # Two steps because JBang is a Java program: on Windows it needs a native path + # (C:\Users\runneradmin\...), not the Git Bash form (/c/Users/...). + - name: Set JBANG_REPO + if: runner.os != 'Windows' + shell: bash + run: echo "JBANG_REPO=${GRADLE_USER_HOME:-$HOME/.gradle}/caches/jbang-repo" >> "$GITHUB_ENV" + - name: Set JBANG_REPO (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + $gradleUserHome = if ($env:GRADLE_USER_HOME) { $env:GRADLE_USER_HOME } else { Join-Path $env:USERPROFILE '.gradle' } + "JBANG_REPO=$(Join-Path $gradleUserHome 'caches\jbang-repo')" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 - name: Generate JBang cache key id: cache-key shell: bash diff --git a/.github/workflows/tests-code.yml b/.github/workflows/tests-code.yml index 14bc84bee73f..ed7327fbb637 100644 --- a/.github/workflows/tests-code.yml +++ b/.github/workflows/tests-code.yml @@ -542,7 +542,9 @@ jobs: # unreleased changes. -PprojVersion=6.0 makes the artifact 6.0-SNAPSHOT # (the default would be 0.1.0-SNAPSHOT, which the scripts do not reference). - name: Publish jablib to the local Maven repository - run: gradle -PprojVersion=6.0 :jablib:publishToMavenLocal + # -Dmaven.repo.local: JBANG_REPO (set in setup-gradle) moves JBang's local Maven + # repository out of ~/.m2, so the snapshot has to be published there instead. + run: gradle -Dmaven.repo.local="$JBANG_REPO" -PprojVersion=6.0 :jablib:publishToMavenLocal - name: Build JBang scripts and run launchers uses: ./.github/actions/jbang-check From c9495479c5a358428634805e48d77d7663553ee2 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 13:49:20 +0200 Subject: [PATCH 06/11] Drop setup-jbang and the ~/.jbang cache from the shared gradle setup The dev.jbang gradle plugin installs JBang itself into ~/.gradle/caches/jbang, which gradle/actions/setup-gradle already caches. Installing JBang and restoring/saving a second cache in every gradle job is wasted work. The two jobs that call `jbang` from the shell (jbang-check, ghprcomment in pr-comment.yml) now set up JBang themselves. The `jbang --version` debug output in binaries.yml is removed with it. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XubvYCwnYXvmX8ZbRoBovx --- .github/actions/jbang-check/action.yml | 2 ++ .github/actions/setup-gradle/action.yml | 18 ++---------------- .github/workflows/binaries.yml | 2 -- .github/workflows/pr-comment.yml | 4 +++- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.github/actions/jbang-check/action.yml b/.github/actions/jbang-check/action.yml index 2a827686793d..6dc410252dfd 100644 --- a/.github/actions/jbang-check/action.yml +++ b/.github/actions/jbang-check/action.yml @@ -3,6 +3,8 @@ description: 'Builds all JBang scripts and verifies the launchers support --help runs: using: 'composite' steps: + - name: Setup JBang + uses: jbangdev/setup-jbang@main - name: Build .jbang scripts shell: bash run: | diff --git a/.github/actions/setup-gradle/action.yml b/.github/actions/setup-gradle/action.yml index 5605d630c904..dbf863c97d98 100644 --- a/.github/actions/setup-gradle/action.yml +++ b/.github/actions/setup-gradle/action.yml @@ -1,5 +1,5 @@ -name: Setup JDK, JBang, and gradle -description: Setup JDK, JBang and gradle +name: Setup JDK and gradle +description: Setup JDK and gradle. JBang is installed by the dev.jbang gradle plugin on demand; jobs calling `jbang` from the shell need jbangdev/setup-jbang themselves. inputs: distribution: @@ -41,17 +41,3 @@ runs: run: | $gradleUserHome = if ($env:GRADLE_USER_HOME) { $env:GRADLE_USER_HOME } else { Join-Path $env:USERPROFILE '.gradle' } "JBANG_REPO=$(Join-Path $gradleUserHome 'caches\jbang-repo')" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 - - name: Generate JBang cache key - id: cache-key - shell: bash - run: | - echo "cache_key=jbang-${{ runner.os }}-$(date +%Y-%m)" >> $GITHUB_OUTPUT - - name: Cache JBang - uses: actions/cache@v6 - with: - path: ~/.jbang - key: ${{ steps.cache-key.outputs.cache_key }} - restore-keys: - jbang- - - name: Setup JBang - uses: jbangdev/setup-jbang@main diff --git a/.github/workflows/binaries.yml b/.github/workflows/binaries.yml index aa54b0756eca..e8aede75d94f 100644 --- a/.github/workflows/binaries.yml +++ b/.github/workflows/binaries.yml @@ -632,8 +632,6 @@ jobs: javac -version which jlink jlink --version - jbang --version - where jbang.cmd || whereis jbang.cmd || echo "jbang.cmd not found" - name: Setup macOS key chain if: needs.conditions.outputs.should-build == 'true' && (startsWith(matrix.os, 'macos')) && (needs.conditions.outputs.secretspresent == 'true') diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index 0da715438bc5..98fd80cc6912 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -138,9 +138,11 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Setup JBang (included at setup-gralde) - uses: ./.github/actions/setup-gradle if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} + - name: Setup JBang + if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} + uses: jbangdev/setup-jbang@main - name: ghprcomment@main if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} From c8b266a4f5d5668eeb6ebd423c423f5db48b2857 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 14:35:03 +0200 Subject: [PATCH 07/11] Cache the JBang dependencies of the madrlint and heylogs jobs Both jobs cache ~/.jbang, but JBang resolves the script dependencies into ~/.m2, so only the built script jars were cached. JBANG_REPO moves them into the directory that is cached anyway. Also: the heylogs job used actions/cache/restore without a matching save, so its key was never written, and runner.os in the cache keys is constant for these two ubuntu-only jobs. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XubvYCwnYXvmX8ZbRoBovx --- .github/workflows/tests-code.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests-code.yml b/.github/workflows/tests-code.yml index ed7327fbb637..80c0437d95d7 100644 --- a/.github/workflows/tests-code.yml +++ b/.github/workflows/tests-code.yml @@ -238,17 +238,20 @@ jobs: id: cache-key shell: bash run: | - echo "cache_key=jbang-madrlint-${{ runner.os }}-$(date +%Y-%m)" >> $GITHUB_OUTPUT + echo "cache_key=jbang-madrlint-$(date +%Y-%m)" >> $GITHUB_OUTPUT - name: Cache JBang # Combined cache action: restores at start and saves ~/.jbang on a # cache miss in the post-job step. A madrlint-specific key keeps this - # cache separate from the shared "jbang-" cache used by setup-gradle. + # cache separate from the other JBang-using jobs. uses: actions/cache@v6 with: path: ~/.jbang key: ${{ steps.cache-key.outputs.cache_key }} restore-keys: jbang-madrlint- + - name: Resolve //DEPS into the cached directory + # JBang resolves script dependencies into ~/.m2, which is not cached here. + run: echo "JBANG_REPO=$HOME/.jbang/repository" >> "$GITHUB_ENV" - uses: actions/setup-java@v5 with: distribution: 'corretto' @@ -295,14 +298,18 @@ jobs: id: cache-key shell: bash run: | - echo "cache_key=jbang-heylogs-${{ runner.os }}-$(date +%Y-%m)" >> $GITHUB_OUTPUT - - name: Use cache - uses: actions/cache/restore@v6 + echo "cache_key=jbang-heylogs-$(date +%Y-%m)" >> $GITHUB_OUTPUT + - name: Cache JBang + # Combined cache action: the restore-only variant never wrote the key. + uses: actions/cache@v6 with: path: ~/.jbang key: ${{ steps.cache-key.outputs.cache_key }} restore-keys: jbang-heylogs- + - name: Resolve //DEPS into the cached directory + # JBang resolves script dependencies into ~/.m2, which is not cached here. + run: echo "JBANG_REPO=$HOME/.jbang/repository" >> "$GITHUB_ENV" - name: Setup JBang uses: jbangdev/setup-jbang@main - name: Lint CHANGELOG.md From 82ce8b49fb4be557c8965deba98c5ea3e3a1b67b Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 14:38:24 +0200 Subject: [PATCH 08/11] Let renovate bump the pinned JBang version The gradle manager is disabled in this configuration, and the version is a plain Kotlin val anyway, so a custom regex manager against the jbangdev/jbang releases keeps the pin from going stale. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XubvYCwnYXvmX8ZbRoBovx --- renovate.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/renovate.json b/renovate.json index 6866e0c4ce5a..267b2aed9562 100644 --- a/renovate.json +++ b/renovate.json @@ -16,6 +16,14 @@ "//DEPS ((?\\S+:\\S+):(?[^$]\\S+))(\\@\\w+)?" ], "datasourceTemplate": "maven" + }, + { + "customType": "regex", + "managerFilePatterns": ["jablib/build.gradle.kts"], + "matchStrings": ["val jbangVersion = \"(?[^\"]+)\""], + "depNameTemplate": "jbangdev/jbang", + "datasourceTemplate": "github-releases", + "extractVersionTemplate": "^v(?.+)$" } ], "packageRules": [ From c1cc4fc4572218098fd173042abf5831970bffd3 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 14:45:06 +0200 Subject: [PATCH 09/11] Cache the JBang dependencies of the remaining JBang jobs jbang-check caches ~/.jbang with a shared key, so the "JBang (PR)" job restores what "JBang (main)" wrote - both build the same scripts. The jablib snapshot is published into that repository accordingly. pr-comment does not run Gradle at all, so it no longer pulls in setup-gradle just to get a JDK; it sets up Java and JBang directly and caches ghprcomment's dependencies under its own key. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XubvYCwnYXvmX8ZbRoBovx --- .github/actions/jbang-check/action.yml | 17 +++++++++++++++++ .github/workflows/pr-comment.yml | 23 ++++++++++++++++++++++- .github/workflows/tests-code.yml | 6 +++--- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/actions/jbang-check/action.yml b/.github/actions/jbang-check/action.yml index 6dc410252dfd..4e7d7144dbb6 100644 --- a/.github/actions/jbang-check/action.yml +++ b/.github/actions/jbang-check/action.yml @@ -3,6 +3,23 @@ description: 'Builds all JBang scripts and verifies the launchers support --help runs: using: 'composite' steps: + - name: Generate JBang cache key + id: cache-key + shell: bash + run: echo "cache_key=jbang-check-$(date +%Y-%m)" >> $GITHUB_OUTPUT + - name: Cache JBang + # Shared by the "JBang (main)" and "JBang (PR)" jobs - both build the same scripts, + # so they resolve the same dependencies. A PR run restores the entry written on main. + uses: actions/cache@v6 + with: + path: ~/.jbang + key: ${{ steps.cache-key.outputs.cache_key }} + restore-keys: + jbang-check- + - name: Resolve //DEPS into the cached directory + # JBang resolves script dependencies into ~/.m2, which is not cached here. + shell: bash + run: echo "JBANG_REPO=$HOME/.jbang/repository" >> "$GITHUB_ENV" - name: Setup JBang uses: jbangdev/setup-jbang@main - name: Build .jbang scripts diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index 98fd80cc6912..c534d2c6dbdf 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -138,8 +138,29 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: ./.github/actions/setup-gradle + # No setup-gradle here: this job never runs Gradle, it only needs a JDK and JBang. + - uses: actions/setup-java@v5 if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} + with: + distribution: 'corretto' + java-version: '25' + - name: Generate JBang cache key + if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} + id: cache-key + run: echo "cache_key=jbang-ghprcomment-$(date +%Y-%m)" >> $GITHUB_OUTPUT + - name: Cache JBang + # Own key: ghprcomment pulls different dependencies than the other JBang jobs. + if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} + uses: actions/cache@v6 + with: + path: ~/.jbang + key: ${{ steps.cache-key.outputs.cache_key }} + restore-keys: + jbang-ghprcomment- + - name: Resolve //DEPS into the cached directory + # JBang resolves script dependencies into ~/.m2, which is not cached here. + if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} + run: echo "JBANG_REPO=$HOME/.jbang/repository" >> "$GITHUB_ENV" - name: Setup JBang if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} uses: jbangdev/setup-jbang@main diff --git a/.github/workflows/tests-code.yml b/.github/workflows/tests-code.yml index 80c0437d95d7..3f9f6331fba2 100644 --- a/.github/workflows/tests-code.yml +++ b/.github/workflows/tests-code.yml @@ -549,9 +549,9 @@ jobs: # unreleased changes. -PprojVersion=6.0 makes the artifact 6.0-SNAPSHOT # (the default would be 0.1.0-SNAPSHOT, which the scripts do not reference). - name: Publish jablib to the local Maven repository - # -Dmaven.repo.local: JBANG_REPO (set in setup-gradle) moves JBang's local Maven - # repository out of ~/.m2, so the snapshot has to be published there instead. - run: gradle -Dmaven.repo.local="$JBANG_REPO" -PprojVersion=6.0 :jablib:publishToMavenLocal + # -Dmaven.repo.local: the jbang-check action points JBANG_REPO at ~/.jbang/repository, + # so the snapshot has to be published there instead of into ~/.m2. + run: gradle -Dmaven.repo.local="$HOME/.jbang/repository" -PprojVersion=6.0 :jablib:publishToMavenLocal - name: Build JBang scripts and run launchers uses: ./.github/actions/jbang-check From 29fdacfa23977dd8422b6d2938c930f677b07731 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Thu, 13 Aug 2026 19:43:26 +0200 Subject: [PATCH 10/11] Move the pinned JBang version to gradle.properties versions/build.gradle.kts is a java-platform for Maven coordinates; JBang is a CLI, not a dependency, so it has no place there. gradle.properties is the central spot the build already reads project-wide settings from. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XubvYCwnYXvmX8ZbRoBovx --- gradle.properties | 7 +++++++ jablib/build.gradle.kts | 7 ++----- renovate.json | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 15912cf528f5..2a67bcbc801f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,3 +27,10 @@ org.gradle.configureondemand=false # Tweak Java Toolchains org.gradle.java.installations.auto-download=true + +# JBang used by the JBangTasks in jablib/build.gradle.kts. +# Pinned instead of the plugin default "latest": with "latest", the dev.jbang plugin fetches +# https://www.jbang.dev/releases/latest/download/version.txt (10 s timeout, no retries) on every +# PATH miss, which already made CI fail. A pinned version skips that request entirely. +# See https://github.com/jbangdev/jbang-gradle-plugin/blob/main/plugin/src/main/java/dev/jbang/gradle/tasks/JBangTask.java +jbangVersion=0.141.0 diff --git a/jablib/build.gradle.kts b/jablib/build.gradle.kts index 7d970188daa5..1c68df21b2a0 100644 --- a/jablib/build.gradle.kts +++ b/jablib/build.gradle.kts @@ -100,11 +100,8 @@ tasks.generateGrammarSource { arguments = arguments + listOf("-visitor", "-long-messages") } -// Pinned instead of the default "latest": with "latest", the dev.jbang plugin fetches -// https://www.jbang.dev/releases/latest/download/version.txt (10 s timeout, no retries) on every -// PATH miss, which already made CI fail. A pinned version skips that request entirely. -// See https://github.com/jbangdev/jbang-gradle-plugin/blob/main/plugin/src/main/java/dev/jbang/gradle/tasks/JBangTask.java -val jbangVersion = "0.141.0" +// Set in gradle.properties, which also explains why the version is pinned +val jbangVersion = providers.gradleProperty("jbangVersion").get() val abbrvJabRefOrgDir = layout.projectDirectory.dir("src/main/abbrv.jabref.org") val generatedJournalFile = layout.buildDirectory.file("generated/resources/journals/journal-list.mv") diff --git a/renovate.json b/renovate.json index 267b2aed9562..cafcebfbd24d 100644 --- a/renovate.json +++ b/renovate.json @@ -19,8 +19,8 @@ }, { "customType": "regex", - "managerFilePatterns": ["jablib/build.gradle.kts"], - "matchStrings": ["val jbangVersion = \"(?[^\"]+)\""], + "managerFilePatterns": ["gradle.properties"], + "matchStrings": ["jbangVersion=(?.+)"], "depNameTemplate": "jbangdev/jbang", "datasourceTemplate": "github-releases", "extractVersionTemplate": "^v(?.+)$" From e0c246510175f8bfbba694569f21d2f63a5f7e7e Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 13 Aug 2026 20:58:29 +0200 Subject: [PATCH 11/11] order caching, move to build gradle in versions --- .github/actions/jbang-check/action.yml | 15 ------------ .github/workflows/pr-comment.yml | 2 +- .github/workflows/tests-code.yml | 32 +++++++++++++++++++++++++- gradle.properties | 7 ------ jablib/build.gradle.kts | 4 ++-- renovate.json | 4 ++-- versions/build.gradle.kts | 5 ++++ 7 files changed, 41 insertions(+), 28 deletions(-) diff --git a/.github/actions/jbang-check/action.yml b/.github/actions/jbang-check/action.yml index 4e7d7144dbb6..3585331443a2 100644 --- a/.github/actions/jbang-check/action.yml +++ b/.github/actions/jbang-check/action.yml @@ -3,25 +3,10 @@ description: 'Builds all JBang scripts and verifies the launchers support --help runs: using: 'composite' steps: - - name: Generate JBang cache key - id: cache-key - shell: bash - run: echo "cache_key=jbang-check-$(date +%Y-%m)" >> $GITHUB_OUTPUT - - name: Cache JBang - # Shared by the "JBang (main)" and "JBang (PR)" jobs - both build the same scripts, - # so they resolve the same dependencies. A PR run restores the entry written on main. - uses: actions/cache@v6 - with: - path: ~/.jbang - key: ${{ steps.cache-key.outputs.cache_key }} - restore-keys: - jbang-check- - name: Resolve //DEPS into the cached directory # JBang resolves script dependencies into ~/.m2, which is not cached here. shell: bash run: echo "JBANG_REPO=$HOME/.jbang/repository" >> "$GITHUB_ENV" - - name: Setup JBang - uses: jbangdev/setup-jbang@main - name: Build .jbang scripts shell: bash run: | diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index c534d2c6dbdf..771563953ae7 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -163,7 +163,7 @@ jobs: run: echo "JBANG_REPO=$HOME/.jbang/repository" >> "$GITHUB_ENV" - name: Setup JBang if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} - uses: jbangdev/setup-jbang@main + uses: jbangdev/setup-jbang@2b1b465a7b75f4222b81426f23a01e013aa7b95c # v0.1.1 - name: ghprcomment@main if: ${{ github.event_name == 'workflow_dispatch' || (steps.check-label.outputs.has_label == 'false' && steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }} diff --git a/.github/workflows/tests-code.yml b/.github/workflows/tests-code.yml index 3f9f6331fba2..e1048e129b56 100644 --- a/.github/workflows/tests-code.yml +++ b/.github/workflows/tests-code.yml @@ -311,7 +311,7 @@ jobs: # JBang resolves script dependencies into ~/.m2, which is not cached here. run: echo "JBANG_REPO=$HOME/.jbang/repository" >> "$GITHUB_ENV" - name: Setup JBang - uses: jbangdev/setup-jbang@main + uses: jbangdev/setup-jbang@2b1b465a7b75f4222b81426f23a01e013aa7b95c # v0.1.1 - name: Lint CHANGELOG.md run: | # the grep is needed to filter out an error about all h2 containing a version, which is not relevant for us, because we have an "Unreleased" section @@ -529,6 +529,21 @@ jobs: with: submodules: 'false' show-progress: 'false' + - name: Generate JBang cache key + id: cache-key + shell: bash + run: echo "cache_key=jbang-check-$(date +%Y-%m)" >> $GITHUB_OUTPUT + - name: Cache JBang + # Shared by the "JBang (main)" and "JBang (PR)" jobs - both build the same scripts, + # so they resolve the same dependencies. A PR run restores the entry written on main. + uses: actions/cache@v6 + with: + path: ~/.jbang + key: ${{ steps.cache-key.outputs.cache_key }} + restore-keys: + jbang-check- + - name: Setup JBang + uses: jbangdev/setup-jbang@2b1b465a7b75f4222b81426f23a01e013aa7b95c # v0.1.1 - uses: ./.github/actions/setup-gradle - name: Build JBang scripts and run launchers uses: ./.github/actions/jbang-check @@ -544,6 +559,21 @@ jobs: with: submodules: 'true' show-progress: 'false' + - name: Generate JBang cache key + id: cache-key + shell: bash + run: echo "cache_key=jbang-check-$(date +%Y-%m)" >> $GITHUB_OUTPUT + - name: Cache JBang + # Shared by the "JBang (main)" and "JBang (PR)" jobs - both build the same scripts, + # so they resolve the same dependencies. A PR run restores the entry written on main. + uses: actions/cache@v6 + with: + path: ~/.jbang + key: ${{ steps.cache-key.outputs.cache_key }} + restore-keys: + jbang-check- + - name: Setup JBang + uses: jbangdev/setup-jbang@2b1b465a7b75f4222b81426f23a01e013aa7b95c # v0.1.1 - uses: ./.github/actions/setup-gradle # Publish jablib to the local Maven repository so the JBang scripts pick up # unreleased changes. -PprojVersion=6.0 makes the artifact 6.0-SNAPSHOT diff --git a/gradle.properties b/gradle.properties index 2a67bcbc801f..15912cf528f5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,10 +27,3 @@ org.gradle.configureondemand=false # Tweak Java Toolchains org.gradle.java.installations.auto-download=true - -# JBang used by the JBangTasks in jablib/build.gradle.kts. -# Pinned instead of the plugin default "latest": with "latest", the dev.jbang plugin fetches -# https://www.jbang.dev/releases/latest/download/version.txt (10 s timeout, no retries) on every -# PATH miss, which already made CI fail. A pinned version skips that request entirely. -# See https://github.com/jbangdev/jbang-gradle-plugin/blob/main/plugin/src/main/java/dev/jbang/gradle/tasks/JBangTask.java -jbangVersion=0.141.0 diff --git a/jablib/build.gradle.kts b/jablib/build.gradle.kts index 1c68df21b2a0..fcc0534419f8 100644 --- a/jablib/build.gradle.kts +++ b/jablib/build.gradle.kts @@ -100,8 +100,8 @@ tasks.generateGrammarSource { arguments = arguments + listOf("-visitor", "-long-messages") } -// Set in gradle.properties, which also explains why the version is pinned -val jbangVersion = providers.gradleProperty("jbangVersion").get() +evaluationDependsOn(":versions") +val jbangVersion = project(":versions").extra["jbangVersion"] as String val abbrvJabRefOrgDir = layout.projectDirectory.dir("src/main/abbrv.jabref.org") val generatedJournalFile = layout.buildDirectory.file("generated/resources/journals/journal-list.mv") diff --git a/renovate.json b/renovate.json index cafcebfbd24d..3904ff78f63f 100644 --- a/renovate.json +++ b/renovate.json @@ -19,8 +19,8 @@ }, { "customType": "regex", - "managerFilePatterns": ["gradle.properties"], - "matchStrings": ["jbangVersion=(?.+)"], + "managerFilePatterns": ["versions/build.gradle.kts"], + "matchStrings": ["val jbang = \"(?.+)\""], "depNameTemplate": "jbangdev/jbang", "datasourceTemplate": "github-releases", "extractVersionTemplate": "^v(?.+)$" diff --git a/versions/build.gradle.kts b/versions/build.gradle.kts index 2b3765b3c07c..11f8e2dfc371 100644 --- a/versions/build.gradle.kts +++ b/versions/build.gradle.kts @@ -21,6 +21,11 @@ val lucene = "10.5.0" val pdfbox = "3.0.8" +// Pinned instead of the dev.jbang plugin default "latest": a PATH miss would otherwise fetch +// https://www.jbang.dev/releases/latest/download/version.txt (10 s timeout, no retries). +val jbang = "0.141.0" +extra["jbangVersion"] = jbang + dependencies { api(platform("ai.djl:bom:0.36.0")) api(platform("dev.langchain4j:langchain4j-bom:1.18.1"))