Michael Blow has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/2592

Change subject: [NO ISSUE][LIC] Licensing audit / fixes
......................................................................

[NO ISSUE][LIC] Licensing audit / fixes

- Add ability to annotate supplemental model with verified assertions
- Reduce severity on certain WARNINGs to INFOs when the condition is
  matched against a verified assertion
- Fix license for slf4j-api
- Add assertions for a number of components, to correct the following warnings:

[WARNING] license list for org.slf4j:slf4j-api:1.8.0-alpha2 changed with 
supplemental model; was: [http://www.opensource.org/licenses/mit-license.php], 
now: [http://www.slf4j.org/license.html]
[WARNING] No NOTICE file found for 
com.fasterxml.jackson.core:jackson-annotations:2.8.4
[WARNING] No NOTICE file found for org.slf4j:slf4j-api:1.8.0-alpha2
[WARNING] No NOTICE file found for org.ini4j:ini4j:0.5.4
[WARNING] No NOTICE file found for io.netty:netty-all:4.1.6.Final
[WARNING] No NOTICE file found for args4j:args4j:2.33
[WARNING] No NOTICE file found for com.google.guava:guava:18.0
[WARNING] No LICENSE file found for org.slf4j:slf4j-api:1.8.0-alpha2
[WARNING] No LICENSE file found for org.ini4j:ini4j:0.5.4
[WARNING] No LICENSE file found for io.netty:netty-all:4.1.6.Final
[WARNING] No LICENSE file found for com.google.guava:guava:18.0
[WARNING] No LICENSE file found for io.reactivex:rxjava:1.3.4
[WARNING] Using license other than from within artifact: 
io.netty:netty-all:4.1.6.Final
[WARNING] Using license other than from within artifact: 
com.google.guava:guava:18.0
[WARNING] Using license other than from within artifact: org.ini4j:ini4j:0.5.4
[WARNING] Using license other than from within artifact: 
org.slf4j:slf4j-api:1.8.0-alpha2

Change-Id: I9dcd1e212827845c972827e479b7a87e9f6c22ae
---
M asterixdb/pom.xml
M asterixdb/src/main/appended-resources/supplemental-models.xml
A 
asterixdb/src/main/licenses/content/raw.githubusercontent.com_qos-ch_slf4j_v_1.8.0-alpha2_LICENSE.txt
D asterixdb/src/main/licenses/content/www.slf4j.org_license.html.txt
M 
hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/pom.xml
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
M 
hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java
M 
hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseUtil.java
A 
hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ProjectFlag.java
M hyracks-fullstack/hyracks/pom.xml
11 files changed, 232 insertions(+), 40 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/92/2592/1

diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml
index d1aed7c..6e87cf0 100644
--- a/asterixdb/pom.xml
+++ b/asterixdb/pom.xml
@@ -532,7 +532,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-plugin-plugin</artifactId>
-          <version>3.5</version>
+          <version>3.5.1</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
diff --git a/asterixdb/src/main/appended-resources/supplemental-models.xml 
b/asterixdb/src/main/appended-resources/supplemental-models.xml
index aa57859..6fdbb91 100644
--- a/asterixdb/src/main/appended-resources/supplemental-models.xml
+++ b/asterixdb/src/main/appended-resources/supplemental-models.xml
@@ -31,17 +31,17 @@
     <project>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
-      <name>SLF4J API Module</name>
-      <organization>
-        <name>QOS.ch</name>
-        <url>http://www.qos.ch</url>
-      </organization>
       <licenses>
         <license>
           <name>an MIT-style license</name>
-          <url>http://www.slf4j.org/license.html</url>
+          
<url>https://raw.githubusercontent.com/qos-ch/slf4j/v_1.8.0-alpha2/LICENSE.txt</url>
         </license>
       </licenses>
+      <properties>
+        
<license.ignoreMissingEmbeddedNotice>1.8.0-alpha2</license.ignoreMissingEmbeddedNotice>
+        
<license.ignoreMissingEmbeddedLicense>1.8.0-alpha2</license.ignoreMissingEmbeddedLicense>
+        
<license.ignoreLicenseOverride>1.8.0-alpha2</license.ignoreLicenseOverride>
+      </properties>
     </project>
   </supplement>
   <supplement>
@@ -154,4 +154,57 @@
       </licenses>
     </project>
   </supplement>
+  <supplement>
+    <project>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-all</artifactId>
+      <properties>
+        <!-- netty is ALv2, and does not contain any embedded LICENSE or 
NOTICE file -->
+        
<license.ignoreMissingEmbeddedLicense>4.1.6.Final</license.ignoreMissingEmbeddedLicense>
+        
<license.ignoreMissingEmbeddedNotice>4.1.6.Final</license.ignoreMissingEmbeddedNotice>
+      </properties>
+    </project>
+  </supplement>
+  <supplement>
+    <project>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <properties>
+        <!-- guava is ALv2, and does not contain any embedded LICENSE or 
NOTICE file -->
+        
<license.ignoreMissingEmbeddedNotice>18.0</license.ignoreMissingEmbeddedNotice>
+        
<license.ignoreMissingEmbeddedLicense>18.0</license.ignoreMissingEmbeddedLicense>
+      </properties>
+    </project>
+  </supplement>
+  <supplement>
+    <project>
+      <groupId>org.ini4j</groupId>
+      <artifactId>ini4j</artifactId>
+      <properties>
+        <!-- ini4j is ALv2, and does not contain any embedded LICENSE or 
NOTICE file -->
+        
<license.ignoreMissingEmbeddedNotice>0.5.4</license.ignoreMissingEmbeddedNotice>
+        
<license.ignoreMissingEmbeddedLicense>0.5.4</license.ignoreMissingEmbeddedLicense>
+      </properties>
+    </project>
+  </supplement>
+  <supplement>
+    <project>
+      <groupId>args4j</groupId>
+      <artifactId>args4j</artifactId>
+      <properties>
+        <!-- args4j does not provide an embedded NOTICE file -->
+        
<license.ignoreMissingEmbeddedNotice>2.33</license.ignoreMissingEmbeddedNotice>
+      </properties>
+    </project>
+  </supplement>
+  <supplement>
+    <project>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <properties>
+        <!-- jackson-annotation does not provide an embedded NOTICE file -->
+        
<license.ignoreMissingEmbeddedNotice>2.8.4</license.ignoreMissingEmbeddedNotice>
+      </properties>
+    </project>
+  </supplement>
 </supplementalDataModels>
diff --git 
a/asterixdb/src/main/licenses/content/raw.githubusercontent.com_qos-ch_slf4j_v_1.8.0-alpha2_LICENSE.txt
 
b/asterixdb/src/main/licenses/content/raw.githubusercontent.com_qos-ch_slf4j_v_1.8.0-alpha2_LICENSE.txt
new file mode 100644
index 0000000..744377c
--- /dev/null
+++ 
b/asterixdb/src/main/licenses/content/raw.githubusercontent.com_qos-ch_slf4j_v_1.8.0-alpha2_LICENSE.txt
@@ -0,0 +1,21 @@
+Copyright (c) 2004-2017 QOS.ch
+All rights reserved.
+
+Permission is hereby granted, free  of charge, to any person obtaining
+a  copy  of this  software  and  associated  documentation files  (the
+"Software"), to  deal in  the Software without  restriction, including
+without limitation  the rights to  use, copy, modify,  merge, publish,
+distribute,  sublicense, and/or sell  copies of  the Software,  and to
+permit persons to whom the Software  is furnished to do so, subject to
+the following conditions:
+
+The  above  copyright  notice  and  this permission  notice  shall  be
+included in all copies or substantial portions of the Software.
+
+THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
+EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
+MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/asterixdb/src/main/licenses/content/www.slf4j.org_license.html.txt 
b/asterixdb/src/main/licenses/content/www.slf4j.org_license.html.txt
deleted file mode 100644
index 05ee024..0000000
--- a/asterixdb/src/main/licenses/content/www.slf4j.org_license.html.txt
+++ /dev/null
@@ -1,21 +0,0 @@
- Copyright (c) 2004-2013 QOS.ch
- All rights reserved.
-
- Permission is hereby granted, free  of charge, to any person obtaining
- a  copy  of this  software  and  associated  documentation files  (the
- "Software"), to  deal in  the Software without  restriction, including
- without limitation  the rights to  use, copy, modify,  merge, publish,
- distribute,  sublicense, and/or sell  copies of  the Software,  and to
- permit persons to whom the Software  is furnished to do so, subject to
- the following conditions:
-
- The  above  copyright  notice  and  this permission  notice  shall  be
- included in all copies or substantial portions of the Software.
-
- THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
- EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
- MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git 
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/pom.xml
 
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/pom.xml
index 958d2ed..bc7e612 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/pom.xml
+++ 
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/pom.xml
@@ -95,6 +95,11 @@
       <artifactId>maven-compat</artifactId>
       <version>3.3.9</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.hyracks</groupId>
+      <artifactId>hyracks-util</artifactId>
+      <version>${project.version}</version>
+    </dependency>
   </dependencies>
 
 </project>
\ No newline at end of file
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 e8625fc..22646c5 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
@@ -18,6 +18,11 @@
  */
 package org.apache.hyracks.maven.license;
 
+import static 
org.apache.hyracks.maven.license.ProjectFlag.ALTERNATE_LICENSE_FILE;
+import static 
org.apache.hyracks.maven.license.ProjectFlag.ALTERNATE_NOTICE_FILE;
+import static 
org.apache.hyracks.maven.license.ProjectFlag.IGNORE_MISSING_EMBEDDED_LICENSE;
+import static 
org.apache.hyracks.maven.license.ProjectFlag.IGNORE_MISSING_EMBEDDED_NOTICE;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -248,7 +253,9 @@
             for (Project p : lps.getProjects()) {
                 String licenseText = p.getLicenseText();
                 if (licenseText == null) {
-                    getLog().warn("Using license other than from within 
artifact: " + p.gav());
+                    warnUnlessFlag(p.gav(), IGNORE_MISSING_EMBEDDED_LICENSE,
+                            "Using license other than from within artifact: " 
+ p.gav() + " (" + lps.getLicense()
+                                    + ")");
                     licenseText = resolveLicenseContent(lps.getLicense(), 
false);
                 }
                 LicenseSpec spec = lps.getLicense();
@@ -307,18 +314,21 @@
     }
 
     private void resolveNoticeFiles() throws MojoExecutionException, 
IOException {
-        resolveArtifactFiles("NOTICE", entry -> 
entry.getName().matches("(.*/|^)" + "NOTICE" + "(.txt)?"),
-                Project::setNoticeText,
+        // TODO(mblow): this will match *any* NOTICE[.txt] file located within 
the artifact- this seems way too liberal
+        resolveArtifactFiles("NOTICE", IGNORE_MISSING_EMBEDDED_NOTICE, 
ALTERNATE_NOTICE_FILE,
+                entry -> entry.getName().matches("(.*/|^)" + "NOTICE" + 
"(.txt)?"), Project::setNoticeText,
                 text -> stripFoundationAssertionFromNotices ? 
FOUNDATION_PATTERN.matcher(text).replaceAll("") : text);
     }
 
     private void resolveLicenseFiles() throws MojoExecutionException, 
IOException {
-        resolveArtifactFiles("LICENSE", entry -> 
entry.getName().matches("(.*/|^)" + "LICENSE" + "(.txt)?"),
-                Project::setLicenseText, UnaryOperator.identity());
+        // TODO(mblow): this will match *any* LICENSE[.txt] file located 
within the artifact- this seems way too liberal
+        resolveArtifactFiles("LICENSE", IGNORE_MISSING_EMBEDDED_LICENSE, 
ALTERNATE_LICENSE_FILE,
+                entry -> entry.getName().matches("(.*/|^)" + "LICENSE" + 
"(.txt)?"), Project::setLicenseText,
+                UnaryOperator.identity());
     }
 
-    private void resolveArtifactFiles(final String name, Predicate<JarEntry> 
filter,
-            BiConsumer<Project, String> consumer, UnaryOperator<String> 
contentTransformer)
+    private void resolveArtifactFiles(final String name, ProjectFlag 
ignoreFlag, ProjectFlag alternateFilenameFlag,
+            Predicate<JarEntry> filter, BiConsumer<Project, String> consumer, 
UnaryOperator<String> contentTransformer)
             throws MojoExecutionException, IOException {
         for (Project p : getProjects()) {
             File artifactFile = new File(p.getArtifactPath());
@@ -328,10 +338,14 @@
                 getLog().info("Skipping unknown artifact file type: " + 
artifactFile);
                 continue;
             }
+            String alternateFilename = (String) getProjectFlag(p.gav(), 
alternateFilenameFlag);
+            if (alternateFilename != null) {
+                filter = entry -> entry.getName().equals(alternateFilename);
+            }
             try (JarFile jarFile = new JarFile(artifactFile)) {
                 SortedMap<String, JarEntry> matches = 
gatherMatchingEntries(jarFile, filter);
                 if (matches.isEmpty()) {
-                    getLog().warn("No " + name + " file found for " + p.gav());
+                    warnUnlessFlag(p, ignoreFlag, "No " + name + " file found 
for " + p.gav());
                 } else {
                     if (matches.size() > 1) {
                         getLog().warn("Multiple " + name + " files found for " 
+ p.gav() + ": " + matches.keySet()
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 97afffb..4466d20 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
@@ -18,10 +18,14 @@
  */
 package org.apache.hyracks.maven.license;
 
+import static org.apache.hyracks.maven.license.LicenseUtil.toGav;
+import static 
org.apache.hyracks.maven.license.ProjectFlag.IGNORE_LICENSE_OVERRIDE;
+
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -55,6 +59,7 @@
 
 public abstract class LicenseMojo extends AbstractMojo {
 
+    private static final String VERIFIED_VERSIONS_PROP = 
"license-automation-plugin.verifiedVersions";
     @Parameter
     protected List<Override> overrides = new ArrayList<>();
 
@@ -108,6 +113,7 @@
 
     Map<String, LicenseSpec> urlToLicenseMap = new HashMap<>();
     Map<String, LicensedProjects> licenseMap = new TreeMap<>();
+    private Map<Pair<String, ProjectFlag>, Object> projectFlags = new 
HashMap<>();
 
     protected Map<String, LicensedProjects> getLicenseMap() {
         return licenseMap;
@@ -283,6 +289,7 @@
 
             Model supplement = supplementModels
                     
.get(SupplementalModelHelper.generateSupplementMapKey(depObj.getGroupId(), 
depObj.getArtifactId()));
+            registerVerified(depProj, supplement);
             if (supplement != null) {
                 Model merged = SupplementalModelHelper.mergeModels(assembler, 
depProj.getModel(), supplement);
                 Set<String> origLicenses =
@@ -290,8 +297,8 @@
                 Set<String> newLicenses =
                         
merged.getLicenses().stream().map(License::getUrl).collect(Collectors.toSet());
                 if (!origLicenses.equals(newLicenses)) {
-                    getLog().warn("license list for " + toGav(depProj) + " 
changed with supplemental model; was: "
-                            + origLicenses + ", now: " + newLicenses);
+                    warnUnlessFlag(depProj, IGNORE_LICENSE_OVERRIDE, "license 
list for " + toGav(depProj)
+                            + " changed with supplemental model; was: " + 
origLicenses + ", now: " + newLicenses);
                 }
                 depProj = new MavenProject(merged);
                 depProj.setArtifact(depObj);
@@ -303,8 +310,34 @@
         return depProj;
     }
 
-    private String toGav(MavenProject dep) {
-        return dep.getGroupId() + ":" + dep.getArtifactId() + ":" + 
dep.getVersion();
+    protected void warnUnlessFlag(MavenProject depProj, ProjectFlag flag, 
String message) {
+        warnUnlessFlag(toGav(depProj), flag, message);
+    }
+
+    protected void warnUnlessFlag(Project depProj, ProjectFlag flag, String 
message) {
+        warnUnlessFlag(depProj.gav(), flag, message);
+    }
+
+    protected void warnUnlessFlag(String gav, ProjectFlag flag, String 
message) {
+        if (projectFlags.containsKey(Pair.of(gav, flag))) {
+            getLog().info(message);
+        } else {
+            getLog().warn(message);
+        }
+    }
+
+    public Map<Pair<String, ProjectFlag>, Object> getProjectFlags() {
+        return projectFlags;
+    }
+
+    public Object getProjectFlag(String gav, ProjectFlag flag) {
+        return projectFlags.get(Pair.of(gav, flag));
+    }
+
+    private void registerVerified(MavenProject depObj, Model supplement) {
+        if (supplement != null) {
+            Arrays.stream(ProjectFlag.values()).forEach(flag -> 
flag.visit(depObj, supplement.getProperties(), this));
+        }
     }
 
     protected List<Pattern> compileExcludePatterns() {
diff --git 
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java
 
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java
index cd955d9..5ac2392 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseSpec.java
@@ -111,4 +111,7 @@
         this.displayName = displayName;
     }
 
+    public String toString() {
+        return getDisplayName() != null ? getDisplayName() : getUrl();
+    }
 }
diff --git 
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseUtil.java
 
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseUtil.java
index 5ea768e..2a34fc7 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseUtil.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/LicenseUtil.java
@@ -30,6 +30,7 @@
 
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.lang3.tuple.Pair;
+import org.apache.maven.project.MavenProject;
 
 public class LicenseUtil {
 
@@ -145,4 +146,8 @@
         }
         return new ImmutablePair<>(freeSpaces, maxLineLength);
     }
+
+    static String toGav(MavenProject dep) {
+        return dep.getGroupId() + ":" + dep.getArtifactId() + ":" + 
dep.getVersion();
+    }
 }
diff --git 
a/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ProjectFlag.java
 
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ProjectFlag.java
new file mode 100644
index 0000000..28b3bbc
--- /dev/null
+++ 
b/hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/ProjectFlag.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.hyracks.maven.license;
+
+import static org.apache.hyracks.maven.license.LicenseUtil.toGav;
+
+import java.util.Properties;
+import java.util.stream.Stream;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.hyracks.util.StringUtil;
+import org.apache.maven.project.MavenProject;
+
+enum ProjectFlag {
+    IGNORE_MISSING_EMBEDDED_LICENSE,
+    IGNORE_MISSING_EMBEDDED_NOTICE,
+    IGNORE_LICENSE_OVERRIDE,
+    ALTERNATE_LICENSE_FILE,
+    ALTERNATE_NOTICE_FILE;
+
+    String propName() {
+        return "license." + StringUtil.toCamelCase(name());
+    }
+
+    void visit(MavenProject depObj, Properties properties, LicenseMojo 
licenseMojo) {
+        String value = properties.getProperty(propName());
+        if (value == null) {
+            return;
+        }
+        switch (this) {
+            case IGNORE_MISSING_EMBEDDED_LICENSE:
+            case IGNORE_MISSING_EMBEDDED_NOTICE:
+            case IGNORE_LICENSE_OVERRIDE:
+                if (Stream.of(StringUtils.split(value, 
",")).anyMatch(depObj.getVersion()::equals)) {
+                    licenseMojo.getProjectFlags().put(Pair.of(toGav(depObj), 
this), Boolean.TRUE);
+                } else {
+                    licenseMojo.getLog().info(propName() + " defined on 
versions that *do not* match: " + value
+                            + " for " + toGav(depObj));
+                }
+                break;
+            case ALTERNATE_LICENSE_FILE:
+            case ALTERNATE_NOTICE_FILE:
+                for (String spec : StringUtils.split(value, ",")) {
+                    String[] specSplit = StringUtils.split(spec, ":");
+                    if (specSplit.length != 2) {
+                        throw new IllegalArgumentException(spec);
+                    }
+                    if (specSplit[0].equals(depObj.getVersion())) {
+                        
licenseMojo.getProjectFlags().put(Pair.of(toGav(depObj), this), specSplit[1]);
+                    }
+                }
+                break;
+            default:
+                throw new IllegalStateException("NYI: " + this);
+        }
+    }
+}
diff --git a/hyracks-fullstack/hyracks/pom.xml 
b/hyracks-fullstack/hyracks/pom.xml
index 8d6a45f..7bef19e 100644
--- a/hyracks-fullstack/hyracks/pom.xml
+++ b/hyracks-fullstack/hyracks/pom.xml
@@ -32,6 +32,11 @@
   <build>
     <pluginManagement>
       <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-plugin-plugin</artifactId>
+          <version>3.5.1</version>
+        </plugin>
         <!--This plugin's configuration is used to store Eclipse m2e settings 
only. It has no influence on the Maven build itself.-->
         <plugin>
           <groupId>org.eclipse.m2e</groupId>

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/2592
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9dcd1e212827845c972827e479b7a87e9f6c22ae
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: release-0.9.4-pre-rc
Gerrit-Owner: Michael Blow <mb...@apache.org>

Reply via email to