Author: hibou
Date: Thu Apr 12 17:36:50 2012
New Revision: 1325396

URL: http://svn.apache.org/viewvc?rev=1325396&view=rev
Log:
Fix the example about managing an Eclipse plugin dependencies with Ivy

Modified:
    ant/ivy/core/trunk/doc/osgi/eclipse-plugin.html
    ant/ivy/core/trunk/doc/samples/eclipse-plugin/ivy.xml
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java

Modified: ant/ivy/core/trunk/doc/osgi/eclipse-plugin.html
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/osgi/eclipse-plugin.html?rev=1325396&r1=1325395&r2=1325396&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/osgi/eclipse-plugin.html (original)
+++ ant/ivy/core/trunk/doc/osgi/eclipse-plugin.html Thu Apr 12 17:36:50 2012
@@ -39,6 +39,7 @@ In few steps, we will setup a build to c
 <ol>
 <li>download this <a href="../samples/eclipse-plugin/ivy.xml">ivy.xml<a>, this 
<a href="../samples/eclipse-plugin/ivysettings.xml">ivysettings.xml</a>, this 
<a 
href="../samples/eclipse-plugin/ivysettings.properties">ivysettings.properties</a>,
 this <a href="../samples/eclipse-plugin/build.xml">build.xml</a>, and put them 
into your plugin folder;</li>
 <li>in the ivysettings.properties, specify the location of the plugins folder 
of your Eclipse target;</li>
+<li>in the ivy.xml, change the symbolic name declared in the extends 
element;</li>
 <li><i>(optional)</i> by default the build.xml is expecting the sources to be 
in the <tt>src</tt> folder. You may want to edit it if it is not the case</li>
 <li><i>(optional)</i> if Ivy is not in Ant's classpath, get the jar of <a 
href="../download.html">Apache Ivy</a> and edit the build.xml accordingly (see 
the comments at the begining of the file)</li>
 </ol>

Modified: ant/ivy/core/trunk/doc/samples/eclipse-plugin/ivy.xml
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/samples/eclipse-plugin/ivy.xml?rev=1325396&r1=1325395&r2=1325396&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/samples/eclipse-plugin/ivy.xml (original)
+++ ant/ivy/core/trunk/doc/samples/eclipse-plugin/ivy.xml Thu Apr 12 17:36:50 
2012
@@ -18,8 +18,8 @@
    under the License.    
 -->
 <ivy-module version="2.2" xmlns:o="http://ant.apache.org/ivy/osgi";>
-    <info organisation="" module="myplugin">
-        <extends organisation="" module="myplugin" revision="1.0.0.qualifier" 
location="META-INF/MANIFEST.MF" />
+    <info organisation="bundle" module="myplugin">
+        <extends organisation="bundle" module="com.acme.myplugin" 
revision="1.0.0.qualifier" location="META-INF/MANIFEST.MF" />
     </info>
     <configurations>
         <conf name="compile"  extends="default,embedded" 
description="Dependencies for the compilation" />

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java?rev=1325396&r1=1325395&r2=1325396&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java 
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/ConvertManifestTask.java Thu 
Apr 12 17:36:50 2012
@@ -30,6 +30,7 @@ import org.apache.ivy.osgi.core.BundleIn
 import org.apache.ivy.osgi.core.BundleInfoAdapter;
 import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
 import org.apache.ivy.osgi.core.ManifestParser;
+import org.apache.ivy.osgi.core.OSGiManifestParser;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
 import org.apache.tools.ant.BuildException;
 
@@ -83,7 +84,8 @@ public class ConvertManifestTask extends
         } catch (ParseException e) {
             throw new BuildException("Incorrect manifest file '" + manifest + 
"'", e);
         }
-        ModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(null, 
bundleInfo, profileProvider);
+        ModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
+            OSGiManifestParser.getInstance(), null, bundleInfo, 
profileProvider);
 
         try {
             XmlModuleDescriptorWriter.write(md, ivyFile);

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java?rev=1325396&r1=1325395&r2=1325396&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java 
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java 
Thu Apr 12 17:36:50 2012
@@ -43,6 +43,7 @@ import org.apache.ivy.osgi.util.Version;
 import org.apache.ivy.osgi.util.VersionRange;
 import org.apache.ivy.plugins.matcher.ExactOrRegexpPatternMatcher;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
 
 public class BundleInfoAdapter {
 
@@ -72,12 +73,13 @@ public class BundleInfoAdapter {
      *            uri to help build the absolute url if the bundle info has a 
relative uri.
      * @param bundle
      * @param profileProvider
+     * @param parser 
      * @return
      * @throws ProfileNotFoundException
      */
-    public static DefaultModuleDescriptor toModuleDescriptor(URI baseUri, 
BundleInfo bundle,
+    public static DefaultModuleDescriptor 
toModuleDescriptor(ModuleDescriptorParser parser, URI baseUri, BundleInfo 
bundle,
             ExecutionEnvironmentProfileProvider profileProvider) throws 
ProfileNotFoundException {
-        DefaultModuleDescriptor md = new DefaultModuleDescriptor(null, null);
+        DefaultModuleDescriptor md = new DefaultModuleDescriptor(parser, null);
         md.addExtraAttributeNamespace("o", Ivy.getIvyHomeURL() + "osgi");
         ModuleRevisionId mrid = asMrid(BundleInfo.BUNDLE_TYPE, 
bundle.getSymbolicName(), bundle.getVersion());
         md.setResolvedPublicationDate(new Date());

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java?rev=1325396&r1=1325395&r2=1325396&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java 
(original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java 
Thu Apr 12 17:36:50 2012
@@ -68,7 +68,7 @@ public class OSGiManifestParser implemen
         } catch (URISyntaxException e) {
             throw new RuntimeException("Unsupported repository, resources 
names are not uris", e);
         }
-        return BundleInfoAdapter.toModuleDescriptor(null, bundleInfo, 
profileProvider);
+        return BundleInfoAdapter.toModuleDescriptor(this, null, bundleInfo, 
profileProvider);
     }
 
     public void toIvyFile(InputStream is, Resource res, File destFile, 
ModuleDescriptor md)

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java?rev=1325396&r1=1325395&r2=1325396&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java 
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java 
Thu Apr 12 17:36:50 2012
@@ -30,6 +30,7 @@ import org.apache.ivy.osgi.core.BundleCa
 import org.apache.ivy.osgi.core.BundleInfo;
 import org.apache.ivy.osgi.core.BundleInfoAdapter;
 import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
+import org.apache.ivy.osgi.core.OSGiManifestParser;
 import org.apache.ivy.util.Message;
 
 public class RepoDescriptor {
@@ -96,8 +97,8 @@ public class RepoDescriptor {
     }
 
     public void addBundle(BundleInfo bundleInfo) {
-        DefaultModuleDescriptor md = 
BundleInfoAdapter.toModuleDescriptor(baseUri, bundleInfo,
-            profileProvider);
+        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
+            OSGiManifestParser.getInstance(), baseUri, bundleInfo, 
profileProvider);
         add(BundleInfo.BUNDLE_TYPE, bundleInfo.getSymbolicName(), md);
         Iterator itCapability = bundleInfo.getCapabilities().iterator();
         while (itCapability.hasNext()) {

Modified: 
ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java?rev=1325396&r1=1325395&r2=1325396&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java 
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java 
Thu Apr 12 17:36:50 2012
@@ -48,6 +48,7 @@ import org.apache.ivy.core.settings.IvyS
 import org.apache.ivy.osgi.core.BundleInfo;
 import org.apache.ivy.osgi.core.BundleInfoAdapter;
 import org.apache.ivy.osgi.core.ManifestParser;
+import org.apache.ivy.osgi.core.OSGiManifestParser;
 import org.apache.ivy.osgi.repo.AbstractOSGiResolver.RequirementStrategy;
 import org.apache.ivy.plugins.resolver.DependencyResolver;
 import org.apache.ivy.plugins.resolver.DualResolver;
@@ -282,7 +283,8 @@ public class OBRResolverTest extends Tes
                 + jarName));
         BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
         bundleInfo.setUri(new File("test/test-repo/bundlerepo/" + 
jarName).toURI());
-        DefaultModuleDescriptor md = 
BundleInfoAdapter.toModuleDescriptor(null, bundleInfo, null);
+        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
+            OSGiManifestParser.getInstance(), null, bundleInfo, null);
         ResolveReport resolveReport = ivy.resolve(md,
             new ResolveOptions().setConfs(new String[] 
{conf}).setOutputReport(false));
         assertFalse("resolve failed " + resolveReport.getAllProblemMessages(),
@@ -313,7 +315,8 @@ public class OBRResolverTest extends Tes
                 + jarName));
         BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
         bundleInfo.setUri(new File("test/test-repo/bundlerepo/" + 
jarName).toURI());
-        DefaultModuleDescriptor md = 
BundleInfoAdapter.toModuleDescriptor(null, bundleInfo, null);
+        DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
+            OSGiManifestParser.getInstance(), null, bundleInfo, null);
         ResolveReport resolveReport = ivy.resolve(md,
             new ResolveOptions().setConfs(new String[] 
{conf}).setOutputReport(false));
         assertTrue(resolveReport.hasError());


Reply via email to