This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 056a76e2b91 KAFKA-17811 Separate modules to use different JDKs (#17522)
056a76e2b91 is described below
commit 056a76e2b911ff56287da1b798703c882fb4cb3e
Author: TengYao Chi <[email protected]>
AuthorDate: Tue Nov 26 23:30:41 2024 +0800
KAFKA-17811 Separate modules to use different JDKs (#17522)
Reviewers: Chia-Ping Tsai <[email protected]>
---
.github/workflows/build.yml | 2 +-
.github/workflows/ci-complete.yml | 2 +-
build.gradle | 35 ++++++++++++----------
.../runtime/isolation/SynchronizationTest.java | 1 +
4 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0d6e76d50c2..e860073ecdd 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -145,7 +145,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- java: [ 23, 11 ] # If we change these, make sure to adjust
ci-complete.yml
+ java: [ 23, 17 ] # If we change these, make sure to adjust
ci-complete.yml
name: JUnit tests Java ${{ matrix.java }}
steps:
- name: Checkout code
diff --git a/.github/workflows/ci-complete.yml
b/.github/workflows/ci-complete.yml
index 25c96ac2d74..982eb7725e0 100644
--- a/.github/workflows/ci-complete.yml
+++ b/.github/workflows/ci-complete.yml
@@ -43,7 +43,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- java: [ 23, 11 ]
+ java: [ 23, 17 ]
artifact-prefix: [ "build-scan-test-", "build-scan-quarantined-test-"]
steps:
- name: Env
diff --git a/build.gradle b/build.gradle
index 4187f61ef8a..39ae8a26744 100644
--- a/build.gradle
+++ b/build.gradle
@@ -47,7 +47,11 @@ plugins {
ext {
gradleVersion = versions.gradle
- minJavaVersion = 11
+ minClientJavaVersion = 11
+ minNonClientJavaVersion = 17
+ // The connect:api module also belongs to the clients module, but it has
already been bumped to JDK 17 as part of KIP-1032.
+ modulesNeedingJava11 = [":clients", ":streams", ":streams:test-utils",
":streams-scala", ":test-common:test-common-runtime"]
+
buildVersionFileName = "kafka-version.properties"
defaultMaxHeapSize = "2g"
@@ -113,22 +117,24 @@ ext {
commitId = determineCommitId()
- configureJavaCompiler = { name, options ->
+ configureJavaCompiler = { name, options, projectPath ->
// -parameters generates arguments with parameter names in
TestInfo#getDisplayName.
// ref:
https://github.com/junit-team/junit5/blob/4c0dddad1b96d4a20e92a2cd583954643ac56ac0/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java#L161-L164
- if (name == "compileTestJava" || name == "compileTestScala") {
+
+ def releaseVersion = modulesNeedingJava11.any { projectPath == it } ?
minClientJavaVersion : minNonClientJavaVersion
+
+ options.compilerArgs << "-encoding" << "UTF-8"
+ options.compilerArgs += ["--release", String.valueOf(releaseVersion)]
+
+ if (name in ["compileTestJava", "compileTestScala"]) {
options.compilerArgs << "-parameters"
- options.compilerArgs += ["--release", String.valueOf(minJavaVersion)]
- } else if (name == "compileJava" || name == "compileScala") {
- options.compilerArgs << "-Xlint:all"
+ } else if (name in ["compileJava", "compileScala"]) {
if (!project.path.startsWith(":connect") &&
!project.path.startsWith(":storage"))
options.compilerArgs << "-Xlint:-rawtypes"
- options.compilerArgs << "-encoding" << "UTF-8"
- options.compilerArgs << "-Xlint:-rawtypes"
+ options.compilerArgs << "-Xlint:all"
options.compilerArgs << "-Xlint:-serial"
options.compilerArgs << "-Xlint:-try"
options.compilerArgs << "-Werror"
- options.compilerArgs += ["--release", String.valueOf(minJavaVersion)]
}
}
@@ -321,7 +327,7 @@ subprojects {
}
tasks.withType(JavaCompile) {
- configureJavaCompiler(name, options)
+ configureJavaCompiler(name, options, project.path)
}
if (shouldPublish) {
@@ -730,7 +736,7 @@ subprojects {
}
tasks.withType(ScalaCompile) {
-
+ def releaseVersion = modulesNeedingJava11.any { project.path == it } ?
minClientJavaVersion : minNonClientJavaVersion
scalaCompileOptions.keepAliveMode = userKeepAliveMode
scalaCompileOptions.additionalParameters = [
@@ -774,10 +780,9 @@ subprojects {
scalaCompileOptions.additionalParameters += ["-opt-warnings",
"-Xlint:strict-unsealed-patmat"]
// Scala 2.13.2 introduces compiler warnings suppression, which is a
pre-requisite for -Xfatal-warnings
scalaCompileOptions.additionalParameters += ["-Xfatal-warnings"]
+ scalaCompileOptions.additionalParameters += ["--release",
String.valueOf(releaseVersion)]
- scalaCompileOptions.additionalParameters += ["-release",
String.valueOf(minJavaVersion)]
-
- configureJavaCompiler(name, options)
+ configureJavaCompiler(name, options, project.path)
configure(scalaCompileOptions.forkOptions) {
memoryMaximumSize = defaultMaxHeapSize
@@ -2601,7 +2606,6 @@ project(':streams') {
// testCompileOnly prevents streams from exporting a dependency on
test-utils, which would cause a dependency cycle
testCompileOnly project(':streams:test-utils')
- testImplementation project(':metadata')
testImplementation project(':clients').sourceSets.test.output
testImplementation libs.reload4j
testImplementation libs.junitJupiter
@@ -2610,7 +2614,6 @@ project(':streams') {
testImplementation libs.mockitoCore
testImplementation libs.mockitoJunitJupiter // supports MockitoExtension
testImplementation libs.junitPlatformSuiteEngine // supports suite test
- testImplementation project(':group-coordinator')
testRuntimeOnly project(':streams:test-utils')
testRuntimeOnly runtimeTestLibs
diff --git
a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/SynchronizationTest.java
b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/SynchronizationTest.java
index 1f3d42fd3dc..70b875b21b8 100644
---
a/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/SynchronizationTest.java
+++
b/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/SynchronizationTest.java
@@ -456,6 +456,7 @@ public class SynchronizationTest {
}
}
+ @SuppressWarnings("removal")
private static ThreadFactory threadFactoryWithNamedThreads(String
threadPrefix) {
AtomicInteger threadNumber = new AtomicInteger(1);
return r -> {