You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by mc...@apache.org on 2008/03/03 03:19:22 UTC
svn commit: r632925 - in /felix/trunk/bundleplugin/src:
main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
Author: mcculls
Date: Sun Mar 2 18:19:21 2008
New Revision: 632925
URL: http://svn.apache.org/viewvc?rev=632925&view=rev
Log:
FELIX-505: stop bundleall from repacking existing bundles
Modified:
felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java?rev=632925&r1=632924&r2=632925&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java Sun Mar 2 18:19:21 2008
@@ -51,6 +51,7 @@
import org.apache.maven.shared.dependency.tree.DependencyNode;
import org.apache.maven.shared.dependency.tree.DependencyTreeBuilder;
import org.apache.maven.shared.dependency.tree.DependencyTreeBuilderException;
+import org.codehaus.plexus.util.FileUtils;
import aQute.lib.osgi.Analyzer;
import aQute.lib.osgi.Jar;
@@ -130,6 +131,13 @@
private Set m_artifactsBeingProcessed = new HashSet();
+ /**
+ * Process up to some depth
+ *
+ * @parameter
+ */
+ private int depth = Integer.MAX_VALUE;
+
public void execute() throws MojoExecutionException
{
@@ -146,7 +154,7 @@
*/
private BundleInfo bundleAll( MavenProject project ) throws MojoExecutionException
{
- return bundleAll( project, Integer.MAX_VALUE );
+ return bundleAll( project, depth );
}
@@ -154,10 +162,10 @@
* Bundle a project and its transitive dependencies up to some depth level
*
* @param project
- * @param depth how deep to process the dependency tree
+ * @param maxDepth how deep to process the dependency tree
* @throws MojoExecutionException
*/
- protected BundleInfo bundleAll( MavenProject project, int depth ) throws MojoExecutionException
+ protected BundleInfo bundleAll( MavenProject project, int maxDepth ) throws MojoExecutionException
{
if ( alreadyBundled( project.getArtifact() ) )
@@ -233,11 +241,11 @@
node.getArtifact().setFile( artifact.getFile() );
int nodeDepth = node.getDepth();
- if ( nodeDepth > depth )
+ if ( nodeDepth > maxDepth )
{
/* node is deeper than we want */
- getLog()
- .debug( "Ignoring " + node.getArtifact() + ", depth is " + nodeDepth + ", bigger than " + depth );
+ getLog().debug(
+ "Ignoring " + node.getArtifact() + ", depth is " + nodeDepth + ", bigger than " + maxDepth );
continue;
}
@@ -266,7 +274,7 @@
if ( ( Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) )
|| ( Artifact.SCOPE_RUNTIME.equals( artifact.getScope() ) ) )
{
- BundleInfo subBundleInfo = bundleAll( childProject, depth - 1 );
+ BundleInfo subBundleInfo = bundleAll( childProject, maxDepth - 1 );
if ( subBundleInfo != null )
{
bundleInfo.merge( subBundleInfo );
@@ -343,6 +351,8 @@
Jar osgiJar = new Jar( project.getArtifactId(), project.getArtifact().getFile() );
+ outputFile.getAbsoluteFile().getParentFile().mkdirs();
+
Collection exportedPackages;
if ( isOsgi( osgiJar ) )
{
@@ -352,17 +362,16 @@
+ project.getVersion() );
String exportHeader = osgiJar.getManifest().getMainAttributes().getValue( Analyzer.EXPORT_PACKAGE );
exportedPackages = analyzer.parseHeader( exportHeader ).keySet();
+ FileUtils.copyFile( project.getArtifact().getFile(), outputFile );
}
else
{
- /* else generate the mainfest from the packages */
+ /* else generate the manifest from the packages */
exportedPackages = analyzer.getExports().keySet();
Manifest manifest = analyzer.getJar().getManifest();
osgiJar.setManifest( manifest );
+ osgiJar.write( outputFile );
}
-
- outputFile.getAbsoluteFile().getParentFile().mkdirs();
- osgiJar.write( outputFile );
BundleInfo bundleInfo = addExportedPackages( project, exportedPackages );
Modified: felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java?rev=632925&r1=632924&r2=632925&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java (original)
+++ felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java Sun Mar 2 18:19:21 2008
@@ -29,6 +29,7 @@
import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
import aQute.lib.osgi.Analyzer;
+import aQute.lib.osgi.Builder;
import aQute.lib.osgi.Jar;
@@ -49,6 +50,9 @@
super.setUp();
plugin = new BundlePlugin();
plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() );
+ plugin.setBasedir( new File( "." ) );
+ plugin.setBuildDirectory( "." );
+ plugin.setOutputDirectory( new File( "." ) );
}
@@ -156,5 +160,12 @@
assertEquals( "", transformedInstructions.get( "z" ) );
assertEquals( "", transformedInstructions.get( "-z" ) );
+ }
+
+
+ public void testVersion() throws Exception
+ {
+ String cleanupVersion = Builder.cleanupVersion( "0.0.0.4aug2000r7-dev" );
+ assertEquals( "0.0.0.4aug2000r7-dev", cleanupVersion );
}
}