Michael Blow has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/2682
Change subject: [NO ISSUE][LIC] Support multiple license content roots
......................................................................
[NO ISSUE][LIC] Support multiple license content roots
Change-Id: Ic5f70c2382de0abe61e2d5767b8ce84e4b84e90a
---
M
hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
M
hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseMojo.java
2 files changed, 29 insertions(+), 4 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/82/2682/1
diff --git
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
index 475ed50..17eba93 100644
---
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
+++
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
@@ -147,7 +147,12 @@
getLog().debug("Resolving content for " + artifact.getUrl() + " ("
+ artifact.getContentFile() + ")");
File cFile = new File(artifact.getContentFile());
if (!cFile.isAbsolute()) {
- cFile = new File(licenseDirectory, artifact.getContentFile());
+ for (File directory : licenseDirectories) {
+ cFile = new File(directory, artifact.getContentFile());
+ if (cFile.exists()) {
+ break;
+ }
+ }
}
if (!cFile.exists()) {
if (!bestEffort) {
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 a94727d..2e18bbc 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
@@ -74,6 +74,9 @@
protected List<LicenseSpec> licenses = new ArrayList<>();
@Parameter
+ protected List<NoticeSpec> notices = new ArrayList<>();
+
+ @Parameter
protected Set<String> excludedScopes = new HashSet<>();
@Parameter
@@ -106,7 +109,10 @@
@Parameter(required = true)
private String location;
- @Parameter(required = true)
+ @Parameter
+ protected List<File> licenseDirectories;
+
+ @Parameter
protected File licenseDirectory;
@Parameter
@@ -122,6 +128,7 @@
private List<Pattern> excludePatterns;
Map<String, LicenseSpec> urlToLicenseMap = new HashMap<>();
+ Map<String, NoticeSpec> urlToNoticeMap = new HashMap<>();
Map<String, LicensedProjects> licenseMap = new TreeMap<>();
private Map<Pair<String, ProjectFlag>, Object> projectFlags = new
HashMap<>();
Map<String, String> noticeOverrides = new HashMap<String, String>();
@@ -133,6 +140,9 @@
}
protected void init() throws MojoExecutionException {
+ if (licenseDirectory != null) {
+ licenseDirectories.add(0, licenseDirectory);
+ }
if (warningTouchFile != null) {
warningTouchFile.getParentFile().mkdirs();
}
@@ -140,7 +150,7 @@
excludedScopes.add("system");
excludePatterns = compileExcludePatterns();
supplementModels = SupplementalModelHelper.loadSupplements(getLog(),
models);
- buildUrlLicenseMap();
+ buildUrlMaps();
}
private void interceptLogs() {
@@ -321,7 +331,7 @@
}
}
- private void buildUrlLicenseMap() throws MojoExecutionException {
+ private void buildUrlMaps() throws MojoExecutionException {
for (LicenseSpec license : licenses) {
if (urlToLicenseMap.put(license.getUrl(), license) != null) {
throw new MojoExecutionException("Duplicate URL mapping: " +
license.getUrl());
@@ -332,6 +342,16 @@
}
}
}
+ for (NoticeSpec notice : notices) {
+ if (urlToNoticeMap.put(notice.getUrl(), notice) != null) {
+ throw new MojoExecutionException("Duplicate URL mapping: " +
notice.getUrl());
+ }
+ for (String alias : notice.getAliasUrls()) {
+ if (urlToNoticeMap.put(alias, notice) != null) {
+ throw new MojoExecutionException("Duplicate URL mapping: "
+ alias);
+ }
+ }
+ }
}
protected Map<MavenProject, List<Pair<String, String>>>
gatherDependencies() throws ProjectBuildingException {
--
To view, visit https://asterix-gerrit.ics.uci.edu/2682
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5f70c2382de0abe61e2d5767b8ce84e4b84e90a
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Michael Blow <[email protected]>