Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-17811: Separate modules to use different JDKs #17522

Open
wants to merge 16 commits into
base: trunk
Choose a base branch
from

Conversation

frankvicky
Copy link
Contributor

JIRA: KAFKA-17811

This is sub-task to drop broker and tools support for Java 11.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@github-actions github-actions bot added build Gradle build or GitHub Actions small Small PRs labels Oct 17, 2024
@frankvicky frankvicky marked this pull request as ready for review October 19, 2024 15:14
Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@frankvicky thanks for this patch

@@ -128,7 +135,11 @@ ext {
options.compilerArgs << "-Xlint:-serial"
options.compilerArgs << "-Xlint:-try"
options.compilerArgs << "-Werror"
options.compilerArgs += ["--release", String.valueOf(minJavaVersion)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add minClientJavaVersion and minServerJavaVersion?

build.gradle Outdated
@@ -116,6 +116,13 @@ ext {
configureJavaCompiler = { name, options ->
// -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

def modulesNeedingJava17 = [
":core", ":coordinator-common", ":generator", ":group-coordinator",
Copy link
Contributor

Choose a reason for hiding this comment

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

connect:runtime, connect:mirror, connect:test-plugins, and ``connect:file` should use JDK 17 as well

options.compilerArgs += ["--release", String.valueOf(17)]
} else {
options.compilerArgs += ["--release", String.valueOf(minJavaVersion)]
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

please update scala module as well

build.gradle Outdated
":metadata", ":raft", ":server", ":server-common", ":share", ":storage",
":share-coordinator", ":test-common", ":tools", ":transaction-coordinator"
]

if (name == "compileTestJava" || name == "compileTestScala") {
options.compilerArgs << "-parameters"
options.compilerArgs += ["--release", String.valueOf(minJavaVersion)]
Copy link
Contributor

Choose a reason for hiding this comment

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

this need to be updated too.


scalaCompileOptions.additionalParameters += ["-release", String.valueOf(minJavaVersion)]
Copy link
Contributor

Choose a reason for hiding this comment

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

streams-scala and streams:test-utils need java 11

@@ -47,7 +47,8 @@ plugins {

ext {
gradleVersion = versions.gradle
minJavaVersion = 11
minClientJavaVersion = 11
minServerJavaVersion = 17
buildVersionFileName = "kafka-version.properties"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please move modulesNeedingJava11 up to line#52?

modulesNeedingJava11 = [":clients", ":streams", ":streams:test-utils", ":streams-scala"]

build.gradle Outdated
// -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 = isModuleNeedJava11(projectPath) ? minClientJavaVersion : minServerJavaVersion
Copy link
Contributor

Choose a reason for hiding this comment

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

def releaseVersion = modulesNeedingJava11.any { projectPath == it } ? minClientJavaVersion : minServerJavaVersion

build.gradle Outdated
@@ -726,7 +734,9 @@ subprojects {
}

tasks.withType(ScalaCompile) {

def modulesNeedingJava11 = [":clients", ":streams", ":streams:test-utils", ":streams-scala"]
def releaseVersion = modulesNeedingJava11.any { project.path.equals(it) } ?
Copy link
Contributor

Choose a reason for hiding this comment

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

    def releaseVersion = modulesNeedingJava11.any { project.path == it } ? minClientJavaVersion : minServerJavaVersion

@frankvicky
Copy link
Contributor Author

Hi @chia7712
I have updated the PR, PTAL

build.gradle Outdated
@@ -47,7 +47,10 @@ plugins {

ext {
gradleVersion = versions.gradle
minJavaVersion = 11
minClientJavaVersion = 11
minServerJavaVersion = 17
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be more accurate to say minNonClientJavaVersion as this includes things like tools and other such modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

minNonClientJavaVersion looks good to me. Additionally, the connect:api module belongs to client APIs, but in KIP-1032 we decided to bump the Connect module to JDK 17. Could you please add a comment for the Connect module?

Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@frankvicky could you please check the version of jars on your local?

@frankvicky
Copy link
Contributor Author

Hi @chia7712
Following is the java version of Consumer.class and BrokerFeatures.class
Screenshot from 2024-11-24 21-11-53
Screenshot from 2024-11-24 21-10-07

@chia7712
Copy link
Contributor

@frankvicky Could you please use @SuppressWarnings("removal") to fix the warnings?

> Task :connect:runtime:compileTestJava
/home/chia7712/project/kafka/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/SynchronizationTest.java:464: warning: [removal] SecurityManager in java.lang has been deprecated and marked for removal
            SecurityManager s = System.getSecurityManager();
            ^
/home/chia7712/project/kafka/connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/SynchronizationTest.java:464: warning: [removal] getSecurityManager() in System has been deprecated and marked for removal
            SecurityManager s = System.getSecurityManager();
                                      ^
2 warnings

@frankvicky
Copy link
Contributor Author

Hi @chia7712
I have suppressed the removal warning, PTAL 😄

@chia7712
Copy link
Contributor

@frankvicky Could you please update CI file to use JDK 17 and 23

https://github.com/apache/kafka/blob/trunk/.github/workflows/build.yml#L148

@chia7712
Copy link
Contributor

https://github.com/apache/kafka/blob/trunk/build.gradle#L1872

@frankvicky please remove the testRuntimeOnly runtimeTestLibs and add

    libs.slf4jReload4j
    libs.junitPlatformLanucher

@@ -1869,7 +1874,8 @@ project(':clients') {

testRuntimeOnly libs.jacksonDatabind
testRuntimeOnly libs.jacksonJDK8Datatypes
testRuntimeOnly runtimeTestLibs
testRuntimeOnly libs.slf4jReload4j
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please apply this approach on streams module too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have applied to 4 modules which need JDK 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Gradle build or GitHub Actions ci-approved connect small Small PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants