You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mh...@apache.org on 2023/01/12 15:45:51 UTC

[asterixdb] 03/08: Merge branch 'gerrit/cheshire-cat'

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

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

commit faae0fb4a91754aea4c1cc3fe0304ea8158d68d4
Merge: b69c90dc17 023e28c15d
Author: Michael Blow <mb...@apache.org>
AuthorDate: Sun Nov 20 23:11:52 2022 -0500

    Merge branch 'gerrit/cheshire-cat'
    
    Change-Id: Id677655399af06ca4f1703a64482daf281a8c482

 .../main/licenses/templates/asterix-license.ftl    |   3 +
 .../src/main/licenses/templates/asterix-notice.ftl |   3 +
 .../src/main/licenses/templates/hyracks-notice.ftl |   3 +
 .../maven/license/DownloadLicensesMojo.java        |   2 +-
 .../hyracks/maven/license/GenerateFileMojo.java    | 117 ++++++++++++++++++---
 .../apache/hyracks/maven/license/LicenseMojo.java  |  47 ++++++---
 .../hyracks/maven/license/project/Project.java     |  12 ++-
 7 files changed, 157 insertions(+), 30 deletions(-)

diff --cc hyracks-fullstack/hyracks/hyracks-maven-plugins/license-automation-plugin/src/main/java/org/apache/hyracks/maven/license/GenerateFileMojo.java
index 347c19ad3c,6d30a691fb..8edc1b212f
--- 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
@@@ -348,45 -365,17 +370,44 @@@ public class GenerateFileMojo extends L
      }
  
      private void resolveLicenseFiles() throws MojoExecutionException, IOException {
 -        // TODO(mblow): this will match *any* LICENSE[.(txt|md)] 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|md))?"), Project::setLicenseText,
 -                UnaryOperator.identity(), !validateShadowLicenses);
 +        resolveArtifactFiles(LICENSE);
      }
  
 -    private void resolveArtifactFiles(final String name, final ProjectFlag ignoreFlag,
 -            final ProjectFlag alternateFilenameFlag, final Predicate<JarEntry> filter,
 -            final BiConsumer<Project, String> consumer, final UnaryOperator<String> contentTransformer,
 -            boolean skipShadowed) throws MojoExecutionException, IOException {
 +    private void resolveArtifactFiles(final EmbeddedArtifact artifact) throws MojoExecutionException, IOException {
 +        final String name;
 +        final ProjectFlag ignoreFlag;
 +        final ProjectFlag alternateFilenameFlag;
 +        final ProjectFlag onMultipleFlag;
 +        final Predicate<JarEntry> filter;
 +        final BiConsumer<Project, String> consumer;
 +        final UnaryOperator<String> contentTransformer;
 +
 +        switch (artifact) {
 +            case NOTICE:
 +                name = "NOTICE";
 +                ignoreFlag = IGNORE_MISSING_EMBEDDED_NOTICE;
 +                alternateFilenameFlag = ALTERNATE_NOTICE_FILE;
 +                onMultipleFlag = ON_MULTIPLE_EMBEDDED_NOTICE;
 +                // TODO(mblow): this will match *any* NOTICE[.(txt|md)] file located within the artifact-
 +                // this seems way too liberal
 +                filter = entry -> entry.getName().matches("(.*/|^)" + "NOTICE" + "(.(txt|md))?");
 +                consumer = Project::setNoticeText;
-                 contentTransformer = UnaryOperator.identity();
++                contentTransformer = getNoticeFileContentTransformer();
 +                break;
 +            case LICENSE:
 +                name = "LICENSE";
 +                ignoreFlag = IGNORE_MISSING_EMBEDDED_LICENSE;
 +                alternateFilenameFlag = ALTERNATE_LICENSE_FILE;
 +                onMultipleFlag = ON_MULTIPLE_EMBEDDED_LICENSE;
 +                // TODO(mblow): this will match *any* LICENSE[.(txt|md)] file located within the artifact-
 +                // this seems way too liberal
 +                filter = entry -> entry.getName().matches("(.*/|^)" + "LICENSE" + "(.(txt|md))?");
 +                consumer = Project::setLicenseText;
-                 contentTransformer = stripFoundationAssertionFromNotices
-                         ? text -> FOUNDATION_PATTERN.matcher(text).replaceAll("") : UnaryOperator.identity();
++                contentTransformer = UnaryOperator.identity();
 +                break;
 +            default:
 +                throw new IllegalStateException("NYI: " + artifact);
 +        }
          for (Project p : getProjects()) {
              File artifactFile = new File(p.getArtifactPath());
              if (!artifactFile.exists()) {
@@@ -394,6 -383,9 +415,9 @@@
              } else if (!artifactFile.getName().endsWith(".jar")) {
                  getLog().info("Skipping unknown artifact file type: " + artifactFile);
                  continue;
 -            } else if (skipShadowed && p.isShadowed()) {
++            } else if (!validateShadowLicenses && p.isShadowed()) {
+                 getLog().info("Skipping shadowed project: " + p.gav());
+                 continue;
              }
              String alternateFilename = (String) getProjectFlag(p.gav(), alternateFilenameFlag);
              Predicate<JarEntry> finalFilter =