-
Notifications
You must be signed in to change notification settings - Fork 15.4k
MINOR: move RecordReader from org.apache.kafka.tools (client module) to org.apache.kafka.tools.api (tools-api module) #13454
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
Changes from 4 commits
7c4b22b
6c300ad
2bebeb5
b7450fd
471a559
43d34ee
64ee61c
e7aace0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -858,6 +858,7 @@ project(':core') { | |
| implementation project(':group-coordinator') | ||
| implementation project(':metadata') | ||
| implementation project(':storage:api') | ||
| implementation project(':tools:tools-api') | ||
| implementation project(':raft') | ||
| implementation project(':storage') | ||
|
|
||
|
|
@@ -1106,6 +1107,8 @@ project(':core') { | |
| from(project(':streams:test-utils').configurations.runtimeClasspath) { into("libs/") } | ||
| from(project(':streams:examples').jar) { into("libs/") } | ||
| from(project(':streams:examples').configurations.runtimeClasspath) { into("libs/") } | ||
| from(project(':tools:tools-api').jar) { into("libs/") } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This causes a resolution issue. I have opened https://issues.apache.org/jira/browse/KAFKA-19750 to fix it |
||
| from(project(':tools:tools-api').configurations.runtimeClasspath) { into("libs/") } | ||
| duplicatesStrategy 'exclude' | ||
| } | ||
|
|
||
|
|
@@ -1766,13 +1769,69 @@ project(':storage') { | |
| } | ||
| } | ||
|
|
||
| project(':tools:tools-api') { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we change the javadoc part to include the tools.api package?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added the tools.api package to javadoc (see https://github.com/apache/kafka/pull/13454/files#diff-49a96e7eea8a94af862798a45174e6ac43eb4f8b4bd40759b5da63ba31ec3ef7R1823)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The doc-related test is shown in previous comment (#13454 (comment)) |
||
| archivesBaseName = "kafka-tools-api" | ||
|
|
||
| dependencies { | ||
| implementation project(':clients') | ||
| testImplementation libs.junitJupiter | ||
| } | ||
|
|
||
| task createVersionFile() { | ||
| def receiptFile = file("$buildDir/kafka/$buildVersionFileName") | ||
| inputs.property "commitId", commitId | ||
| inputs.property "version", version | ||
| outputs.file receiptFile | ||
|
|
||
| doLast { | ||
| def data = [ | ||
| commitId: commitId, | ||
| version: version, | ||
| ] | ||
|
|
||
| receiptFile.parentFile.mkdirs() | ||
| def content = data.entrySet().collect { "$it.key=$it.value" }.sort().join("\n") | ||
| receiptFile.setText(content, "ISO-8859-1") | ||
| } | ||
| } | ||
|
|
||
| sourceSets { | ||
| main { | ||
| java { | ||
| srcDirs = ["src/main/java"] | ||
| } | ||
| } | ||
| test { | ||
| java { | ||
| srcDirs = ["src/test/java"] | ||
| } | ||
| } | ||
| } | ||
|
|
||
| jar { | ||
| dependsOn createVersionFile | ||
| from("$buildDir") { | ||
| include "kafka/$buildVersionFileName" | ||
| } | ||
| } | ||
|
|
||
| clean.doFirst { | ||
| delete "$buildDir/kafka/" | ||
| } | ||
|
|
||
| javadoc { | ||
| include "**/org/apache/kafka/tools/api/*" | ||
| } | ||
| } | ||
|
|
||
| project(':tools') { | ||
| archivesBaseName = "kafka-tools" | ||
|
|
||
| dependencies { | ||
| implementation project(':clients') | ||
| implementation project(':server-common') | ||
| implementation project(':log4j-appender') | ||
| implementation project(':tools:tools-api') | ||
| implementation libs.argparse4j | ||
| implementation libs.jacksonDatabind | ||
| implementation libs.jacksonJDK8Datatypes | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| /** | ||
| * Provides interfaces for writing plugins of kafka tools | ||
| */ | ||
| package org.apache.kafka.tools.api; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.kafka.tools.api; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import java.util.Collections; | ||
|
|
||
| public class RecordReaderTest { | ||
|
|
||
| @Test | ||
| void testDefaultCloseAndConfigure() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do we test in this unit test? There is no assertion.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make sure the default implementation of those methods don't throw exception. I will add assertDoesNotThrow to have it more readable. |
||
| RecordReader reader = inputStream -> null; | ||
| reader.configure(Collections.emptyMap()); | ||
| reader.close(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gradle can't distinguish the subproject name (gradle/gradle#847), so I add the prefix
toolsto avoid conflict tostorage:apiThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does core depend on tools-api?