guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

84/110: gnu: Add maven-enforcer-api.


From: guix-commits
Subject: 84/110: gnu: Add maven-enforcer-api.
Date: Thu, 16 Jul 2020 22:23:35 -0400 (EDT)

roptat pushed a commit to branch master
in repository guix.

commit c3951015d79ce7410fbd66d889acc88be9192d32
Author: Julien Lepiller <julien@lepiller.eu>
AuthorDate: Sat Jun 27 17:25:52 2020 +0200

    gnu: Add maven-enforcer-api.
    
    * gnu/packages/maven.scm (maven-enforcer-api): New variable.
    * gnu/packages/patches/maven-enforcer-api-fix-old-dependencies.patch: New
    file.
    * gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                       |   1 +
 gnu/packages/maven.scm                             |  50 ++++++
 .../maven-enforcer-api-fix-old-dependencies.patch  | 177 +++++++++++++++++++++
 3 files changed, 228 insertions(+)

diff --git a/gnu/local.mk b/gnu/local.mk
index 6775618..b174cde 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1279,6 +1279,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/mars-install.patch                      \
   %D%/packages/patches/mars-sfml-2.3.patch                     \
   %D%/packages/patches/maxima-defsystem-mkdir.patch            \
+  %D%/packages/patches/maven-enforcer-api-fix-old-dependencies.patch   \
   %D%/packages/patches/maven-generate-component-xml.patch              \
   %D%/packages/patches/maven-generate-javax-inject-named.patch         \
   %D%/packages/patches/mcrypt-CVE-2012-4409.patch                      \
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index bca499d..fb0cb9e 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -2655,3 +2655,53 @@ Maven project dependencies.")
     (description "This package provides a tree-based API for resolution of
 Maven project dependencies.")
     (license license:asl2.0)))
+
+(define-public maven-enforcer-api
+  (package
+    (name "maven-enforcer-api")
+    (version "3.0.0-M3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://apache/maven/enforcer/"
+                                  "enforcer-" version "-source-release.zip"))
+              (sha256
+               (base32
+                "014cwj0dqa69nnlzcin8pk9wsjmmg71vsbcpb16cibcjpm6h9wjg"))
+              (patches
+                (search-patches 
"maven-enforcer-api-fix-old-dependencies.patch"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:jar-name "maven-enforcer-api.jar"
+       #:source-dir "enforcer-api/src/main/java"
+       #:tests? #f; no tests
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'install
+           (install-from-pom "enforcer-api/pom.xml")))))
+    (propagated-inputs
+     `(("maven-plugin-api" ,maven-plugin-api)
+       ("java-plexus-container-default" ,java-plexus-container-default)
+       ("java-jsr305" ,java-jsr305)
+       ("maven-enforcer-parent-pom" ,maven-enforcer-parent-pom)))
+    (native-inputs
+     `(("unzip" ,unzip)))
+    (home-page "https://maven.apache.org/shared/maven-dependency-tree";)
+    (synopsis "Tree-based API for resolution of Maven project dependencies")
+    (description "This package provides a tree-based API for resolution of
+Maven project dependencies.")
+    (license license:asl2.0)))
+
+(define maven-enforcer-parent-pom
+  (package
+    (inherit maven-enforcer-api)
+    (name "maven-enforcer-parent-pom")
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (install-pom-file "pom.xml")))))
+    (propagated-inputs
+     `(("maven-parent-pom" ,maven-parent-pom-30)))))
diff --git a/gnu/packages/patches/maven-enforcer-api-fix-old-dependencies.patch 
b/gnu/packages/patches/maven-enforcer-api-fix-old-dependencies.patch
new file mode 100644
index 0000000..98a0c8a
--- /dev/null
+++ b/gnu/packages/patches/maven-enforcer-api-fix-old-dependencies.patch
@@ -0,0 +1,177 @@
+From eccc46eaf7903a8e837813795498b12c078faaea Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Wed, 11 Mar 2020 21:53:32 +0100
+Subject: [PATCH] Fix old dependencies
+
+---
+ .../enforcer/AbstractBanDependencies.java     |  2 +-
+ .../enforcer/BanTransitiveDependencies.java   |  2 +-
+ .../enforcer/DependencyConvergence.java       | 17 ++++++++---------
+ .../enforcer/RequireUpperBoundDeps.java       | 19 +++++++++----------
+ .../enforcer/utils/DependencyVersionMap.java  |  6 +++---
+ 5 files changed, 22 insertions(+), 24 deletions(-)
+
+diff --git 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
+index 2888a61..2b944b7 100644
+--- 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
++++ 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
+@@ -119,7 +119,7 @@ public abstract class AbstractBanDependencies
+         Set<Artifact> dependencies = null;
+         try
+         {
+-            DependencyNode node = graphBuilder.buildDependencyGraph( project, 
null );
++            DependencyNode node = graphBuilder.buildDependencyGraph( 
project.getProjectBuildingRequest(), null );
+             if ( searchTransitive )
+             {
+                 dependencies = ArtifactUtils.getAllDescendants( node );
+diff --git 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java
 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java
+index 6e1dcd4..1b964ba 100644
+--- 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java
++++ 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java
+@@ -158,7 +158,7 @@ public class BanTransitiveDependencies
+         try
+         {
+             MavenProject project = (MavenProject) helper.evaluate( 
"${project}" );
+-            rootNode = createDependencyGraphBuilder().buildDependencyGraph( 
project, null );
++            rootNode = createDependencyGraphBuilder().buildDependencyGraph( 
project.getProjectBuildingRequest(), null );
+         }
+         catch ( Exception e )
+         {
+diff --git 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
+index 684f984..ca7ad3a 100644
+--- 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
++++ 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java
+@@ -35,9 +35,9 @@ import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+ import org.apache.maven.plugin.logging.Log;
+ import org.apache.maven.plugins.enforcer.utils.DependencyVersionMap;
+ import org.apache.maven.project.MavenProject;
+-import org.apache.maven.shared.dependency.tree.DependencyNode;
+-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
+-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
++import org.apache.maven.shared.dependency.graph.DependencyNode;
++import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
++import 
org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException;
+ import 
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+ import 
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+ 
+@@ -60,7 +60,7 @@ public class DependencyConvergence
+     // CHECKSTYLE_OFF: LineLength
+     /**
+      * Uses the {@link EnforcerRuleHelper} to populate the values of the
+-     * {@link DependencyTreeBuilder#buildDependencyTree(MavenProject, 
ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, 
ArtifactCollector)}
++     * {@link DependencyGraphBuilder#buildDependencyTree(MavenProject, 
ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, 
ArtifactCollector)}
+      * factory method. <br/>
+      * This method simply exists to hide all the ugly lookup that the {@link 
EnforcerRuleHelper} has to do.
+      * 
+@@ -75,16 +75,15 @@ public class DependencyConvergence
+         try
+         {
+             MavenProject project = (MavenProject) helper.evaluate( 
"${project}" );
+-            DependencyTreeBuilder dependencyTreeBuilder =
+-                (DependencyTreeBuilder) helper.getComponent( 
DependencyTreeBuilder.class );
++            DependencyGraphBuilder dependencyTreeBuilder =
++                (DependencyGraphBuilder) helper.getComponent( 
DependencyGraphBuilder.class );
+             ArtifactRepository repository = (ArtifactRepository) 
helper.evaluate( "${localRepository}" );
+             ArtifactFactory factory = (ArtifactFactory) helper.getComponent( 
ArtifactFactory.class );
+             ArtifactMetadataSource metadataSource =
+                 (ArtifactMetadataSource) helper.getComponent( 
ArtifactMetadataSource.class );
+             ArtifactCollector collector = (ArtifactCollector) 
helper.getComponent( ArtifactCollector.class );
+             ArtifactFilter filter = null; // we need to evaluate all scopes
+-            DependencyNode node = dependencyTreeBuilder.buildDependencyTree( 
project, repository, factory,
+-                                                                             
metadataSource, filter, collector );
++            DependencyNode node = dependencyTreeBuilder.buildDependencyGraph( 
project.getProjectBuildingRequest(), filter);
+             return node;
+         }
+         catch ( ExpressionEvaluationException e )
+@@ -95,7 +94,7 @@ public class DependencyConvergence
+         {
+             throw new EnforcerRuleException( "Unable to lookup a component " 
+ e.getLocalizedMessage(), e );
+         }
+-        catch ( DependencyTreeBuilderException e )
++        catch ( DependencyGraphBuilderException e )
+         {
+             throw new EnforcerRuleException( "Could not build dependency tree 
" + e.getLocalizedMessage(), e );
+         }
+diff --git 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireUpperBoundDeps.java
 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireUpperBoundDeps.java
+index 458554a..2de9870 100644
+--- 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireUpperBoundDeps.java
++++ 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireUpperBoundDeps.java
+@@ -38,10 +38,10 @@ import 
org.apache.maven.enforcer.rule.api.EnforcerRuleException;
+ import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
+ import org.apache.maven.plugin.logging.Log;
+ import org.apache.maven.project.MavenProject;
+-import org.apache.maven.shared.dependency.tree.DependencyNode;
+-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
+-import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
+-import 
org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
++import org.apache.maven.shared.dependency.graph.DependencyNode;
++import org.apache.maven.shared.dependency.graph.DependencyGraphBuilder;
++import 
org.apache.maven.shared.dependency.graph.DependencyGraphBuilderException;
++import 
org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;
+ import 
org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
+ import 
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+ 
+@@ -91,7 +91,7 @@ public class RequireUpperBoundDeps
+     // CHECKSTYLE_OFF: LineLength
+     /**
+      * Uses the {@link EnforcerRuleHelper} to populate the values of the
+-     * {@link DependencyTreeBuilder#buildDependencyTree(MavenProject, 
ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, 
ArtifactCollector)}
++     * {@link DependencyGraphBuilder#buildDependencyTree(MavenProject, 
ArtifactRepository, ArtifactFactory, ArtifactMetadataSource, ArtifactFilter, 
ArtifactCollector)}
+      * factory method. <br/>
+      * This method simply exists to hide all the ugly lookup that the {@link 
EnforcerRuleHelper} has to do.
+      * 
+@@ -106,8 +106,8 @@ public class RequireUpperBoundDeps
+         try
+         {
+             MavenProject project = (MavenProject) helper.evaluate( 
"${project}" );
+-            DependencyTreeBuilder dependencyTreeBuilder =
+-                (DependencyTreeBuilder) helper.getComponent( 
DependencyTreeBuilder.class );
++            DependencyGraphBuilder dependencyTreeBuilder =
++                (DependencyGraphBuilder) helper.getComponent( 
DependencyGraphBuilder.class );
+             ArtifactRepository repository = (ArtifactRepository) 
helper.evaluate( "${localRepository}" );
+             ArtifactFactory factory = (ArtifactFactory) helper.getComponent( 
ArtifactFactory.class );
+             ArtifactMetadataSource metadataSource =
+@@ -115,8 +115,7 @@ public class RequireUpperBoundDeps
+             ArtifactCollector collector = (ArtifactCollector) 
helper.getComponent( ArtifactCollector.class );
+             ArtifactFilter filter = null; // we need to evaluate all scopes
+             DependencyNode node =
+-                dependencyTreeBuilder.buildDependencyTree( project, 
repository, factory, metadataSource, filter,
+-                                                           collector );
++                dependencyTreeBuilder.buildDependencyGraph( 
project.getProjectBuildingRequest(), filter);
+             return node;
+         }
+         catch ( ExpressionEvaluationException e )
+@@ -127,7 +126,7 @@ public class RequireUpperBoundDeps
+         {
+             throw new EnforcerRuleException( "Unable to lookup a component " 
+ e.getLocalizedMessage(), e );
+         }
+-        catch ( DependencyTreeBuilderException e )
++        catch ( DependencyGraphBuilderException e )
+         {
+             throw new EnforcerRuleException( "Could not build dependency tree 
" + e.getLocalizedMessage(), e );
+         }
+diff --git 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/DependencyVersionMap.java
 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/DependencyVersionMap.java
+index b6213fa..2c2a645 100644
+--- 
a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/DependencyVersionMap.java
++++ 
b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/DependencyVersionMap.java
+@@ -26,8 +26,8 @@ import java.util.Map;
+ 
+ import org.apache.maven.artifact.Artifact;
+ import org.apache.maven.plugin.logging.Log;
+-import org.apache.maven.shared.dependency.tree.DependencyNode;
+-import 
org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
++import org.apache.maven.shared.dependency.graph.DependencyNode;
++import 
org.apache.maven.shared.dependency.graph.traversal.DependencyNodeVisitor;
+ 
+ /**
+  * @author Brian Fox
+@@ -132,4 +132,4 @@ public class DependencyVersionMap
+         }
+         return output;
+     }
+-}
+\ No newline at end of file
++}
+-- 
+2.24.1
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]