This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch release-1.16
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 3157e786b386938b18e8bfbc1d462e52f0910794
Author: Chesnay Schepler <[email protected]>
AuthorDate: Wed Oct 5 13:35:44 2022 +0200

    [FLINK-29508][legal] Filter Flink dependencies later
    
    Retain information for bundled Flink dependencies and filter them later on 
where appropriate.
---
 .../tools/ci/licensecheck/NoticeFileChecker.java   | 32 +++++++++++++---------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git 
a/tools/ci/flink-ci-tools/src/main/java/org/apache/flink/tools/ci/licensecheck/NoticeFileChecker.java
 
b/tools/ci/flink-ci-tools/src/main/java/org/apache/flink/tools/ci/licensecheck/NoticeFileChecker.java
index 7eeb3e48c7f..4747899c513 100644
--- 
a/tools/ci/flink-ci-tools/src/main/java/org/apache/flink/tools/ci/licensecheck/NoticeFileChecker.java
+++ 
b/tools/ci/flink-ci-tools/src/main/java/org/apache/flink/tools/ci/licensecheck/NoticeFileChecker.java
@@ -167,13 +167,16 @@ public class NoticeFileChecker {
         Set<String> shadingModules = new 
HashSet<>(modulesWithShadedDependencies.keys());
         shadingModules.removeAll(modulesWithNoticeFile);
         for (String moduleWithoutNotice : shadingModules) {
-            LOG.error(
-                    "Module {} is missing a NOTICE file. It has shaded 
dependencies: {}",
-                    moduleWithoutNotice,
-                    
modulesWithShadedDependencies.get(moduleWithoutNotice).stream()
-                            .map(Dependency::toString)
-                            .collect(Collectors.joining("\n\t", "\n\t", "")));
-            severeIssueCount++;
+            if (modulesWithShadedDependencies.get(moduleWithoutNotice).stream()
+                    .anyMatch(dependency -> 
!dependency.getGroupId().equals("org.apache.flink"))) {
+                LOG.error(
+                        "Module {} is missing a NOTICE file. It has shaded 
dependencies: {}",
+                        moduleWithoutNotice,
+                        
modulesWithShadedDependencies.get(moduleWithoutNotice).stream()
+                                .map(Dependency::toString)
+                                .collect(Collectors.joining("\n\t", "\n\t", 
"")));
+                severeIssueCount++;
+            }
         }
         return severeIssueCount;
     }
@@ -257,7 +260,12 @@ public class NoticeFileChecker {
 
             // find all dependencies missing from NOTICE file
             Collection<Dependency> expectedDependencies =
-                    modulesWithShadedDependencies.get(moduleName);
+                    modulesWithShadedDependencies.get(moduleName).stream()
+                            .filter(
+                                    dependency ->
+                                            
!dependency.getGroupId().equals("org.apache.flink"))
+                            .collect(Collectors.toList());
+            ;
             for (Dependency expectedDependency : expectedDependencies) {
                 if (!declaredDependencies.contains(expectedDependency)) {
                     addProblem(
@@ -344,11 +352,9 @@ public class NoticeFileChecker {
                         String groupId = includeMatcher.group(1);
                         String artifactId = includeMatcher.group(2);
                         String version = includeMatcher.group(3);
-                        if (!"org.apache.flink".equals(groupId)) {
-                            result.put(
-                                    currentShadeModule,
-                                    Dependency.create(groupId, artifactId, 
version));
-                        }
+                        result.put(
+                                currentShadeModule,
+                                Dependency.create(groupId, artifactId, 
version));
                     }
                 }
                 if (line.contains("Replacing original artifact with shaded 
artifact")) {

Reply via email to