FELIX-461: refactor bundle building code into separate method
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@616674 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index f12e37e..b08485f 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -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();
@@ -351,6 +324,42 @@
}
+ 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;
+ }
+
+
protected static void includeMavenResources( MavenProject currentProject, Properties properties, Log log )
{
// pass maven resource paths onto BND analyzer