felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1663619 - in /felix/trunk/bundleplugin: ./ src/main/java/org/apache/felix/bundleplugin/ src/main/java/org/apache/felix/bundleplugin/baseline/ src/main/resources/META-INF/m2e/
Date Tue, 03 Mar 2015 10:48:45 GMT
Author: cziegeler
Date: Tue Mar  3 10:48:44 2015
New Revision: 1663619

URL: http://svn.apache.org/r1663619
Log:
FELIX-4822 : Create markers in m2e for baseline warnings/errors

Added:
    felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/
    felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
  (with props)
Modified:
    felix/trunk/bundleplugin/pom.xml
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java

Modified: felix/trunk/bundleplugin/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/pom.xml?rev=1663619&r1=1663618&r2=1663619&view=diff
==============================================================================
--- felix/trunk/bundleplugin/pom.xml (original)
+++ felix/trunk/bundleplugin/pom.xml Tue Mar  3 10:48:44 2015
@@ -155,5 +155,4 @@
    </plugin>
   </plugins>
  </reporting>
-
 </project>

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=1663619&r1=1663618&r2=1663619&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 Mar  3 10:48:44 2015
@@ -87,7 +87,7 @@ import aQute.lib.spring.SpringXMLType;
  *
  * @goal bundle
  * @phase package
- * @requiresDependencyResolution test
+ * @requiresDependencyResolution compile
  * @description build an OSGi bundle jar
  * @threadSafe
  */

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java?rev=1663619&r1=1663618&r2=1663619&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/AbstractBaselinePlugin.java
Tue Mar  3 10:48:44 2015
@@ -32,7 +32,6 @@ import org.apache.maven.artifact.Artifac
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.resolver.ArtifactResolver;
@@ -40,6 +39,7 @@ import org.apache.maven.artifact.version
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
 import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -93,6 +93,13 @@ abstract class AbstractBaselinePlugin
     protected MavenProject project;
 
     /**
+     * @parameter expression="${session}"
+     * @required
+     * @readonly
+     */
+    protected MavenSession session;
+
+    /**
      * @parameter expression="${project.build.directory}"
      * @required
      * @readonly
@@ -117,13 +124,6 @@ abstract class AbstractBaselinePlugin
     protected ArtifactFactory factory;
 
     /**
-     * @parameter default-value="${localRepository}"
-     * @required
-     * @readonly
-     */
-    protected ArtifactRepository localRepository;
-
-    /**
      * @component
      */
     private ArtifactMetadataSource metadataSource;
@@ -157,7 +157,7 @@ abstract class AbstractBaselinePlugin
      *
      * @parameter
      */
-    protected List supportedProjectTypes = Arrays.asList( new String[] { "jar", "bundle"
} );
+    protected List<String> supportedProjectTypes = Arrays.asList( new String[] { "jar",
"bundle" } );
 
     public final void execute()
         throws MojoExecutionException, MojoFailureException
@@ -209,37 +209,55 @@ abstract class AbstractBaselinePlugin
             packageFilters = new Instructions( Arrays.asList( filters ) );
         }
 
-        // go!
-        context = this.init(context);
 
         String generationDate = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm'Z'" ).format( new
Date() );
-        Reporter reporter = new Processor();
+        final Reporter reporter = new Processor();
 
+        final Info[] infos;
         try
         {
-            Set<Info> infoSet = new Baseline( reporter, new DiffPluginImpl() )
+            final Set<Info> infoSet = new Baseline( reporter, new DiffPluginImpl()
)
                                 .baseline( currentBundle, previousBundle, packageFilters
);
+            infos = infoSet.toArray( new Info[infoSet.size()] );
+            Arrays.sort( infos, new InfoComparator() );
+        }
+        catch ( final Exception e )
+        {
+            throw new MojoExecutionException( "Impossible to calculate the baseline", e );
+        }
+        finally
+        {
+            closeJars( currentBundle, previousBundle );
+        }
 
-            startBaseline( context, generationDate, project.getArtifactId(), project.getVersion(),
previousArtifact.getVersion() );
+        try
+        {
+            this.reportErrors(infos);
+        }
+        catch ( final IOException ioe )
+        {
+            throw new MojoExecutionException("Unable to parse baselining information.", ioe);
+        }
 
-            final Info[] infos = infoSet.toArray( new Info[infoSet.size()] );
-            Arrays.sort( infos, new InfoComparator() );
+        try
+        {
+            // go!
+            context = this.init(context);
+            startBaseline( context, generationDate, project.getArtifactId(), project.getVersion(),
previousArtifact.getVersion() );
 
-            for ( Info info : infos )
+            for ( final Info info : infos )
             {
                 DiffMessage diffMessage = null;
-                Version newerVersion = info.newerVersion;
-                Version suggestedVersion = info.suggestedVersion;
 
-                if ( suggestedVersion != null )
+                if ( info.suggestedVersion != null )
                 {
-                    if ( newerVersion.compareTo( suggestedVersion ) > 0 )
+                    if ( info.newerVersion.compareTo( info.suggestedVersion ) > 0 )
                     {
                         diffMessage = new DiffMessage( "Excessive version increase", DiffMessage.Type.warning
);
                         reporter.warning( "%s: %s; detected %s, suggested %s",
                                           info.packageName, diffMessage, info.newerVersion,
info.suggestedVersion );
                     }
-                    else if ( newerVersion.compareTo( suggestedVersion ) < 0 )
+                    else if ( info.newerVersion.compareTo( info.suggestedVersion ) < 0
)
                     {
                         diffMessage = new DiffMessage( "Version increase required", DiffMessage.Type.error
);
                         reporter.error( "%s: %s; detected %s, suggested %s",
@@ -247,16 +265,10 @@ abstract class AbstractBaselinePlugin
                     }
                 }
 
-                Diff packageDiff = info.packageDiff;
-
-                Delta delta = packageDiff.getDelta();
-
-                switch ( delta )
+                switch ( info.packageDiff.getDelta() )
                 {
                     case UNCHANGED:
-                        if ( ( suggestedVersion.getMajor() != newerVersion.getMajor() )
-                            || ( suggestedVersion.getMicro() != newerVersion.getMicro() )
-                            || ( suggestedVersion.getMinor() != newerVersion.getMinor() )
)
+                        if ( info.newerVersion.compareTo( info.suggestedVersion ) != 0 )
                         {
                             diffMessage = new DiffMessage( "Version has been increased but
analysis detected no changes", DiffMessage.Type.warning );
                             reporter.warning( "%s: %s; detected %s, suggested %s",
@@ -279,28 +291,20 @@ abstract class AbstractBaselinePlugin
                         break;
                 }
 
-                boolean mismatch = info.mismatch;
-                String packageName = info.packageName;
-                String shortDelta = getShortDelta( info.packageDiff.getDelta() );
-                String deltaString = StringUtils.lowerCase( String.valueOf( info.packageDiff.getDelta()
) );
-                String newerVersionString = String.valueOf( info.newerVersion );
-                String olderVersionString = String.valueOf( info.olderVersion );
-                String suggestedVersionString = String.valueOf( ( info.suggestedVersion ==
null ) ? "-" : info.suggestedVersion );
-                Map<String,String> attributes = info.attributes;
-
-                startPackage( context, mismatch,
-                              packageName,
-                              shortDelta,
-                              deltaString,
-                              newerVersionString,
-                              olderVersionString,
-                              suggestedVersionString,
+                startPackage( context,
+                              info.mismatch,
+                              info.packageName,
+                              getShortDelta( info.packageDiff.getDelta() ),
+                              StringUtils.lowerCase( String.valueOf( info.packageDiff.getDelta()
) ),
+                              info.newerVersion,
+                              info.olderVersion,
+                              info.suggestedVersion,
                               diffMessage,
-                              attributes );
+                              info.attributes );
 
-                if ( Delta.REMOVED != delta )
+                if ( Delta.REMOVED != info.packageDiff.getDelta() )
                 {
-                    doPackageDiff( context, packageDiff );
+                    doPackageDiff( context, info.packageDiff );
                 }
 
                 endPackage(context);
@@ -308,13 +312,8 @@ abstract class AbstractBaselinePlugin
 
             endBaseline(context);
         }
-        catch ( Exception e )
-        {
-            throw new MojoExecutionException( "Impossible to calculate the baseline", e );
-        }
         finally
         {
-            closeJars( currentBundle, previousBundle );
             this.close(context);
         }
 
@@ -406,9 +405,9 @@ abstract class AbstractBaselinePlugin
                                           String name,
                                           String shortDelta,
                                           String delta,
-                                          String newerVersion,
-                                          String olderVersion,
-                                          String suggestedVersion,
+                                          Version newerVersion,
+                                          Version olderVersion,
+                                          Version suggestedVersion,
                                           DiffMessage diffMessage,
                                           Map<String,String> attributes );
 
@@ -425,6 +424,12 @@ abstract class AbstractBaselinePlugin
 
     protected abstract void endBaseline(final Object context);
 
+    protected void reportErrors(final Info[] infos)
+    throws IOException
+    {
+        // nothing to do, will be overridden by baseline plugin
+    }
+
     // internals
 
     private Jar getCurrentBundle()
@@ -476,7 +481,7 @@ abstract class AbstractBaselinePlugin
                 @SuppressWarnings( "unchecked" )
                 // type is konwn
                 List<ArtifactVersion> availableVersions =
-                    metadataSource.retrieveAvailableVersions( previousArtifact, localRepository,
+                    metadataSource.retrieveAvailableVersions( previousArtifact, session.getLocalRepository(),
                                                               project.getRemoteArtifactRepositories()
);
                 filterSnapshots( availableVersions );
                 ArtifactVersion version = range.matchVersion( availableVersions );
@@ -503,11 +508,11 @@ abstract class AbstractBaselinePlugin
 
         try
         {
-            resolver.resolve( previousArtifact, project.getRemoteArtifactRepositories(),
localRepository );
+            resolver.resolve( previousArtifact, project.getRemoteArtifactRepositories(),
session.getLocalRepository() );
         }
         catch ( ArtifactResolutionException are )
         {
-            throw new MojoExecutionException( "Artifact " + previousArtifact + " cannot be
resolved", are );
+            throw new MojoExecutionException( "Artifact " + previousArtifact + " cannot be
resolved : " + are.getMessage(), are );
         }
         catch ( ArtifactNotFoundException anfe )
         {
@@ -530,20 +535,20 @@ abstract class AbstractBaselinePlugin
         }
     }
 
-    private static Jar openJar( File file )
+    private static Jar openJar( final File file )
         throws MojoExecutionException
     {
         try
         {
             return new Jar( file );
         }
-        catch ( IOException e )
+        catch ( final IOException e )
         {
             throw new MojoExecutionException( "An error occurred while opening JAR directory:
" + file, e );
         }
     }
 
-    private static void closeJars( Jar...jars )
+    private static void closeJars( final Jar...jars )
     {
         for ( Jar jar : jars )
         {
@@ -607,5 +612,4 @@ abstract class AbstractBaselinePlugin
                 return String.valueOf( deltaString.charAt( 0 ) );
         }
     }
-
 }

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java?rev=1663619&r1=1663618&r2=1663619&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselinePlugin.java
Tue Mar  3 10:48:44 2015
@@ -21,18 +21,29 @@ package org.apache.felix.bundleplugin.ba
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.LineNumberReader;
+import java.io.StringReader;
 import java.util.Map;
 import java.util.Map.Entry;
 
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
 import org.codehaus.plexus.util.xml.XMLWriter;
 import org.sonatype.plexus.build.incremental.BuildContext;
 
+import aQute.bnd.differ.Baseline.Info;
+import aQute.bnd.service.diff.Delta;
+import aQute.bnd.service.diff.Diff;
+import aQute.bnd.service.diff.Type;
+import aQute.bnd.version.Version;
+
 /**
  * BND Baseline check between two bundles.
  *
  * @goal baseline
  * @phase verify
+ * @requiresDependencyResolution test
  * @threadSafe true
  * @since 2.4.1
  */
@@ -159,9 +170,9 @@ public final class BaselinePlugin
                                  String name,
                                  String shortDelta,
                                  String delta,
-                                 String newerVersion,
-                                 String olderVersion,
-                                 String suggestedVersion,
+                                 Version newerVersion,
+                                 Version olderVersion,
+                                 Version suggestedVersion,
                                  DiffMessage diffMessage,
                                  Map<String,String> attributes )
     {
@@ -185,9 +196,12 @@ public final class BaselinePlugin
             xmlWriter.addAttribute( "name", name );
             xmlWriter.addAttribute( "delta", delta );
             simpleElement( xmlWriter, "mismatch", String.valueOf( mismatch ) );
-            simpleElement( xmlWriter, "newerVersion", newerVersion );
-            simpleElement( xmlWriter, "olderVersion", olderVersion );
-            simpleElement( xmlWriter, "suggestedVersion", suggestedVersion );
+            simpleElement( xmlWriter, "newerVersion", newerVersion.toString() );
+            simpleElement( xmlWriter, "olderVersion", olderVersion.toString() );
+            if ( suggestedVersion != null )
+            {
+                simpleElement( xmlWriter, "suggestedVersion", suggestedVersion.toString()
);
+            }
 
             if ( diffMessage != null )
             {
@@ -288,4 +302,224 @@ public final class BaselinePlugin
         xmlWriter.endElement();
     }
 
+    @Override
+    protected void reportErrors(final Info[] infos)
+    throws IOException
+    {
+        for ( final Info info : infos )
+        {
+            // clear previous messages
+            final FileMarker packageMarker = findMarkerLocationForPackage(info.packageName);
+
+            if ( info.suggestedVersion != null )
+            {
+                if ( info.newerVersion.compareTo( info.suggestedVersion ) > 0 )
+                {
+                    final String msg = "Excessive version increase: detected " + info.newerVersion
+ ", suggested " + info.suggestedVersion;
+
+                    this.buildContext.addMessage(packageMarker.file, packageMarker.line,
packageMarker.col, msg, BuildContext.SEVERITY_WARNING, null);
+                }
+                else if ( info.newerVersion.compareTo( info.suggestedVersion ) < 0 )
+                {
+                    final String msg = "Version increase required: detected " + info.newerVersion
+ ", suggested " + info.suggestedVersion;
+
+                    this.buildContext.addMessage(packageMarker.file, packageMarker.line,
packageMarker.col, msg, BuildContext.SEVERITY_ERROR, null);
+                }
+            }
+
+            if ( info.packageDiff.getDelta() == Delta.UNCHANGED && info.newerVersion.compareTo(
info.suggestedVersion ) != 0 )
+            {
+                final String msg = "Version has been increased but analysis detected no changes:
detected " + info.newerVersion + ", suggested " + info.suggestedVersion;
+                this.buildContext.addMessage(packageMarker.file, packageMarker.line, packageMarker.col,
msg, BuildContext.SEVERITY_WARNING, null);
+            }
+            generateStructuralChangeMarkers(info);
+        }
+    }
+
+    private File getPackageFile(final String packageName)
+    {
+        final String sourceDir = this.project.getBuild().getSourceDirectory();
+        final File packageDir = new File((sourceDir + '/' + packageName.replace('.', '/')).replace('/',
File.separatorChar));
+
+        return packageDir;
+    }
+
+    private File getSourceFile(final String className)
+    {
+        final String sourceDir = this.project.getBuild().getSourceDirectory();
+        final File packageDir = new File((sourceDir + '/' + className.replace('.', '/') +
".java").replace('/', File.separatorChar));
+
+        return packageDir;
+    }
+
+    private static final class FileMarker
+    {
+        public File file;
+        public int  line;
+        public int  col;
+    }
+
+    /**
+     * Find marker location for a package
+     * and clear old markers.
+     */
+    private FileMarker findMarkerLocationForPackage(final String packageName)
+    throws IOException
+    {
+        final File packageDir = getPackageFile(packageName);
+        this.buildContext.removeMessages(packageDir);
+
+        final File packageInfoFile = new File(packageDir, "packageinfo");
+        this.buildContext.removeMessages(packageInfoFile);
+
+        final File packageInfoJavaFile = new File(packageDir, "package-info.java");
+        this.buildContext.removeMessages(packageInfoJavaFile);
+
+        // package-info.java has precedence
+        if ( packageInfoJavaFile != null && packageInfoJavaFile.exists() )
+        {
+            return findVersionLocationInPackageInfoJava(packageInfoJavaFile);
+        }
+        // packageinfo next
+        if ( packageInfoFile != null && packageInfoFile.exists() )
+        {
+            return findVersionLocationInPackageInfo(packageInfoFile);
+        }
+
+        final FileMarker defaultMarker = new FileMarker();
+        defaultMarker.file = packageDir;
+
+        return defaultMarker;
+    }
+
+    private FileMarker findVersionLocationInPackageInfo(final File file)
+    throws IOException
+    {
+        final FileMarker marker = new FileMarker();
+        marker.file = file;
+        final String contents = FileUtils.fileRead(file);
+        final LineNumberReader reader = new LineNumberReader(new StringReader(contents));
+        try
+        {
+            String line;
+            while ( (line = reader.readLine()) != null )
+            {
+                final int pos = line.indexOf("version ");
+                if ( pos > -1 )
+                {
+                    marker.col = pos;
+                    marker.line = reader.getLineNumber();
+
+                    break;
+                }
+            }
+        }
+        finally
+        {
+            IOUtil.close(reader);
+        }
+        return marker;
+    }
+
+    private FileMarker findVersionLocationInPackageInfoJava(final File file)
+    throws IOException
+    {
+        final FileMarker marker = new FileMarker();
+        marker.file = file;
+        final String contents = FileUtils.fileRead(file);
+        final LineNumberReader reader = new LineNumberReader(new StringReader(contents));
+        try
+        {
+            String line;
+            while ( (line = reader.readLine()) != null )
+            {
+                final int pos = line.indexOf("@Version");
+                if ( pos > -1 )
+                {
+                    marker.col = pos;
+                    marker.line = reader.getLineNumber();
+
+                    break;
+                }
+            }
+        }
+        finally
+        {
+            IOUtil.close(reader);
+        }
+        return marker;
+    }
+
+   private void generateStructuralChangeMarkers(final Info baselineInfo)
+   {
+        final Delta packageDelta = baselineInfo.packageDiff.getDelta();
+
+        // Iterate into the package member diffs
+        for (final Diff pkgMemberDiff : baselineInfo.packageDiff.getChildren())
+        {
+            // only deal with interfaces and classes
+            if ( pkgMemberDiff.getType() != Type.INTERFACE && pkgMemberDiff.getType()
!= Type.CLASS )
+            {
+                continue;
+            }
+
+            // clear old marker
+            final String className = pkgMemberDiff.getName();
+            final File classFile = this.getSourceFile(className);
+            this.buildContext.removeMessages(classFile);
+
+            // Skip deltas that have lesser significance than the overall package delta
+            if (pkgMemberDiff.getDelta().ordinal() < packageDelta.ordinal())
+            {
+                continue;
+            }
+
+            if (Delta.ADDED == pkgMemberDiff.getDelta())
+            {
+                // TODO
+            }
+            else if (Delta.REMOVED == pkgMemberDiff.getDelta())
+            {
+                // TODO
+            }
+            else
+            {
+                // Iterate into the class member diffs
+                for (final Diff classMemberDiff : pkgMemberDiff.getChildren())
+                {
+                    // Skip deltas that have lesser significance than the overall package
delta (again)
+                    if (classMemberDiff.getDelta().ordinal() < packageDelta.ordinal())
+                        continue;
+
+                    if (Delta.ADDED == classMemberDiff.getDelta())
+                    {
+                        addAddedMarker(classFile, classMemberDiff);
+                    }
+                    else if (Delta.REMOVED == classMemberDiff.getDelta())
+                    {
+                        addRemovedMarker(classFile, classMemberDiff);
+                    }
+                    else if (Delta.CHANGED == classMemberDiff.getDelta())
+                    {
+                        addChangedMarker(classFile, classMemberDiff);
+                    }
+                }
+            }
+        }
+    }
+
+   private void addAddedMarker(final File classFile, final Diff diff)
+   {
+       this.buildContext.addMessage(classFile, 0, 0, diff.getType() + " " + diff.getName()
+ " has been added.", BuildContext.SEVERITY_ERROR, null);
+   }
+
+   private void addRemovedMarker(final File classFile, final Diff diff)
+   {
+       this.buildContext.addMessage(classFile, 0, 0, diff.getType() + " " + diff.getName()
+ " has been removed.", BuildContext.SEVERITY_ERROR, null);
+   }
+
+   private void addChangedMarker(final File classFile, final Diff diff)
+   {
+       this.buildContext.addMessage(classFile, 0, 0, diff.getType() + " " + diff.getName()
+ " has been changed.", BuildContext.SEVERITY_ERROR, null);
+   }
 }

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java?rev=1663619&r1=1663618&r2=1663619&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/baseline/BaselineReport.java
Tue Mar  3 10:48:44 2015
@@ -32,6 +32,8 @@ import org.apache.maven.reporting.MavenR
 import org.apache.maven.reporting.MavenReportException;
 import org.codehaus.plexus.util.IOUtil;
 
+import aQute.bnd.version.Version;
+
 /**
  * BND Baseline report.
  *
@@ -121,7 +123,8 @@ public final class BaselineReport
     }
 
     @Override
-    protected void startBaseline( final Object context, String generationDate, String bundleName,
String currentVersion, String previousVersion )
+    protected void startBaseline( final Object context, String generationDate, String bundleName,
+            String currentVersion, String previousVersion )
     {
         final Context ctx = (Context)context;
         final Sink sink = ctx.sink;
@@ -190,9 +193,9 @@ public final class BaselineReport
                                  String packageName,
                                  String shortDelta,
                                  String delta,
-                                 String newerVersion,
-                                 String olderVersion,
-                                 String suggestedVersion,
+                                 Version newerVersion,
+                                 Version olderVersion,
+                                 Version suggestedVersion,
                                  DiffMessage diffMessage,
                                  Map<String,String> attributes )
     {
@@ -223,15 +226,18 @@ public final class BaselineReport
             sink.italic_();
             sink.text( " (newer version: " );
             sink.monospaced();
-            sink.text( newerVersion );
+            sink.text( newerVersion.toString() );
             sink.monospaced_();
             sink.text( ", older version: " );
             sink.monospaced();
-            sink.text( olderVersion );
-            sink.monospaced_();
-            sink.text( ", suggested version: " );
-            sink.monospaced();
-            sink.text( suggestedVersion );
+            sink.text( olderVersion.toString() );
+            if ( suggestedVersion != null )
+            {
+                sink.monospaced_();
+                sink.text( ", suggested version: " );
+                sink.monospaced();
+                sink.text( suggestedVersion.toString() );
+            }
             sink.monospaced_();
             sink.text( ")" );
         }

Added: felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml?rev=1663619&view=auto
==============================================================================
--- felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
(added)
+++ felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
Tue Mar  3 10:48:44 2015
@@ -0,0 +1,34 @@
+<!-- 
+ 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. 
+-->
+<lifecycleMappingMetadata>
+   <pluginExecutions>
+        <pluginExecution>
+            <pluginExecutionFilter>
+                <goals>
+                    <goal>baseline</goal>
+                </goals>
+            </pluginExecutionFilter>
+            <action>
+                <execute>
+                    <runOnIncremental>true</runOnIncremental>
+                </execute>
+            </action>
+        </pluginExecution>
+    </pluginExecutions>
+</lifecycleMappingMetadata>

Propchange: felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: felix/trunk/bundleplugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message