You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2007/04/11 16:25:21 UTC

svn commit: r527501 - in /incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin: BundlePlugin.java ManifestPlugin.java

Author: rickhall
Date: Wed Apr 11 07:25:20 2007
New Revision: 527501

URL: http://svn.apache.org/viewvc?view=rev&rev=527501
Log:
Applied a refactored patch of FELIX-218 since the original patch was 
removed when merging the plugin with FELIX-199.

Modified:
    incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java
    incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java

Modified: incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java?view=diff&rev=527501&r1=527500&r2=527501
==============================================================================
--- incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java (original)
+++ incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/BundlePlugin.java Wed Apr 11 07:25:20 2007
@@ -111,6 +111,24 @@
   }
  }
 
+ /* transform directives from their XML form to the expected BND syntax (eg. _include becomes -include) */
+ protected Map transformDirectives(Map instructions) {
+  Set removedKeys = new HashSet();
+//System.out.println("BEFORE "+instructions);
+  for (Iterator i = instructions.entrySet().iterator(); i.hasNext();) {
+    final Map.Entry e = (Map.Entry)i.next();
+    final String key = (String)e.getKey();
+    if (key.startsWith("_")) {
+      final String transformedKey = "-"+key.substring(1);
+      instructions.put(transformedKey, e.getValue());
+      removedKeys.add(key);
+    }
+  }
+  instructions.keySet().removeAll(removedKeys);
+//System.out.println("AFTER "+instructions);
+  return instructions;
+ }
+
  protected void execute(MavenProject project, Map instructions, Properties properties, Jar[] classpath) throws MojoExecutionException {
   try {
    File jarFile = new File(getBuildDirectory(), getBundleName(project));
@@ -122,7 +140,7 @@
      properties.put(Analyzer.EXPORT_PACKAGE, bsn + ".*");
    }
 
-   properties.putAll(instructions);
+   properties.putAll(transformDirectives(instructions));
  
    Builder builder = new Builder();
    builder.setBase(baseDir);

Modified: incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java?view=diff&rev=527501&r1=527500&r2=527501
==============================================================================
--- incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java (original)
+++ incubator/felix/trunk/tools/maven2/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java Wed Apr 11 07:25:20 2007
@@ -105,7 +105,7 @@
             props.put( Analyzer.IMPORT_PACKAGE, "*" );
         }
 
-        props.putAll( instructions );
+        props.putAll( transformDirectives( instructions ) );
 
         analyzer.setProperties( props );