You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2022/01/25 03:40:55 UTC

[asterixdb] 03/13: [NO ISSUE][MISC] License plugin enhancement to aggregate overrides

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

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 7ccbf55597a8d12bc2ea74afaff7be4f2f20ab9d
Author: Michael Blow <mi...@couchbase.com>
AuthorDate: Wed Jan 19 08:10:42 2022 -0500

    [NO ISSUE][MISC] License plugin enhancement to aggregate overrides
    
    (partial cherry-pick of 5e44128bc13a93a3cadb12a87ecd691218481447)
    
    Change-Id: Ifc2c719a6dc840d2846d68d1b649e12bec9f22db
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14865
    Reviewed-by: Michael Blow <mb...@apache.org>
    Reviewed-by: Hussain Towaileb <hu...@gmail.com>
    Tested-by: Michael Blow <mb...@apache.org>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
---
 .../apache/hyracks/maven/license/LicenseMojo.java  | 42 +++++++++++++---------
 .../org/apache/hyracks/maven/license/Override.java | 10 ++++++
 2 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
index e72404c..89993fd 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
@@ -360,23 +360,31 @@ public abstract class LicenseMojo extends AbstractMojo {
 
         gatherProjectDependencies(project, dependencyLicenseMap, dependencyGavMap);
         for (Override override : overrides) {
-            String gav = override.getGav();
-            MavenProject dep = dependencyGavMap.get(gav);
-            if (dep == null) {
-                getLog().warn("Unused override dependency " + gav + "; ignoring...");
-                continue;
-            }
-            if (override.getUrl() != null) {
-                final List<Pair<String, String>> newLicense =
-                        Collections.singletonList(new ImmutablePair<>(override.getUrl(), override.getName()));
-                List<Pair<String, String>> prevLicense = dependencyLicenseMap.put(dep, newLicense);
-                warnUnlessFlag(dep, IGNORE_LICENSE_OVERRIDE, "license list for " + toGav(dep)
-                        + " changed with <override>; was: " + prevLicense + ", now: " + newLicense);
-            }
-            if (override.getNoticeUrl() != null) {
-                noticeOverrides.put(gav, override.getNoticeUrl());
-                warnUnlessFlag(dep, IGNORE_NOTICE_OVERRIDE,
-                        "notice for " + toGav(dep) + " changed with <override>; now: " + override.getNoticeUrl());
+
+            // Collect both <gav></gav> and <gavs><gav></gav><gav></gav>...</gavs>
+            List<String> gavs = override.getGavs();
+            if (override.getGav() != null) {
+                gavs.add(override.getGav());
+            }
+
+            for (String gav : gavs) {
+                MavenProject dep = dependencyGavMap.get(gav);
+                if (dep == null) {
+                    getLog().warn("Unused override dependency " + gav + "; ignoring...");
+                    continue;
+                }
+                if (override.getUrl() != null) {
+                    final List<Pair<String, String>> newLicense =
+                            Collections.singletonList(new ImmutablePair<>(override.getUrl(), override.getName()));
+                    List<Pair<String, String>> prevLicense = dependencyLicenseMap.put(dep, newLicense);
+                    warnUnlessFlag(dep, IGNORE_LICENSE_OVERRIDE, "license list for " + toGav(dep)
+                            + " changed with <override>; was: " + prevLicense + ", now: " + newLicense);
+                }
+                if (override.getNoticeUrl() != null) {
+                    noticeOverrides.put(gav, override.getNoticeUrl());
+                    warnUnlessFlag(dep, IGNORE_NOTICE_OVERRIDE,
+                            "notice for " + toGav(dep) + " changed with <override>; now: " + override.getNoticeUrl());
+                }
             }
         }
         return dependencyLicenseMap;
diff --git a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/Override.java b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/Override.java
index 0391dfb..f19df51 100644
--- a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/Override.java
+++ b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/Override.java
@@ -18,6 +18,9 @@
  */
 package org.apache.hyracks.maven.license;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class Override {
 
     @SuppressWarnings("unused") // set by Maven plugin configuration
@@ -27,6 +30,9 @@ public class Override {
     private String gav;
 
     @SuppressWarnings("unused") // set by Maven plugin configuration
+    private List<String> gavs = new ArrayList<>();
+
+    @SuppressWarnings("unused") // set by Maven plugin configuration
     private String name;
 
     @SuppressWarnings("unused") // set by Maven plugin configuration
@@ -36,6 +42,10 @@ public class Override {
         return gav;
     }
 
+    public List<String> getGavs() {
+        return gavs;
+    }
+
     public String getUrl() {
         return url;
     }