maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r507124 - in /maven/sandbox/plugins/maven-bundle-plugin: ./ src/main/java/aQute/ src/main/java/org/apache/felix/tools/maven2/bundleplugin/ src/test/java/org/apache/felix/tools/maven2/bundleplugin/
Date Tue, 13 Feb 2007 18:03:47 GMT
Author: carlos
Date: Tue Feb 13 10:03:46 2007
New Revision: 507124

URL: http://svn.apache.org/viewvc?view=rev&rev=507124
Log:
Upgrade BND to 0.0.111

Added:
    maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/PackageVersionAnalyzer.java
  (with props)
Removed:
    maven/sandbox/plugins/maven-bundle-plugin/src/main/java/aQute/
Modified:
    maven/sandbox/plugins/maven-bundle-plugin/pom.xml
    maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java
    maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java

Modified: maven/sandbox/plugins/maven-bundle-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/pom.xml?view=diff&rev=507124&r1=507123&r2=507124
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/pom.xml (original)
+++ maven/sandbox/plugins/maven-bundle-plugin/pom.xml Tue Feb 13 10:03:46 2007
@@ -49,7 +49,7 @@
   <dependency>
    <groupId>biz.aQute</groupId>
    <artifactId>bnd</artifactId>
-   <version>0.0.110</version>
+   <version>0.0.111</version>
   </dependency>
   <dependency>
    <groupId>junit</groupId>

Modified: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java?view=diff&rev=507124&r1=507123&r2=507124
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java
(original)
+++ maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java
Tue Feb 13 10:03:46 2007
@@ -30,7 +30,6 @@
 
 import aQute.lib.osgi.Analyzer;
 import aQute.lib.osgi.Jar;
-import aQute.lib.osgi.PatchedAnalyzer;
 
 /**
  * Generate an OSGi manifest for this project
@@ -84,7 +83,7 @@
     public Manifest getManifest( MavenProject project, Properties properties, Jar[] classpath
)
         throws IOException
     {
-        PatchedAnalyzer analyzer = new PatchedAnalyzer();
+        PackageVersionAnalyzer analyzer = new PackageVersionAnalyzer();
 
         analyzer.setProperties( getDefaultProperties( project ) );
         if ( properties != null )
@@ -100,14 +99,14 @@
 
         if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null )
         {
-            String export = analyzer.calculateExportsFromContents();
+            String export = analyzer.calculateExportsFromContents( analyzer.getJar() );
             analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export );
         }
 
         if ( classpath != null )
             analyzer.setClasspath( classpath );
 
-        analyzer.mergeManifest();
+        analyzer.mergeManifest( analyzer.getJar().getManifest() );
 
         analyzer.calcManifest();
         manifest = analyzer.getJar().getManifest();

Added: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/PackageVersionAnalyzer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/PackageVersionAnalyzer.java?view=auto&rev=507124
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/PackageVersionAnalyzer.java
(added)
+++ maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/PackageVersionAnalyzer.java
Tue Feb 13 10:03:46 2007
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.tools.maven2.bundleplugin;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+import aQute.lib.osgi.Analyzer;
+import aQute.lib.osgi.Jar;
+
+/**
+ * Extension of {@link aQute.lib.osgi.Analyzer} to handle package versions
+ * 
+ * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
+ * @version $Id$
+ */
+public class PackageVersionAnalyzer
+    extends Analyzer
+{
+
+    /**
+     * Remove META-INF subfolders from exports and set package versions to bundle version.
+     * 
+     * @param dot
+     * @param bundleClasspath
+     * @param contained
+     * @param referred
+     * @param uses
+     * @return 
+     * @throws IOException
+     */
+    public Map analyzeBundleClasspath( Jar dot, Map bundleClasspath, Map contained, Map referred,
Map uses )
+        throws IOException
+    {
+        Map classSpace = super.analyzeBundleClasspath( dot, bundleClasspath, contained, referred,
uses );
+        String bundleVersion = getProperties().getProperty( BUNDLE_VERSION );
+        for ( Iterator it = contained.entrySet().iterator(); it.hasNext(); )
+        {
+            Map.Entry entry = (Map.Entry) it.next();
+
+            /* remove packages under META-INF */
+            String packageName = (String) entry.getKey();
+            if ( packageName.startsWith( "META-INF." ) )
+            {
+                it.remove();
+            }
+
+            /* set package versions to bundle version values */
+            if ( bundleVersion != null )
+            {
+                Map values = (Map) entry.getValue();
+                if ( values.get( "version" ) == null )
+                {
+                    values.put( "version", bundleVersion );
+                }
+            }
+
+        }
+        return classSpace;
+    }
+
+}

Propchange: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/PackageVersionAnalyzer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/sandbox/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/PackageVersionAnalyzer.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java?view=diff&rev=507124&r1=507123&r2=507124
==============================================================================
--- maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java
(original)
+++ maven/sandbox/plugins/maven-bundle-plugin/src/test/java/org/apache/felix/tools/maven2/bundleplugin/BundlePluginTest.java
Tue Feb 13 10:03:46 2007
@@ -32,7 +32,6 @@
 import aQute.lib.osgi.Analyzer;
 import aQute.lib.osgi.Builder;
 import aQute.lib.osgi.Jar;
-import aQute.lib.osgi.PatchedAnalyzer;
 
 /**
  * Test for {@link BundlePlugin}.
@@ -100,7 +99,7 @@
         project.setArtifactId( "artifact" );
         project.setVersion( "1.1.0.0" );
 
-        PatchedAnalyzer analyzer = new PatchedAnalyzer();
+        PackageVersionAnalyzer analyzer = new PackageVersionAnalyzer();
         Jar jar = new Jar( "name", osgiBundleFile );
         analyzer.setJar( jar );
         analyzer.setClasspath( new Jar[] { jar } );



Mime
View raw message