Author: jlboudart
Date: Thu Nov 22 20:44:31 2012
New Revision: 1412669
URL: http://svn.apache.org/viewvc?rev=1412669&view=rev
Log:
IVY-1391 - IvyPublish fails when using extend tags with no explicit location
attribute
Added:
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1-merged.xml
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1.xml
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/ivy.xml
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?rev=1412669&r1=1412668&r2=1412669&view=diff
==============================================================================
---
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
(original)
+++
ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
Thu Nov 22 20:44:31 2012
@@ -440,7 +440,7 @@ public class XmlModuleDescriptorParser e
DefaultExtendsDescriptor ed = new DefaultExtendsDescriptor(
parent,
- attributes.getValue("location"),
+ location,
(String[]) extendTypes.toArray(new
String[extendTypes.size()]),
local);
getMd().addInheritedDescriptor(ed);
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=1412669&r1=1412668&r2=1412669&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 Thu Nov
22 20:44:31 2012
@@ -247,6 +247,55 @@ public class IvyPublishTest extends Test
++lineNo;
}
}
+
+ public void testMergeParentWithoutLocationAttribute() throws IOException,
ParseException {
+ //See : IVY-XXX
+
+
+ IvyResolve resolve = new IvyResolve();
+ resolve.setProject(project);
+ resolve.setFile(new
File("test/java/org/apache/ivy/ant/extends/child1/ivy-child1.xml"));
+ resolve.execute();
+
+ //update=true implies merge=true
+ //project.setProperty("ivy.dep.file",
"test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml");
+ publish.setResolver("1");
+ publish.setUpdate(true);
+ publish.setPubrevision("1.2");
+ publish.setStatus("release");
+ publish.addArtifactspattern("${build}/[artifact].[ext]");
+ publish.execute();
+
+ // should have published the files with "1" resolver
+ File published = new
File("test/repositories/1/apache/child1/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("extends/child1/ivy-child1-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 testMinimalMerge() throws IOException, ParseException {
Added:
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1-merged.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1-merged.xml?rev=1412669&view=auto
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1-merged.xml
(added)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1-merged.xml
Thu Nov 22 20:44:31 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">
+
+ <info organisation="apache" module="child1" revision="1.2"
status="release">
+ <!-- <extends organisation="apache" module="extends-parent"
revision="1.0"/> -->
+
+ <!-- description inherited from parent -->
+ <description>Demonstrates configuration-specific
dependencies</description>
+ </info>
+
+ <configurations>
+ <!-- configurations inherited from apache#extends-parent;1.0 -->
+ <conf name="default" visibility="public"/>
+ <conf name="compile" visibility="public"/>
+ </configurations>
+
+ <publications/>
+
+ <dependencies>
+ <!-- dependencies inherited from apache#extends-parent;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/extends/child1/ivy-child1.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1.xml?rev=1412669&view=auto
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1.xml
(added)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/child1/ivy-child1.xml
Thu Nov 22 20:44:31 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">
+
+ <info module="child1">
+ <extends organisation="apache" module="extends-parent"
revision="latest.integration"/>
+ </info>
+
+ <publications/>
+
+</ivy-module>
\ No newline at end of file
Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/ivy.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/ivy.xml?rev=1412669&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/ivy.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/extends/ivy.xml Thu Nov 22
20:44:31 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">
+ <info organisation="apache"
+ module="extends-parent"
+ revision="1.0"
+ status="release"
+ >
+ <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>