felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r810627 - in /felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin: AbstractDependencyFilter.java BundlePlugin.java DependencyEmbedder.java DependencyExcluder.java ManifestPlugin.java
Date Wed, 02 Sep 2009 17:44:00 GMT
Author: mcculls
Date: Wed Sep  2 17:44:00 2009
New Revision: 810627

URL: http://svn.apache.org/viewvc?rev=810627&view=rev
Log:
FELIX-1290: warn if Embed-Dependency doesn't match any dependencies

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java?rev=810627&r1=810626&r2=810627&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
Wed Sep  2 17:44:00 2009
@@ -112,6 +112,8 @@
 
             // CLAUSE: REGEXP --> { ATTRIBUTE MAP }
             Map.Entry clause = ( Map.Entry ) clauseIterator.next();
+            StringBuilder tag = new StringBuilder();
+            tag.append( clause.getKey() );
 
             filter = new DependencyFilter( ( String ) clause.getKey() )
             {
@@ -128,6 +130,7 @@
             {
                 // ATTRIBUTE: KEY --> REGEXP
                 Map.Entry attr = ( Map.Entry ) attrIterator.next();
+                tag.append( ';' ).append( attr );
 
                 if ( "groupId".equals( attr.getKey() ) )
                 {
@@ -221,10 +224,10 @@
                 filter.filter( filteredDependencies );
             }
 
-            processDependencies( inline, filteredDependencies );
+            processDependencies( tag.toString(), inline, filteredDependencies );
         }
     }
 
 
-    protected abstract void processDependencies( String inline, Collection filteredDependencies
);
+    protected abstract void processDependencies( String clause, String inline, Collection
dependencies );
 }

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=810627&r1=810626&r2=810627&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
Wed Sep  2 17:44:00 2009
@@ -384,7 +384,7 @@
 
         // update BND instructions to embed selected Maven dependencies
         Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, builder
);
-        new DependencyEmbedder( embeddableArtifacts ).processHeaders( builder );
+        new DependencyEmbedder( getLog(), embeddableArtifacts ).processHeaders( builder );
 
         dumpInstructions( "BND Instructions:", builder.getProperties(), getLog() );
         dumpClasspath( "BND Classpath:", builder.getClasspath(), getLog() );

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java?rev=810627&r1=810626&r2=810627&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyEmbedder.java
Wed Sep  2 17:44:00 2009
@@ -26,6 +26,7 @@
 import java.util.Map;
 
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -53,6 +54,11 @@
     private String m_embedStripVersion;
 
     /**
+     * Maven logger.
+     */
+    private final Log m_log;
+
+    /**
      * Inlined paths.
      */
     private final Collection m_inlinedPaths;
@@ -63,10 +69,12 @@
     private final Collection m_embeddedArtifacts;
 
 
-    public DependencyEmbedder( Collection dependencyArtifacts )
+    public DependencyEmbedder( Log log, Collection dependencyArtifacts )
     {
         super( dependencyArtifacts );
 
+        m_log = log;
+
         m_inlinedPaths = new LinkedHashSet();
         m_embeddedArtifacts = new LinkedHashSet();
     }
@@ -115,15 +123,20 @@
 
 
     @Override
-    protected void processDependencies( String inline, Collection filteredDependencies )
+    protected void processDependencies( String tag, String inline, Collection dependencies
)
     {
+        if ( dependencies.isEmpty() )
+        {
+            m_log.warn( EMBED_DEPENDENCY + ": clause \"" + tag + "\" did not match any dependencies"
);
+        }
+
         if ( null == inline || "false".equalsIgnoreCase( inline ) )
         {
-            m_embeddedArtifacts.addAll( filteredDependencies );
+            m_embeddedArtifacts.addAll( dependencies );
         }
         else
         {
-            for ( Iterator i = filteredDependencies.iterator(); i.hasNext(); )
+            for ( Iterator i = dependencies.iterator(); i.hasNext(); )
             {
                 addInlinedPaths( ( Artifact ) i.next(), inline, m_inlinedPaths );
             }

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java?rev=810627&r1=810626&r2=810627&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/DependencyExcluder.java
Wed Sep  2 17:44:00 2009
@@ -60,9 +60,9 @@
 
 
     @Override
-    protected void processDependencies( String inline, Collection filteredDependencies )
+    protected void processDependencies( String tag, String inline, Collection dependencies
)
     {
-        m_excludedArtifacts.addAll( filteredDependencies );
+        m_excludedArtifacts.addAll( dependencies );
     }
 
 

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java?rev=810627&r1=810626&r2=810627&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
Wed Sep  2 17:44:00 2009
@@ -188,7 +188,7 @@
 
         // Apply Embed-Dependency headers, even though the contents won't be changed
         Collection embeddableArtifacts = getEmbeddableArtifacts( project, analyzer );
-        new DependencyEmbedder( embeddableArtifacts ).processHeaders( analyzer );
+        new DependencyEmbedder( getLog(), embeddableArtifacts ).processHeaders( analyzer
);
 
         analyzer.mergeManifest( analyzer.getJar().getManifest() );
         analyzer.calcManifest();



Mime
View raw message