xijiu commented on code in PR #18299:
URL: https://github.com/apache/kafka/pull/18299#discussion_r1900038679
##########
build.gradle:
##########
@@ -1326,6 +1326,42 @@ project(':core') {
from(project(':tools:tools-api').jar) { into("libs/") }
from(project(':tools:tools-api').configurations.runtimeClasspath) {
into("libs/") }
duplicatesStrategy 'exclude'
+
+ doLast {
+ def prefixPath = "$rootDir/core/build/distributions/"
+ def bathPath = prefixPath +
"kafka_${versions.baseScala}-${project.properties['version']}"
+ def tgzPath = bathPath + '.tgz'
+ exec {
+ commandLine 'tar', 'xzf', tgzPath, '-C', prefixPath
+ }
+
+ def licenseFile = file(bathPath + '/LICENSE')
+ def libsDir = file(bathPath + '/libs')
+ def result = true
+ libsDir.eachFile { file ->
+ if (file.name.endsWith('.jar')
+ && !file.name.startsWith('kafka')
+ && !file.name.startsWith('connect')
+ && !file.name.startsWith('trogdor')) {
+
+ def isLicensePresent = false
+ licenseFile.eachLine { line ->
+ if (line.contains(file.name - '.jar')) {
+ isLicensePresent = true
+ }
+ }
+ if (!isLicensePresent) {
+ println "warning: ${file.name} is missing in the license file"
Review Comment:
@chia7712
It seems quite necessary, but the formats of these jar licenses are not
quite the same, such as:
```
jakarta.annotation-api-1.3.5
zstd-jni-1.5.6-6 see: licenses/zstd-jni-BSD-2-clause
argparse4j-0.7.0, see: licenses/argparse-MIT
```
We should extract the following strings
```
jakarta.annotation-api-1.3.5
zstd-jni-1.5.6-6
argparse4j-0.7.0
```
So if we want to extract those, the rules could be:
1. No spaces in each line
2. Contains spaces, but includes ' see:'
3. Contains spaces, but includes ', see:'
But as the subsequent modifications are made, this may be take mistakes.
Or we can establish a guideline to identify lib-licenses (such as add
specified prefix or suffix), which should be followed when modifying
`LICENSE-binary` in the future.
WDYT ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]