incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1167055 - in /sling/trunk/maven/maven-launchpad-plugin: pom.xml src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
Date Fri, 09 Sep 2011 09:14:25 GMT
Author: cziegeler
Date: Fri Sep  9 09:14:25 2011
New Revision: 1167055

URL: http://svn.apache.org/viewvc?rev=1167055&view=rev
Log:
SLING-2212 : When merging bundle lists, the highest version should win

Modified:
    sling/trunk/maven/maven-launchpad-plugin/pom.xml
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java

Modified: sling/trunk/maven/maven-launchpad-plugin/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/pom.xml?rev=1167055&r1=1167054&r2=1167055&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/pom.xml (original)
+++ sling/trunk/maven/maven-launchpad-plugin/pom.xml Fri Sep  9 09:14:25 2011
@@ -162,6 +162,11 @@
             <version>1.0</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.maven.shared</groupId>
+            <artifactId>maven-osgi</artifactId>
+            <version>0.2.0</version>
+        </dependency>
+        <dependency>
             <groupId>org.drools</groupId>
             <artifactId>drools-compiler</artifactId>
             <version>5.1.1</version>

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java?rev=1167055&r1=1167054&r2=1167055&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
Fri Sep  9 09:14:25 2011
@@ -18,9 +18,12 @@ package org.apache.sling.maven.projectsu
 
 import java.util.List;
 
+import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
+import org.apache.maven.shared.osgi.Maven2OsgiConverter;
 import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
 import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
 import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
+import org.osgi.framework.Version;
 
 public abstract class BaseBundleList {
 
@@ -78,7 +81,14 @@ public abstract class BaseBundleList {
     private void add(StartLevel mergeStartLevel, Bundle newBnd) {
         Bundle current = get(newBnd, false);
         if (current != null) {
-            current.setVersion(newBnd.getVersion());
+            final Maven2OsgiConverter converter = new DefaultMaven2OsgiConverter();
+
+            // compare versions, the highest will be used
+            final Version newVersion = new Version(converter.getVersion(newBnd.getVersion()));
+            final Version oldVersion = new Version(converter.getVersion(current.getVersion()));
+            if ( newVersion.compareTo(oldVersion) > 0 ) {
+                current.setVersion(newBnd.getVersion());
+            }
         } else {
             StartLevel startLevel = null;
             if ( mergeStartLevel == null || newBnd.getStartLevel() != 0) {
@@ -88,7 +98,6 @@ public abstract class BaseBundleList {
             }
             startLevel.getBundles().add(newBnd);
         }
-
     }
 
     private StartLevel getOrCreateStartLevel(int startLevel) {
@@ -103,5 +112,4 @@ public abstract class BaseBundleList {
         sl.setRawLevel(startLevel);
         return sl;
     }
-
 }



Mime
View raw message