felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r616674 - /felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
Date Wed, 30 Jan 2008 07:50:34 GMT
Author: mcculls
Date: Tue Jan 29 23:50:33 2008
New Revision: 616674

URL: http://svn.apache.org/viewvc?rev=616674&view=rev
Log:
FELIX-461: refactor bundle building code into separate method

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=616674&r1=616673&r2=616674&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 Jan 29 23:50:33 2008
@@ -255,34 +255,7 @@
         {
             File jarFile = new File( getBuildDirectory(), getBundleName( currentProject )
);
 
-            properties.putAll( getDefaultProperties( currentProject ) );
-
-            String bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId();
-            if ( !originalInstructions.containsKey( Analyzer.PRIVATE_PACKAGE ) )
-            {
-                properties.put( Analyzer.EXPORT_PACKAGE, bsn + ".*" );
-            }
-
-            properties.putAll( transformDirectives( originalInstructions ) );
-
-            // update BND instructions to add Maven resources
-            includeMavenResources( currentProject, properties, getLog() );
-
-            Builder builder = new Builder();
-            builder.setBase( currentProject.getBasedir() );
-            builder.setProperties( properties );
-            builder.setClasspath( classpath );
-
-            // update BND instructions to embed selected Maven dependencies
-            Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, properties
);
-            new DependencyEmbedder( embeddableArtifacts ).processHeaders( properties );
-
-            builder.build();
-            Jar jar = builder.getJar();
-            doMavenMetadata( currentProject, jar );
-            builder.setJar( jar );
-
-            mergeMavenManifest( currentProject, jar, getLog() );
+            Builder builder = buildOSGiBundle( currentProject, originalInstructions, properties,
classpath );
 
             List errors = builder.getErrors();
             List warnings = builder.getWarnings();
@@ -348,6 +321,42 @@
             getLog().error( "An internal error occurred", e );
             throw new MojoExecutionException( "Internal error in maven-bundle-plugin", e
);
         }
+    }
+
+
+    protected Builder buildOSGiBundle( MavenProject currentProject, Map originalInstructions,
Properties properties,
+        Jar[] classpath ) throws Exception
+    {
+        properties.putAll( getDefaultProperties( currentProject ) );
+
+        String bsn = currentProject.getGroupId() + "." + currentProject.getArtifactId();
+        if ( !originalInstructions.containsKey( Analyzer.PRIVATE_PACKAGE ) )
+        {
+            properties.put( Analyzer.EXPORT_PACKAGE, bsn + ".*" );
+        }
+
+        properties.putAll( transformDirectives( originalInstructions ) );
+
+        // update BND instructions to add Maven resources
+        includeMavenResources( currentProject, properties, getLog() );
+
+        Builder builder = new Builder();
+        builder.setBase( currentProject.getBasedir() );
+        builder.setProperties( properties );
+        builder.setClasspath( classpath );
+
+        // update BND instructions to embed selected Maven dependencies
+        Collection embeddableArtifacts = getEmbeddableArtifacts( currentProject, properties
);
+        new DependencyEmbedder( embeddableArtifacts ).processHeaders( properties );
+
+        builder.build();
+        Jar jar = builder.getJar();
+        doMavenMetadata( currentProject, jar );
+        builder.setJar( jar );
+
+        mergeMavenManifest( currentProject, jar, getLog() );
+
+        return builder;
     }
 
 



Mime
View raw message