Skip to content

Commit

Permalink
Use JDK-11 as compile target, require JDK-17+ for running Gradle
Browse files Browse the repository at this point in the history
The bnd plugin (OSGi) requires 17 or above. The Gradle toolchain will
ensure that the compile language level is set correctly and install the
JDK if absent. This change only impacts the minimum java version to run
the build, not the library.
  • Loading branch information
ben-manes committed Nov 6, 2023
1 parent 7aab3aa commit 288361d
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 115 deletions.
27 changes: 5 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build
on:
pull_request: {}
push:
branches: [master, v2.dev, v3.dev]
branches: [master, v3.dev]
permissions: read-all

env:
Expand Down Expand Up @@ -326,7 +326,6 @@ jobs:
needs: tests
if: >
github.event_name == 'push'
&& endsWith(github.ref, github.event.repository.default_branch)
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
Expand All @@ -341,27 +340,11 @@ jobs:
lightbend.github.io:443
guava.dev:443
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK ${{ env.PUBLISH_JDK }}
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
with:
action: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
with: |
distribution: temurin
java-version: ${{ env.PUBLISH_JDK }}
attempt_limit: 3
attempt_delay: 2000
- name: Setup Gradle
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
- name: Set up Java & Gradle
uses: ./.github/actions/run-gradle
with:
action: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2
with: |
cache-read-only: false
arguments: help --no-scan
generate-job-summary: false
gradle-home-cache-cleanup: true
attempt_limit: 3
attempt_delay: 2000
java: ${{ env.JAVA_VERSION }}
arguments: --version
- name: Publish Snapshot
env:
JAVA_VERSION: ${{ env.PUBLISH_JDK }}
Expand Down
27 changes: 5 additions & 22 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: "CodeQL"

on:
push:
branches: [master]
branches: [master, v3.dev]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
Expand Down Expand Up @@ -52,28 +52,11 @@ jobs:
services.gradle.org:443
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
with:
action: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
with: |
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
attempt_limit: 3
attempt_delay: 2000
- name: Setup Gradle
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
- name: Set up Java & Gradle
uses: ./.github/actions/run-gradle
with:
action: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2
with: |
cache-read-only: false
arguments: help --no-scan
generate-job-summary: false
gradle-home-cache-cleanup: true
attempt_limit: 3
attempt_delay: 2000
java: ${{ env.JAVA_VERSION }}
arguments: --version
- name: Initialize CodeQL
uses: github/codeql-action/init@cdcdbb579706841c47f7063dda365e292e5cad7a # v2.13.4
with:
Expand Down
26 changes: 4 additions & 22 deletions .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,11 @@ jobs:
repo1.maven.org:443
services.gradle.org:443
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
- name: Set up Java & Gradle
uses: ./.github/actions/run-gradle
with:
action: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
with: |
cache: gradle
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
attempt_limit: 3
attempt_delay: 2000
- name: Setup Gradle
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
with:
action: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2
with: |
cache-read-only: false
arguments: help --no-scan
generate-job-summary: false
gradle-home-cache-cleanup: true
attempt_limit: 3
attempt_delay: 2000
java: ${{ env.JAVA_VERSION }}
arguments: --version
- name: Submit Dependency Graph
uses: mikepenz/gradle-dependency-submission@03725509c6bfb27fc9c924fbe5d38a7d3c82e1b5 # v1
with:
Expand Down
26 changes: 4 additions & 22 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,11 @@ jobs:
services.gradle.org:443
www.graalvm.org:443
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
with:
action: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
with: |
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
attempt_limit: 3
attempt_delay: 2000
- name: Setup Gradle
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
- name: Set up Java & Gradle
uses: ./.github/actions/run-gradle
with:
action: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2
with: |
cache-read-only: false
arguments: help --no-scan
generate-job-summary: false
gradle-home-cache-cleanup: true
gradle-home-cache-strict-match: true
attempt_limit: 3
attempt_delay: 2000
java: ${{ env.JAVA_VERSION }}
arguments: --version
- name: Setup Maven
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
Expand Down
25 changes: 4 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,11 @@ jobs:
disable-sudo: true
egress-policy: audit
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
- name: Set up Java & Gradle
uses: ./.github/actions/run-gradle
with:
action: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
with: |
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
attempt_limit: 3
attempt_delay: 2000
- name: Setup Gradle
uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
timeout-minutes: 5
with:
action: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2
with: |
cache-read-only: false
arguments: help --no-scan
generate-job-summary: false
gradle-home-cache-cleanup: true
attempt_limit: 3
attempt_delay: 2000
java: ${{ env.JAVA_VERSION }}
arguments: --version
- name: Releasing
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }}
Expand Down
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.0
17
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ plugins {
id("root-caffeine-conventions")
}

require(JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
"Java 17 or above is required run the build"
}

allprojects {
description = "A high performance caching library"
group = "com.github.ben-manes.caffeine"
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ asm = "9.6"
auto-value = "1.10.4"
awaitility = "4.2.0"
bcel = "6.6.1"
bnd = "6.4.0"
bnd = "7.0.0"
bouncycastle = "1.70"
cache2k = "2.6.1.Final"
caffeine = "3.1.8"
Expand Down Expand Up @@ -60,7 +60,7 @@ json-bind = "1.0"
jsoup = "1.16.2"
junit-testng = "1.0.4"
junit4 = "4.13.2"
junit5 = "5.10.0"
junit5 = "5.10.1"
kotlin = "1.9.20"
lincheck = "2.18.1"
mockito = "5.7.0"
Expand Down
1 change: 0 additions & 1 deletion gradle/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ tasks.withType<DependencyUpdatesTask> {
}
}
}
force(libs.bnd)
}
}

Expand Down
5 changes: 3 additions & 2 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
before_install:
- source "$HOME/.sdkman/bin/sdkman-init.sh"
- sdk update
- sdk install java 11.0.13-zulu
- sdk use java 11.0.13-zulu
- sdk install java 11.0.13-zulu # gradle toolchain
- sdk install java 17.0.9-zulu # gradle build
- sdk use java 17.0.9-zulu

0 comments on commit 288361d

Please sign in to comment.