ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r1226251 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/core/deliver/ test/java/org/apache/ivy/ant/
Date Sun, 01 Jan 2012 14:25:49 GMT
Author: maartenc
Date: Sun Jan  1 14:25:49 2012
New Revision: 1226251

URL: http://svn.apache.org/viewvc?rev=1226251&view=rev
Log:
FIX: extra attributes lost from info when ivy file is merged with parent (IVY-1206)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-merged.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-parent.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-multiconf-extra-attributes.xml
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=1226251&r1=1226250&r2=1226251&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Sun Jan  1 14:25:49 2012
@@ -138,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: 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)
 - FIX: Maven 'eclipse-plugin', 'jbi-component' and 'jbi-shared-library' packaging is now
mapped to 'jar' extension (IVY-899)
 - FIX: Infinite loop in latest-compatible conflict manager (IVY-1233) (thanks to Payam Hekmat)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java?rev=1226251&r1=1226250&r2=1226251&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java Sun Jan  1
14:25:49 2012
@@ -118,7 +118,7 @@ public class DeliverEngine {
             ivyFileURL = ivyFile.toURI().toURL();
             md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, ivyFileURL,
                 options.isValidate());
-            md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(mrid, 
+            md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(md.getModuleRevisionId(),

                 options.getPubBranch() == null ? mrid.getBranch() : options.getPubBranch(),

                 revision));
             md.setResolvedPublicationDate(options.getPubdate());

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java?rev=1226251&r1=1226250&r2=1226251&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java Sun Jan  1 14:25:49
2012
@@ -308,6 +308,134 @@ public class IvyPublishTest extends Test
         }
     }
 
+    public void testMergeExtraAttributes() throws IOException, ParseException {
+        //publish the parent descriptor first, so that it can be found while
+        //we are reading the child descriptor.
+        project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
+        IvyResolve res = new IvyResolve();
+        res.setProject(project);
+        res.execute();
+
+        IvyPublish pubParent = new IvyPublish();
+        pubParent.setProject(project);
+        pubParent.setResolver("1");
+        pubParent.setPubrevision("1.0");
+        File art = new File("build/test/publish/resolve-simple-1.0.jar");
+        FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"), art,
null);
+        pubParent.execute();
+
+        //update=true implies merge=true
+        project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-extends-extra-attributes.xml");
+        res = new IvyResolve();
+        res.setProject(project);
+        res.execute();
+
+        publish.setResolver("1");
+        publish.setUpdate(true);
+        publish.setOrganisation("apache");
+        publish.setModule("resolve-minimal");
+        publish.setRevision("1.0");
+        publish.setPubrevision("1.2");
+        publish.setStatus("release");
+        publish.addArtifactspattern("build/test/publish/ivy-extends-extra-attributes.xml");
+        publish.setForcedeliver(true);
+        publish.execute();
+
+        // should have published the files with "1" resolver
+        File published = new File("test/repositories/1/apache/resolve-minimal/ivys/ivy-1.2.xml");
+        assertTrue(published.exists());
+
+        // do a text compare, since we want to test comments as well as structure.
+        // we could do a better job of this with xmlunit
+
+        int lineNo = 1;
+
+        BufferedReader merged = new BufferedReader(new FileReader(published));
+        BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
+            .getResourceAsStream("ivy-extends-extra-attributes-merged.xml")));
+        for (String mergeLine = merged.readLine(),
+                    expectedLine = expected.readLine();
+            mergeLine != null && expectedLine != null;
+            mergeLine = merged.readLine(),
+            expectedLine = expected.readLine()) {
+
+            //strip timestamps for the comparison
+            if (mergeLine.indexOf("<info") >= 0) {
+                mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
+            }
+            //discard whitespace-only lines
+            if (!(mergeLine.trim().equals("") && expectedLine.trim().equals("")))
{
+                assertEquals("published descriptor matches at line[" + lineNo + "]", expectedLine,
mergeLine);
+            }
+
+            ++lineNo;
+        }
+    }
+
+    public void testMergeExtraAttributesFromParent() throws IOException, ParseException {
+        //publish the parent descriptor first, so that it can be found while
+        //we are reading the child descriptor.
+        project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf-extra-attributes.xml");
+        IvyResolve res = new IvyResolve();
+        res.setProject(project);
+        res.execute();
+
+        IvyPublish pubParent = new IvyPublish();
+        pubParent.setProject(project);
+        pubParent.setResolver("1");
+        pubParent.setPubrevision("1.0");
+        File art = new File("build/test/publish/resolve-simple-1.0.jar");
+        FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"), art,
null);
+        pubParent.execute();
+
+        //update=true implies merge=true
+        project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-parent.xml");
+        res = new IvyResolve();
+        res.setProject(project);
+        res.execute();
+
+        publish.setResolver("1");
+        publish.setUpdate(true);
+        publish.setOrganisation("apache");
+        publish.setModule("resolve-minimal");
+        publish.setRevision("1.0");
+        publish.setPubrevision("1.2");
+        publish.setStatus("release");
+        publish.addArtifactspattern("build/test/publish/ivy-extends-extra-attributes.xml");
+        publish.setForcedeliver(true);
+        publish.execute();
+
+        // should have published the files with "1" resolver
+        File published = new File("test/repositories/1/apache/resolve-minimal/ivys/ivy-1.2.xml");
+        assertTrue(published.exists());
+
+        // do a text compare, since we want to test comments as well as structure.
+        // we could do a better job of this with xmlunit
+
+        int lineNo = 1;
+
+        BufferedReader merged = new BufferedReader(new FileReader(published));
+        BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
+            .getResourceAsStream("ivy-extends-extra-attributes-merged.xml")));
+        for (String mergeLine = merged.readLine(),
+                    expectedLine = expected.readLine();
+            mergeLine != null && expectedLine != null;
+            mergeLine = merged.readLine(),
+            expectedLine = expected.readLine()) {
+
+            //strip timestamps for the comparison
+            if (mergeLine.indexOf("<info") >= 0) {
+                mergeLine = mergeLine.replaceFirst("\\s?publication=\"\\d+\"", "");
+            }
+            //discard whitespace-only lines
+            if (!(mergeLine.trim().equals("") && expectedLine.trim().equals("")))
{
+                assertEquals("published descriptor matches at line[" + lineNo + "]", expectedLine,
mergeLine);
+            }
+
+            ++lineNo;
+        }
+    }
+
     public void testSimple() throws Exception {
         project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
         IvyResolve res = new IvyResolve();

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-merged.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-merged.xml?rev=1226251&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-merged.xml
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-merged.xml
Sun Jan  1 14:25:49 2012
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra"> 
+
+    <info organisation="apache" module="resolve-minimal" revision="1.2" status="release"
e:foo="bar">
+        <!-- <extends organisation="apache" module="resolve-simple" revision="1.0"/>
-->
+        
+        <!-- description inherited from parent -->
+        <description>Demonstrates configuration-specific dependencies</description>
+    </info>
+
+    <configurations>
+        <!-- configurations inherited from apache#resolve-simple;1.0 -->
+        <conf name="default" visibility="public"/>
+        <conf name="compile" visibility="public"/>
+    </configurations>
+
+    <publications/>
+  
+    <dependencies>
+        <!-- dependencies inherited from apache#resolve-simple;1.0 -->
+        <dependency org="org1" name="mod1.2" rev="2.0" conf="default->default"/>
+        <dependency org="org1" name="mod1.1" rev="2.0" transitive="false" conf="compile->default"/>
+    </dependencies>
+
+</ivy-module>
\ No newline at end of file

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-parent.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-parent.xml?rev=1226251&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-parent.xml
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes-parent.xml
Sun Jan  1 14:25:49 2012
@@ -0,0 +1,27 @@
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra"> 
+
+    <info module="resolve-minimal">
+        <extends organisation="apache" module="resolve-simple" revision="latest.integration"
/>
+    </info>
+
+    <publications/>
+
+</ivy-module>
\ No newline at end of file

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes.xml?rev=1226251&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-extends-extra-attributes.xml Sun Jan
 1 14:25:49 2012
@@ -0,0 +1,27 @@
+<!--
+   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.    
+-->
+<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra"> 
+
+    <info module="resolve-minimal" e:foo="bar">
+        <extends organisation="apache" module="resolve-simple" revision="latest.integration"
/>
+    </info>
+
+    <publications/>
+
+</ivy-module>
\ No newline at end of file

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-multiconf-extra-attributes.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-multiconf-extra-attributes.xml?rev=1226251&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-multiconf-extra-attributes.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivy-multiconf-extra-attributes.xml Sun
Jan  1 14:25:49 2012
@@ -0,0 +1,35 @@
+<!--
+   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.    
+-->
+<ivy-module version="1.0" xmlns:e="http://ant.apache.org/ivy/extra"> 
+	<info organisation="apache"
+	       module="resolve-simple"
+	       revision="1.0"
+	       status="release"
+	       e:foo="bar">
+        <description>Demonstrates configuration-specific dependencies</description>
+    </info>
+	<configurations>
+		<conf name="default" />
+		<conf name="compile" />
+	</configurations>
+	<dependencies>
+		<dependency org="org1" name="mod1.2" rev="2.0" conf="default" />
+		<dependency org="org1" name="mod1.1" rev="2.0" conf="compile->default" transitive="false"
/>
+	</dependencies>
+</ivy-module>



Mime
View raw message