felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r739224 - in /felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin: BundlePlugin.java JarPluginConfiguration.java
Date Fri, 30 Jan 2009 09:51:35 GMT
Author: mcculls
Date: Fri Jan 30 09:51:35 2009
New Revision: 739224

URL: http://svn.apache.org/viewvc?rev=739224&view=rev
Log:
FELIX-806: pickup <archive> settings in bundleplugin configuration (otherwise fall back
to the jarplugin settings) and enable support of the addMavenDescriptor setting

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.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=739224&r1=739223&r2=739224&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
Fri Jan 30 09:51:35 2009
@@ -174,6 +174,13 @@
      */
     private Maven2OsgiConverter m_maven2OsgiConverter;
 
+    /**
+     * The archive configuration to use.
+     *
+     * @parameter
+     */
+    private MavenArchiveConfiguration archive; // accessed indirectly in JarPluginConfiguration
+
     private static final String MAVEN_RESOURCES = "{maven-resources}";
 
     private static final String[] EMPTY_STRING_ARRAY =
@@ -400,7 +407,6 @@
 
         String[] removeHeaders = builder.getProperty( Analyzer.REMOVE_HEADERS, "" ).split(
"," );
 
-        doMavenMetadata( currentProject, jar );
         mergeMavenManifest( currentProject, jar, removeHeaders, getLog() );
         builder.setJar( jar );
 
@@ -418,7 +424,7 @@
             log.debug( "------------------------------------------------------------------------"
);
             for ( Enumeration e = properties.propertyNames(); e.hasMoreElements(); )
             {
-                String key = (String) e.nextElement();
+                String key = ( String ) e.nextElement();
                 log.debug( key + ": " + properties.getProperty( key ) );
             }
             log.debug( "------------------------------------------------------------------------"
);
@@ -434,7 +440,7 @@
             log.debug( "------------------------------------------------------------------------"
);
             for ( Iterator i = classpath.iterator(); i.hasNext(); )
             {
-                File path = ((Jar)i.next()).getSource();
+                File path = ( ( Jar ) i.next() ).getSource();
                 log.debug( null == path ? "null" : path.toString() );
             }
             log.debug( "------------------------------------------------------------------------"
);
@@ -450,7 +456,7 @@
             log.debug( "------------------------------------------------------------------------"
);
             for ( Iterator i = manifest.getMainAttributes().entrySet().iterator(); i.hasNext();
)
             {
-                Map.Entry entry = (Map.Entry) i.next();
+                Map.Entry entry = ( Map.Entry ) i.next();
                 log.debug( entry.getKey() + ": " + entry.getValue() );
             }
             log.debug( "------------------------------------------------------------------------"
);
@@ -501,8 +507,11 @@
     }
 
 
-    protected static void mergeMavenManifest( MavenProject currentProject, Jar jar, String[]
removeHeaders, Log log )
+    protected void mergeMavenManifest( MavenProject currentProject, Jar jar, String[] removeHeaders,
Log log )
+        throws IOException
     {
+        boolean addMavenDescriptor = true;
+
         try
         {
             /*
@@ -510,6 +519,8 @@
              */
             MavenArchiveConfiguration archiveConfig = JarPluginConfiguration.getArchiveConfiguration(
currentProject );
             String mavenManifestText = new MavenArchiver().getManifest( currentProject, archiveConfig
).toString();
+            addMavenDescriptor = archiveConfig.isAddMavenDescriptor();
+
             Manifest mavenManifest = new Manifest();
 
             // First grab the external manifest file (if specified)
@@ -576,6 +587,11 @@
         {
             log.warn( "Unable to merge Maven manifest: " + e.getLocalizedMessage() );
         }
+
+        if ( addMavenDescriptor )
+        {
+            doMavenMetadata( currentProject, jar );
+        }
     }
 
 

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java?rev=739224&r1=739223&r2=739224&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/JarPluginConfiguration.java
Fri Jan 30 09:51:35 2009
@@ -49,10 +49,26 @@
             ExpressionEvaluator evaluator = new DefaultExpressionEvaluator();
             ConverterLookup converters = new DefaultConverterLookup();
 
-            PlexusConfiguration pluginSettings = getCorePluginConfiguration( project, "jar"
);
-            PlexusConfiguration archiveSettings = pluginSettings.getChild( "archive" );
+            PlexusConfiguration settings = null;
 
-            converter.processConfiguration( converters, archiveConfig, loader, archiveSettings,
evaluator, null );
+            try
+            {
+                // first look for bundle specific archive settings
+                settings = getPluginConfiguration( project, "org.apache.felix", "maven-bundle-plugin"
);
+                settings = settings.getChild( "archive" );
+            }
+            catch ( Exception e )
+            {
+            }
+
+            // if it's empty fall back to the jar archive settings
+            if ( null == settings || settings.getChildCount() == 0 )
+            {
+                settings = getCorePluginConfiguration( project, "jar" );
+                settings = settings.getChild( "archive" );
+            }
+
+            converter.processConfiguration( converters, archiveConfig, loader, settings,
evaluator, null );
         }
         catch ( Exception e )
         {



Mime
View raw message