Backup Embed-Dependency work
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1189407 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
index 3918cc3..06deee3 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
@@ -112,12 +112,13 @@
// CLAUSE: REGEXP --> { ATTRIBUTE MAP }
Map.Entry clause = ( Map.Entry ) clauseIterator.next();
- StringBuilder tag = new StringBuilder();
- tag.append( clause.getKey() );
- if ( !( ( String ) clause.getKey() ).matches( "\\*~*" ) )
+ String primaryKey = ( String ) clause.getKey();
+ StringBuilder tag = new StringBuilder( primaryKey );
+
+ if ( !primaryKey.matches( "\\*~*" ) )
{
- filter = new DependencyFilter( ( String ) clause.getKey() )
+ filter = new DependencyFilter( primaryKey )
{
boolean matches( Artifact dependency )
{
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
index 446b9a3..dd45df9 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
@@ -215,7 +215,7 @@
}
- public void testEmbedDependency() throws Exception
+ public void testPositiveEmbedDependency() throws Exception
{
ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
@@ -229,18 +229,23 @@
project.setDependencyArtifacts( artifacts );
Map instructions = new HashMap();
- instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "!a|c|e;classifier=!four;scope=compile|runtime" );
+ instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "*;classifier=;type=jar;scope=compile,"
+ + "*;classifier=;type=jar;scope=runtime" );
Properties props = new Properties();
Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) );
Manifest manifest = builder.getJar().getManifest();
String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
- assertEquals( bcp, ".,compile-1.0.jar,runtime-1.0.jar,b-1.0.jar,b-1.0-two.jar,d-1.0.zip" );
+ assertEquals( ".,compile-1.0.jar,b-1.0.jar,runtime-1.0.jar", bcp );
String eas = manifest.getMainAttributes().getValue( "Embedded-Artifacts" );
- assertEquals( eas, "compile-1.0.jar;g=\"g\";a=\"compile\";v=\"1.0\","
- + "runtime-1.0.jar;g=\"g\";a=\"runtime\";v=\"1.0\"," + "b-1.0.jar;g=\"g\";a=\"b\";v=\"1.0\","
- + "b-1.0-two.jar;g=\"g\";a=\"b\";v=\"1.0\";c=\"two\"," + "d-1.0.zip;g=\"g\";a=\"d\";v=\"1.0\"" );
+ assertEquals( "compile-1.0.jar;g=\"g\";a=\"compile\";v=\"1.0\"," + "b-1.0.jar;g=\"g\";a=\"b\";v=\"1.0\","
+ + "runtime-1.0.jar;g=\"g\";a=\"runtime\";v=\"1.0\"", eas );
+ }
+
+
+ public void testNegativeEmbedDependency() throws Exception
+ {
}
}