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 2017/01/05 20:47:32 UTC
asterixdb git commit: Minor Improvements To License Generation Plugin
Repository: asterixdb
Updated Branches:
refs/heads/master 8a29c5f64 -> 727187ced
Minor Improvements To License Generation Plugin
- also move stax:stax overrides to supplemental-models.xml
Change-Id: I6ede22dd7e79571133033975901bdacc22d5befe
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1419
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
BAD: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/727187ce
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/727187ce
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/727187ce
Branch: refs/heads/master
Commit: 727187cede1a3aa3a283bcd8a08e0399d9fbf74e
Parents: 8a29c5f
Author: Michael Blow <mb...@apache.org>
Authored: Thu Jan 5 11:43:43 2017 -0500
Committer: Michael Blow <mb...@apache.org>
Committed: Thu Jan 5 12:46:58 2017 -0800
----------------------------------------------------------------------
.../asterix/license/ExtraLicenseFile.java | 9 +++++++
.../asterix/license/GenerateFileMojo.java | 26 ++++++++++++--------
.../org/apache/asterix/license/LicenseMojo.java | 18 +++++++++-----
asterixdb/asterix-server/pom.xml | 8 ------
.../appended-resources/supplemental-models.xml | 15 +++++++++++
5 files changed, 52 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/727187ce/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/ExtraLicenseFile.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/ExtraLicenseFile.java b/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/ExtraLicenseFile.java
index 3b3e190..6a0c163 100644
--- a/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/ExtraLicenseFile.java
+++ b/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/ExtraLicenseFile.java
@@ -23,6 +23,7 @@ import java.io.File;
public class ExtraLicenseFile {
private File file;
private String location;
+ private boolean additive = true;
public String getLocation() {
return location;
@@ -39,4 +40,12 @@ public class ExtraLicenseFile {
public void setFile(File file) {
this.file = file;
}
+
+ public boolean isAdditive() {
+ return additive;
+ }
+
+ public void setAdditive(boolean additive) {
+ this.additive = additive;
+ }
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/727187ce/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/GenerateFileMojo.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/GenerateFileMojo.java b/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/GenerateFileMojo.java
index 894b73d..179d426 100644
--- a/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/GenerateFileMojo.java
+++ b/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/GenerateFileMojo.java
@@ -96,6 +96,9 @@ public class GenerateFileMojo extends LicenseMojo {
@Parameter
protected Map<String, String> templateProperties = new HashMap<>();
+ @Parameter
+ private boolean stripFoundationAssertionFromNotices = true;
+
private SortedMap<String, SortedSet<Project>> noticeMap;
@java.lang.Override
@@ -207,7 +210,7 @@ public class GenerateFileMojo extends LicenseMojo {
}
for (Project project : projects.getProjects()) {
project.setLocation(extraLicenseFile.getLocation());
- addProject(project, projects.getLicense());
+ addProject(project, projects.getLicense(), extraLicenseFile.isAdditive());
}
}
}
@@ -271,7 +274,8 @@ public class GenerateFileMojo extends LicenseMojo {
private void resolveNoticeFiles() throws MojoExecutionException, IOException {
resolveArtifactFiles("NOTICE", entry -> entry.getName().matches("(.*/|^)" + "NOTICE" + "(.txt)?"),
- Project::setNoticeText, text -> FOUNDATION_PATTERN.matcher(text).replaceAll(""));
+ Project::setNoticeText,
+ text -> stripFoundationAssertionFromNotices ? FOUNDATION_PATTERN.matcher(text).replaceAll("") : text);
}
private void resolveLicenseFiles() throws MojoExecutionException, IOException {
@@ -287,22 +291,24 @@ public class GenerateFileMojo extends LicenseMojo {
if (!artifactFile.exists()) {
throw new MojoExecutionException("Artifact file " + artifactFile + " does not exist!");
} else if (!artifactFile.getName().endsWith(".jar")) {
- throw new MojoExecutionException("Unknown artifact file type: " + artifactFile);
+ getLog().info("Skipping unknown artifact file type: " + artifactFile);
+ continue;
}
try (JarFile jarFile = new JarFile(artifactFile)) {
SortedMap<String, JarEntry> matches = gatherMatchingEntries(jarFile,
filter);
if (matches.isEmpty()) {
getLog().warn("No " + name + " file found for " + project.gav());
- continue;
- } else if (matches.size() > 1) {
- getLog().warn("Multiple " + name + " files found for " + project.gav() + ": " + matches.keySet()
- + "; taking first");
} else {
- getLog().info(project.gav() + " has " + name + " file: " + matches.keySet());
+ if (matches.size() > 1) {
+ getLog().warn("Multiple " + name + " files found for " + project.gav() + ": " + matches.keySet()
+ + "; taking first");
+ } else {
+ getLog().info(project.gav() + " has " + name + " file: " + matches.keySet());
+ }
+ resolveContent(project, jarFile, matches.values().iterator().next(),
+ contentTransformer, consumer, name);
}
- resolveContent(project, jarFile, matches.values().iterator().next(),
- contentTransformer, consumer, name);
}
}
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/727187ce/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/LicenseMojo.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/LicenseMojo.java b/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/LicenseMojo.java
index 846c9b6..debb06f 100644
--- a/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/LicenseMojo.java
+++ b/asterixdb/asterix-maven-plugins/license-automation-plugin/src/main/java/org/apache/asterix/license/LicenseMojo.java
@@ -160,15 +160,20 @@ public abstract class LicenseMojo extends AbstractMojo {
}
}
File path = new File(localRepository.getBasedir(), localRepository.pathOf(depProject.getArtifact()));
- addProject(new Project(depProject, depLocation, path), new LicenseSpec(licenseUrl, displayName));
+ addProject(new Project(depProject, depLocation, path), new LicenseSpec(licenseUrl, displayName), true);
}
- protected void addProject(Project project, LicenseSpec licenseSpecNew) {
- String licenseUrl = licenseSpecNew.getUrl();
+ protected void addProject(Project project, LicenseSpec spec, boolean additive) {
+ String licenseUrl = spec.getUrl();
LicenseSpec license = urlToLicenseMap.get(licenseUrl);
if (license == null) {
- license = licenseSpecNew;
+ license = spec;
urlToLicenseMap.put(licenseUrl, license);
+ for (String alias : license.getAliasUrls()) {
+ if (!urlToLicenseMap.containsKey(alias)) {
+ urlToLicenseMap.put(alias ,license);
+ }
+ }
}
licenseUrl = license.getUrl();
LicensedProjects entry = licenseMap.get(licenseUrl);
@@ -176,7 +181,9 @@ public abstract class LicenseMojo extends AbstractMojo {
entry = new LicensedProjects(license);
licenseMap.put(licenseUrl, entry);
}
- entry.addProject(project);
+ if (additive || entry.getProjects().contains(project)) {
+ entry.addProject(project);
+ }
}
private void buildUrlLicenseMap() throws MojoExecutionException {
@@ -188,7 +195,6 @@ public abstract class LicenseMojo extends AbstractMojo {
if (urlToLicenseMap.put(alias ,license) != null) {
throw new MojoExecutionException("Duplicate URL mapping: " + alias);
}
-
}
}
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/727187ce/asterixdb/asterix-server/pom.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml
index 1f8c79c..1049088 100644
--- a/asterixdb/asterix-server/pom.xml
+++ b/asterixdb/asterix-server/pom.xml
@@ -82,14 +82,6 @@
</models>
<overrides>
<override>
- <gav>stax:stax:1.1.1-dev</gav>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- </override>
- <override>
- <gav>stax:stax:1.2.0</gav>
- <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
- </override>
- <override>
<gav>org.tukaani:xz:1.0</gav>
<url>PUBLIC_DOMAIN</url>
</override>
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/727187ce/asterixdb/src/main/appended-resources/supplemental-models.xml
----------------------------------------------------------------------
diff --git a/asterixdb/src/main/appended-resources/supplemental-models.xml b/asterixdb/src/main/appended-resources/supplemental-models.xml
index 10d7290..93a0740 100644
--- a/asterixdb/src/main/appended-resources/supplemental-models.xml
+++ b/asterixdb/src/main/appended-resources/supplemental-models.xml
@@ -162,6 +162,21 @@
</supplement>
<supplement>
<project>
+ <groupId>stax</groupId>
+ <artifactId>stax</artifactId>
+ <licenses>
+ <license>
+ <name>The Apache Software License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+ <properties>
+ <verifiedVersions>1.1.1-dev,1.2.0</verifiedVersions>
+ </properties>
+ </project>
+ </supplement>
+ <supplement>
+ <project>
<groupId>wss4j</groupId>
<artifactId>wss4j</artifactId>
<name>Apache WSS4J</name>