You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2012/02/14 23:40:54 UTC

svn commit: r1244251 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/retrieve/ src/java/org/apache/ivy/plugins/resolver/packager/ test/java/org/apache/ivy/ant/ test/repositories/m2/

Author: maartenc
Date: Tue Feb 14 22:40:53 2012
New Revision: 1244251

URL: http://svn.apache.org/viewvc?rev=1244251&view=rev
Log:
FIX: [originalname] not expanded for source and javadoc types during publish in ivy:install (IVY-1324)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java
    ant/ivy/core/trunk/test/repositories/m2/ivysettings.xml

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1244251&r1=1244250&r2=1244251&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Feb 14 22:40:53 2012
@@ -65,7 +65,6 @@ for detailed view of each issue, please 
 	Gregory Kisling
 	Stepan Koltsov
 	Heschi Kreinick
-	Sebastian Krueger
 	Tat Leung
 	Costin Leau
 	Antoine Levy-Lambert
@@ -139,6 +138,7 @@ for detailed view of each issue, please 
 - IMPROVEMENT: ivy:retrieve can now convert 'dotted'-organisation names into a directory tree.
 - IMPROVEMENT: ivy:retrieve now accepts a nested mapper type.
 
+- FIX: [originalname] not expanded for source and javadoc types during publish in ivy:install (IVY-1324)
 - FIX: cannot resolve from repositories that return HTTP 204 in response to an HTTP HEAD request (IVY-1328)
 - FIX: extra attributes lost from info when ivy file is merged with parent (IVY-1206)
 - FIX: ivy:report ant task intermittently "cannot compile stylesheet" (IVY-1325)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java?rev=1244251&r1=1244250&r2=1244251&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java Tue Feb 14 22:40:53 2012
@@ -300,7 +300,7 @@ public class IvyReport extends IvyTask {
         
         return IvyPatternHelper.substitute(
             outputpattern, mRevId.getOrganisation(), mRevId.getName(),
-            mRevId.getRevision(), "", "", ext, conf, mRevId.getAttributes(), null);
+            mRevId.getRevision(), "", "", ext, conf, mRevId.getQualifiedExtraAttributes(), null);
     }
 
     private void genStyled(String[] confs, File style, String ext) throws IOException {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java?rev=1244251&r1=1244250&r2=1244251&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java Tue Feb 14 22:40:53 2012
@@ -19,6 +19,7 @@ package org.apache.ivy.core;
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Stack;
@@ -69,7 +70,7 @@ public final class IvyPatternHelper {
     public static String substitute(String pattern, ModuleRevisionId moduleRevision) {
         return substitute(pattern, moduleRevision.getOrganisation(), moduleRevision.getName(),
             moduleRevision.getBranch(), moduleRevision.getRevision(), "ivy", "ivy", "xml", null,
-            null, moduleRevision.getAttributes(), null);
+            null, moduleRevision.getQualifiedExtraAttributes(), null);
     }
 
     public static String substitute(String pattern, ModuleRevisionId moduleRevision,
@@ -98,7 +99,7 @@ public final class IvyPatternHelper {
             String conf, ArtifactOrigin origin) {
         return substitute(pattern, mrid.getOrganisation(), mrid.getName(), mrid.getBranch(), mrid
                 .getRevision(), artifact.getName(), artifact.getType(), artifact.getExt(), conf,
-            origin, mrid.getExtraAttributes(), artifact.getExtraAttributes());
+            origin, mrid.getQualifiedExtraAttributes(), artifact.getQualifiedExtraAttributes());
     }
 
     public static String substitute(String pattern, String org, String module, String revision,
@@ -126,10 +127,24 @@ public final class IvyPatternHelper {
             ArtifactOrigin origin, Map extraModuleAttributes, Map extraArtifactAttributes) {
         Map tokens = new HashMap();
         if (extraModuleAttributes != null) {
-            tokens.putAll(extraModuleAttributes);
+            for (Iterator entries = extraModuleAttributes.entrySet().iterator(); entries.hasNext(); ) {
+                Map.Entry entry = (Map.Entry) entries.next();
+                String token = (String) entry.getKey();
+                if (token.indexOf(':') > 0) {
+                    token = token.substring(token.indexOf(':') + 1);
+                }
+                tokens.put(token, entry.getValue());
+            }
         }
         if (extraArtifactAttributes != null) {
-            tokens.putAll(extraArtifactAttributes);
+            for (Iterator entries = extraArtifactAttributes.entrySet().iterator(); entries.hasNext(); ) {
+                Map.Entry entry = (Map.Entry) entries.next();
+                String token = (String) entry.getKey();
+                if (token.indexOf(':') > 0) {
+                    token = token.substring(token.indexOf(':') + 1);
+                }
+                tokens.put(token, entry.getValue());
+            }
         }
         tokens.put(ORGANISATION_KEY, org == null ? "" : org);
         tokens.put(ORGANISATION_KEY2, org == null ? "" : org);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java?rev=1244251&r1=1244250&r2=1244251&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java Tue Feb 14 22:40:53 2012
@@ -323,7 +323,7 @@ public class RetrieveEngine {
                     String org = mRevId.getOrganisation() == null ? null : mRevId.getOrganisation().replace('.', '/');
                     destFileName = IvyPatternHelper.substitute(destPattern, org, mRevId.getName(), mRevId.getBranch(),
                             mRevId.getRevision(), artifact.getName(), artifact.getType(), artifact.getExt(), conf,
-                            artifact.getArtifactOrigin(), mrid.getExtraAttributes(), artifact.getArtifact().getExtraAttributes());
+                            artifact.getArtifactOrigin(), mrid.getQualifiedExtraAttributes(), artifact.getArtifact().getQualifiedExtraAttributes());
                 } else {
                     throw new IllegalArgumentException("Unsupported dirMode: " + options.getDirMode());
                 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java?rev=1244251&r1=1244250&r2=1244251&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/packager/PackagerCacheEntry.java Tue Feb 14 22:40:53 2012
@@ -217,9 +217,9 @@ public class PackagerCacheEntry {
     }
 
     private String getResourceURL() {
-        String baseURL = IvyPatternHelper.substitute(this.resourceURL, this.mr.getOrganisation(),
-          this.mr.getName(), this.mr.getRevision(), null, null, null, null,
-          this.mr.getAttributes(), null);
+        String baseURL = IvyPatternHelper.substitute(resourceURL, mr.getOrganisation(),
+                mr.getName(), mr.getRevision(), null, null, null, null,
+                mr.getQualifiedExtraAttributes(), null);
         int slash = baseURL.lastIndexOf('/');
         if (slash != -1) {
             baseURL = baseURL.substring(0, slash + 1);

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java?rev=1244251&r1=1244250&r2=1244251&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java Tue Feb 14 22:40:53 2012
@@ -112,6 +112,24 @@ public class IvyInstallTest extends Test
         assertTrue(new File("build/test/install/org8/mod8.1/a-1.1.txt").exists());        
     }
 
+    public void testInstallWithClassifiers() {
+        // IVY-1324
+        project.setProperty("ivy.settings.file", "test/repositories/m2/ivysettings.xml");
+        install.setOrganisation("org.apache");
+        install.setModule("test-sources");
+        install.setRevision("1.0");
+        install.setType("*");
+        install.setFrom("m2");
+        install.setTo("IVY-1324");
+
+        install.execute();
+        
+        assertTrue(new File("build/test/install/org.apache/test-sources/test-sources-1.0-javadoc.jar").exists());        
+        assertTrue(new File("build/test/install/org.apache/test-sources/test-sources-1.0-sources.jar").exists());        
+        assertTrue(new File("build/test/install/org.apache/test-sources/test-sources-1.0.jar").exists());        
+        assertTrue(new File("build/test/install/org.apache/test-sources/ivy-1.0.xml").exists());        
+    }
+
     public void testInstallWithUnusedType() {
         project.setProperty("ivy.settings.file", "test/repositories/ivysettings-dummydefaultresolver.xml");
         install.setOrganisation("org8");

Modified: ant/ivy/core/trunk/test/repositories/m2/ivysettings.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/m2/ivysettings.xml?rev=1244251&r1=1244250&r2=1244251&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/m2/ivysettings.xml (original)
+++ ant/ivy/core/trunk/test/repositories/m2/ivysettings.xml Tue Feb 14 22:40:53 2012
@@ -20,6 +20,10 @@
 	<settings defaultCache="${ivy.basedir}/build/cache" defaultResolver="m2"/>
 	<resolvers>
 		<ibiblio name="m2" m2compatible="true" useMavenMetadata="true" 
-		         root="${ivy.settings.dir}" />
+		         root="${ivy.settings.url}/.." />
+        <filesystem name="IVY-1324">
+            <ivy pattern="${ivy.basedir}/build/test/install/[organisation]/[module]/[artifact]-[revision].[ext]"/>
+            <artifact pattern="${ivy.basedir}/build/test/install/[organisation]/[module]/[originalname].[ext]"/>
+        </filesystem>
 	</resolvers>
 </ivysettings>