felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r629367 - /felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
Date Wed, 20 Feb 2008 05:38:17 GMT
Author: mcculls
Date: Tue Feb 19 21:37:57 2008
New Revision: 629367

URL: http://svn.apache.org/viewvc?rev=629367&view=rev
Log:
FELIX-499: Enhance <excludeDependencies> to support comma-separated list of artifactIds

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java?rev=629367&r1=629366&r2=629367&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
Tue Feb 19 21:37:57 2008
@@ -90,11 +90,11 @@
     protected boolean unpackBundle;
 
     /**
-     * When true, exclude project dependencies from the classpath passed to BND
+     * Comma separated list of artifactIds to exclude from the dependency classpath passed
to BND (use "true" to exclude everything)
      *
      * @parameter expression="${excludeDependencies}"
      */
-    protected boolean excludeDependencies;
+    protected String excludeDependencies;
 
     /**
      * Classifier type of the bundle to be installed.  For example, "jdk14".
@@ -654,16 +654,7 @@
             list.add( new Jar( ".", getOutputDirectory() ) );
         }
 
-        final Set artifacts;
-        if ( excludeDependencies )
-        {
-            artifacts = Collections.EMPTY_SET;
-        }
-        else
-        {
-            artifacts = currentProject.getArtifacts();
-        }
-
+        final Collection artifacts = getSelectedDependencies( currentProject.getArtifacts()
);
         for ( Iterator it = artifacts.iterator(); it.hasNext(); )
         {
             Artifact artifact = ( Artifact ) it.next();
@@ -689,6 +680,33 @@
         Jar[] cp = new Jar[list.size()];
         list.toArray( cp );
         return cp;
+    }
+
+
+    private Collection getSelectedDependencies( Set artifacts )
+    {
+        if ( null == excludeDependencies || excludeDependencies.length() == 0 )
+        {
+            return artifacts;
+        }
+        else if ( "true".equalsIgnoreCase( excludeDependencies ) )
+        {
+            return Collections.EMPTY_LIST;
+        }
+
+        List excludes = Arrays.asList( excludeDependencies.trim().split( "\\s*,\\s*" ) );
+
+        Collection classpath = new ArrayList();
+        for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+        {
+            Artifact artifact = ( Artifact ) i.next();
+            if ( !excludes.contains( artifact.getArtifactId() ) )
+            {
+                classpath.add( artifact );
+            }
+        }
+
+        return classpath;
     }
 
 



Mime
View raw message