maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r576375 - /maven/shared/trunk/maven-dependency-analyzer/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
Date Mon, 17 Sep 2007 11:22:23 GMT
Author: markh
Date: Mon Sep 17 04:22:22 2007
New Revision: 576375

URL: http://svn.apache.org/viewvc?rev=576375&view=rev
Log:
Tidy up code

Modified:
    maven/shared/trunk/maven-dependency-analyzer/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java

Modified: maven/shared/trunk/maven-dependency-analyzer/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-dependency-analyzer/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java?rev=576375&r1=576374&r2=576375&view=diff
==============================================================================
--- maven/shared/trunk/maven-dependency-analyzer/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
(original)
+++ maven/shared/trunk/maven-dependency-analyzer/src/main/java/org/apache/maven/shared/dependency/analyzer/DefaultProjectDependencyAnalyzer.java
Mon Sep 17 04:22:22 2007
@@ -72,25 +72,10 @@
 
             Set dependencyClasses = buildDependencyClasses( project );
 
-            Set declaredArtifacts = project.getDependencyArtifacts();
+            Set declaredArtifacts = buildDeclaredArtifacts( project );
+            
+            Set usedArtifacts = buildUsedArtifacts( artifactClassMap, dependencyClasses );
             
-            if ( declaredArtifacts == null )
-            {
-                declaredArtifacts = Collections.EMPTY_SET;
-            }
-
-            Set usedArtifacts = new HashSet();
-
-            for ( Iterator dependencyIterator = dependencyClasses.iterator(); dependencyIterator.hasNext();
)
-            {
-                String className = (String) dependencyIterator.next();
-
-                Artifact artifact = findArtifactForClassName( artifactClassMap, className
);
-
-                if ( artifact != null )
-                    usedArtifacts.add( artifact );
-            }
-
             Set usedDeclaredArtifacts = new HashSet( declaredArtifacts );
             usedDeclaredArtifacts.retainAll( usedArtifacts );
 
@@ -181,6 +166,37 @@
         URL buildDirectoryURL = new File( buildDirectory ).toURI().toURL();
 
         return dependencyAnalyzer.analyze( buildDirectoryURL );
+    }
+    
+    private Set buildDeclaredArtifacts( MavenProject project )
+    {
+        Set declaredArtifacts = project.getDependencyArtifacts();
+        
+        if ( declaredArtifacts == null )
+        {
+            declaredArtifacts = Collections.EMPTY_SET;
+        }
+        
+        return declaredArtifacts;
+    }
+    
+    private Set buildUsedArtifacts( Map artifactClassMap, Set dependencyClasses )
+    {
+        Set usedArtifacts = new HashSet();
+
+        for ( Iterator dependencyIterator = dependencyClasses.iterator(); dependencyIterator.hasNext();
)
+        {
+            String className = (String) dependencyIterator.next();
+
+            Artifact artifact = findArtifactForClassName( artifactClassMap, className );
+
+            if ( artifact != null )
+            {
+                usedArtifacts.add( artifact );
+            }
+        }
+        
+        return usedArtifacts;
     }
 
     private Artifact findArtifactForClassName( Map artifactClassMap, String className )



Mime
View raw message