felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r628824 - in /felix/trunk/bundleplugin/src/main/java/org/apache/felix: bundleplugin/BundlePlugin.java obrplugin/ObrDeploy.java obrplugin/ObrInstall.java
Date Mon, 18 Feb 2008 17:23:15 GMT
Author: mcculls
Date: Mon Feb 18 09:23:11 2008
New Revision: 628824

URL: http://svn.apache.org/viewvc?rev=628824&view=rev
Log:
FELIX-491: handle classifier in OBR install/deploy goals

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java

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=628824&r1=628823&r2=628824&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
Mon Feb 18 09:23:11 2008
@@ -361,6 +361,12 @@
         builder.setProperties( properties );
         builder.setClasspath( classpath );
 
+        if ( null != classifier && classifier.trim().length() > 0 )
+        {
+            String bundleVersion = properties.getProperty( Analyzer.BUNDLE_VERSION );
+            properties.put( Analyzer.BUNDLE_VERSION, bundleVersion + '-' + classifier );
+        }
+
         if ( !properties.containsKey( Analyzer.EXPORT_PACKAGE ) && !properties.containsKey(
Analyzer.PRIVATE_PACKAGE ) )
         {
             String bsn = properties.getProperty( Analyzer.BUNDLE_SYMBOLICNAME );

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java?rev=628824&r1=628823&r2=628824&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrDeploy.java Mon Feb
18 09:23:11 2008
@@ -22,10 +22,12 @@
 import java.io.File;
 import java.net.URI;
 import java.util.Arrays;
+import java.util.Iterator;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.AbstractMojo;
@@ -106,6 +108,13 @@
     private MavenProject project;
 
     /**
+     * @parameter expression="${project.attachedArtifacts}
+     * @required
+     * @readonly
+     */
+    private List attachedArtifacts;
+
+    /**
      * Local Maven settings.
      * 
      * @parameter expression="${settings}"
@@ -145,7 +154,6 @@
         String repositoryName = new File( tempURI.getPath() ).getName();
 
         Log log = getLog();
-        ObrUpdate update;
 
         RemoteFileManager remoteFile = new RemoteFileManager( m_wagonManager, settings, log
);
         openRepositoryConnection( remoteFile );
@@ -165,14 +173,12 @@
 
             URI repositoryXml = downloadedRepositoryXml.toURI();
             URI obrXmlFile = ObrUtils.findObrXml( project.getResources() );
-            URI bundleJar = ObrUtils.findBundleJar( localRepository, project.getArtifact()
);
 
-            Config userConfig = new Config();
-            userConfig.setRemoteFile( true );
-
-            update = new ObrUpdate( repositoryXml, obrXmlFile, project, bundleJar, mavenRepository,
userConfig, log );
-
-            update.updateRepository();
+            updateRemoteBundleMetadata( project.getArtifact(), repositoryXml, obrXmlFile,
mavenRepository );
+            for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
+            {
+                updateRemoteBundleMetadata( ( Artifact ) i.next(), repositoryXml, obrXmlFile,
mavenRepository );
+            }
 
             if ( downloadedRepositoryXml.exists() )
             {
@@ -229,5 +235,25 @@
         {
             remoteFile.connect( deploymentRepository.getId(), deploymentRepository.getUrl()
);
         }
+    }
+
+
+    private void updateRemoteBundleMetadata( Artifact artifact, URI repoXml, URI obrXml,
String mavenRepo )
+        throws MojoExecutionException
+    {
+        if ( null == artifact.getFile() || artifact.getFile().isDirectory() )
+        {
+            return;
+        }
+
+        getLog().info( "Updating: " + artifact );
+
+        URI bundleJar = ObrUtils.findBundleJar( localRepository, artifact );
+
+        Config userConfig = new Config();
+        userConfig.setRemoteFile( true );
+
+        ObrUpdate update = new ObrUpdate( repoXml, obrXml, project, bundleJar, mavenRepo,
userConfig, getLog() );
+        update.updateRepository();
     }
 }

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java?rev=628824&r1=628823&r2=628824&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrInstall.java Mon
Feb 18 09:23:11 2008
@@ -21,14 +21,13 @@
 
 import java.net.URI;
 import java.util.Arrays;
+import java.util.Iterator;
 import java.util.List;
 
-import org.apache.felix.obrplugin.Config;
-import org.apache.felix.obrplugin.ObrUpdate;
-import org.apache.felix.obrplugin.ObrUtils;
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 
 
@@ -75,6 +74,13 @@
      */
     private MavenProject project;
 
+    /**
+     * @parameter expression="${project.attachedArtifacts}
+     * @required
+     * @readonly
+     */
+    private List attachedArtifacts;
+
 
     public void execute()
     {
@@ -89,26 +95,41 @@
             return;
         }
 
-        Log log = getLog();
-        ObrUpdate update;
-
         try
         {
             String mavenRepository = localRepository.getBasedir();
 
             URI repositoryXml = ObrUtils.findRepositoryXml( mavenRepository, obrRepository
);
             URI obrXmlFile = ObrUtils.findObrXml( project.getResources() );
-            URI bundleJar = ObrUtils.findBundleJar( localRepository, project.getArtifact()
);
-
-            Config userConfig = new Config();
 
-            update = new ObrUpdate( repositoryXml, obrXmlFile, project, bundleJar, mavenRepository,
userConfig, log );
-
-            update.updateRepository();
+            updateLocalBundleMetadata( project.getArtifact(), repositoryXml, obrXmlFile,
mavenRepository );
+            for ( Iterator i = attachedArtifacts.iterator(); i.hasNext(); )
+            {
+                updateLocalBundleMetadata( ( Artifact ) i.next(), repositoryXml, obrXmlFile,
mavenRepository );
+            }
         }
         catch ( Exception e )
         {
-            log.warn( "Exception while updating local OBR: " + e.getLocalizedMessage(), e
);
+            getLog().warn( "Exception while updating local OBR: " + e.getLocalizedMessage(),
e );
+        }
+    }
+
+
+    private void updateLocalBundleMetadata( Artifact artifact, URI repoXml, URI obrXml, String
mavenRepo )
+        throws MojoExecutionException
+    {
+        if ( null == artifact.getFile() || artifact.getFile().isDirectory() )
+        {
+            return;
         }
+
+        getLog().info( "Updating: " + artifact );
+
+        URI bundleJar = ObrUtils.findBundleJar( localRepository, artifact );
+
+        Config userConfig = new Config();
+
+        ObrUpdate update = new ObrUpdate( repoXml, obrXml, project, bundleJar, mavenRepo,
userConfig, getLog() );
+        update.updateRepository();
     }
 }



Mime
View raw message