mirror of https://github.com/apache/ant-ivy
IVY-1391 - IvyPublish fails when using extend tags with no explicit location attribute
git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/branches/2.3.x@1412668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6b358acb0d
commit
0393da7c84
2
.project
2
.project
|
|
@ -18,7 +18,7 @@
|
|||
under the License.
|
||||
-->
|
||||
<projectDescription>
|
||||
<name>ivy</name>
|
||||
<name>ivy-2.3.x</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ public class XmlModuleDescriptorParser extends AbstractModuleDescriptorParser {
|
|||
|
||||
DefaultExtendsDescriptor ed = new DefaultExtendsDescriptor(
|
||||
parent,
|
||||
attributes.getValue("location"),
|
||||
location,
|
||||
(String[]) extendTypes.toArray(new String[extendTypes.size()]),
|
||||
local);
|
||||
getMd().addInheritedDescriptor(ed);
|
||||
|
|
|
|||
|
|
@ -247,6 +247,55 @@ public class IvyPublishTest extends TestCase {
|
|||
++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 {
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
Loading…
Reference in New Issue