Skip to content
Merged

Java21 #7784

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/workflows/benchmark-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

- name: Set up Java 17
- name: Set up Java 21
if: matrix.language == 'java'
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
if: matrix.language == 'java'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/javadoc-crawler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/owasp-dependency-check-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down Expand Up @@ -183,7 +183,7 @@ jobs:
uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0
with:
distribution: temurin
java-version: 17
java-version: 21

- name: Set up Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ automatic check once you submit a PR, but you can also sign it after opening you

## Requirements

Java 17 or higher is required to build the projects in this repository. The built artifacts can be
Java 21 or higher is required to build the projects in this repository. The built artifacts can be
used on Java 8 or higher.

## Building opentelemetry-java
Expand Down
25 changes: 0 additions & 25 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,6 @@ plugins {
id("com.diffplug.spotless") version "8.0.0"
}

if (!hasLauncherForJavaVersion(17)) {
throw GradleException(
"JDK 17 is required to build and gradle was unable to detect it on the system. " +
"Please install it and see https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection " +
"for details on how gradle detects java toolchains."
)
}

fun hasLauncherForJavaVersion(version: Int): Boolean {
return try {
javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(version) }.get()
true
} catch (e: Exception) {
false
}
}

spotless {
kotlinGradle {
ktlint().editorConfigOverride(mapOf(
Expand Down Expand Up @@ -68,11 +51,3 @@ dependencies {
implementation("org.owasp:dependency-check-gradle:12.1.8")
implementation("ru.vyarus:gradle-animalsniffer-plugin:2.0.1")
}

// We can't apply conventions to this build so include important ones such as the Java compilation
// target.
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it no longer relevant to set the java language version for the build of buildSrc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, other repos don't

}
}
4 changes: 3 additions & 1 deletion buildSrc/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tasks.withType<AbstractArchiveTask>().configureEach {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
languageVersion.set(JavaLanguageVersion.of(21))
}

withJavadocJar()
Expand Down Expand Up @@ -88,6 +88,8 @@ tasks {
"-Xlint:-processing",
// We suppress the "options" warning because it prevents compilation on modern JDKs
"-Xlint:-options",
"-Xlint:-serial",
"-Xlint:-this-escape",
Comment on lines +91 to +92
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in #7785

// Fail build on any warning
"-Werror",
),
Expand Down
3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ pluginManagement {
id("org.jsonschema2pojo") version "1.2.2"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id("org.graalvm.buildtools.native") version "0.10.6"
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
id("com.gradle.develocity")
id("org.gradle.toolchains.foojay-resolver-convention")
}

dependencyResolutionManagement {
Expand Down
Loading