You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/05/11 16:38:50 UTC

[GitHub] [maven-resolver] cstamas opened a new pull request, #176: Idea: collector listener

cstamas opened a new pull request, #176:
URL: https://github.com/apache/maven-resolver/pull/176

   This basically does what this example did:
   https://github.com/grgrzybek/tracking-maven-extension
   
   To finish, it would be an "extension point": interface that if extension implements as component, would be picked up.
   
   BUT: am not quite in favor of this, as collector is HOT, and any time this listener would spend on work, would directly affect collection process. Am slowly leaning to simply define a callback for result graph (once collection is done), as then:
   * that would minimally affect collection, would not, would just add "postprocessing" cost, no in-processing cost that can quickly ass up
   * whole graph would be handed over, same as for caller along with session


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-resolver] michael-o commented on a diff in pull request #176: Idea: collector listener

Posted by GitBox <gi...@apache.org>.
michael-o commented on code in PR #176:
URL: https://github.com/apache/maven-resolver/pull/176#discussion_r870615618


##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DependencyCollectorDelegate.java:
##########
@@ -93,4 +100,28 @@ public DependencyCollector setVersionRangeResolver( VersionRangeResolver version
         return this;
     }
 
+    protected void dependencyCollected( RepositorySystemSession session,
+                                        List<DependencyNode> pathToCollectedNode,
+                                        DependencyNode collectedNode )
+    {
+        // TODO: this is below "demo", but will be an extension point

Review Comment:
   Don't use `String#format()` it is very expensive, your SLF4J placeholder.



##########
maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DependencyCollectorDelegate.java:
##########
@@ -93,4 +100,28 @@ public DependencyCollector setVersionRangeResolver( VersionRangeResolver version
         return this;
     }
 
+    protected void dependencyCollected( RepositorySystemSession session,
+                                        List<DependencyNode> pathToCollectedNode,
+                                        DependencyNode collectedNode )
+    {
+        // TODO: this is below "demo", but will be an extension point
+        logger.info( String.format( "%s (context: %s)",
+                collectedNode.getDependency(), collectedNode.getRequestContext() ) );
+        int distance = 0;
+        ListIterator<DependencyNode> reversePathIterator = pathToCollectedNode
+                .listIterator( pathToCollectedNode.size() );
+        while ( reversePathIterator.hasPrevious() )
+        {
+            DependencyNode dn = reversePathIterator.previous();
+            StringBuilder indent = new StringBuilder();
+            for ( int i = 0; i < distance; i++ )
+            {
+                indent.append( "  " );
+            }
+            distance++;
+            indent.append( " -> " );
+            logger.info( String.format( "%s%s (context: %s) @ %s", indent, dn, dn.getRequestContext(),

Review Comment:
   same here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-resolver] cstamas commented on pull request #176: Idea: collector listener

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #176:
URL: https://github.com/apache/maven-resolver/pull/176#issuecomment-1124187787

   All the code in "demo" segment originates from here https://github.com/grgrzybek/tracking-maven-extension/blob/main/src/main/java/org/ops4j/tools/maven/tracker/TrackingRepositoryListener.java#L168


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-resolver] cstamas closed pull request #176: Idea: collector listener

Posted by GitBox <gi...@apache.org>.
cstamas closed pull request #176: Idea: collector listener
URL: https://github.com/apache/maven-resolver/pull/176


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org