Skip to content
Permalink
Browse files
[NO ISSUE][MISC] License plugin enhancement to aggregate overrides
(partial cherry-pick of 5e44128)

Change-Id: Ifc2c719a6dc840d2846d68d1b649e12bec9f22db
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14865
Reviewed-by: Michael Blow <mblow@apache.org>
Reviewed-by: Hussain Towaileb <hussainht@gmail.com>
Tested-by: Michael Blow <mblow@apache.org>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
  • Loading branch information
mblow committed Jan 20, 2022
1 parent 725fcd2 commit 7ccbf55597a8d12bc2ea74afaff7be4f2f20ab9d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
@@ -360,23 +360,31 @@ protected Map<MavenProject, List<Pair<String, String>>> gatherDependencies() thr

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;
@@ -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
@@ -26,6 +29,9 @@ public class Override {
@SuppressWarnings("unused") // set by Maven plugin configuration
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;

@@ -36,6 +42,10 @@ public String getGav() {
return gav;
}

public List<String> getGavs() {
return gavs;
}

public String getUrl() {
return url;
}

0 comments on commit 7ccbf55

Please sign in to comment.