ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r828822 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/parser/ src/java/org/apache/ivy/plugins/parser/xml/ test/java/org/apache/ivy/plugins/parser/xml/
Date Thu, 22 Oct 2009 19:18:20 GMT
Author: maartenc
Date: Thu Oct 22 19:18:19 2009
New Revision: 828822

URL: http://svn.apache.org/viewvc?rev=828822&view=rev
Log:
IMPROVEMENT: use defaultconf in combination with defaultconfmapping (IVY-1135) (thanks to
Jon Schneider)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml
  (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=828822&r1=828821&r2=828822&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Oct 22 19:18:19 2009
@@ -94,6 +94,8 @@
 	
    trunk
 =====================================
+- IMPROVEMENT: use defaultconf in combination with defaultconfmapping (IVY-1135) (thanks
to Jon Schneider)
+
 - FIX: Ivy couldn't handle maven POMs that depend on theirselves
 - FIX: SearchEngine.listModules returns MRID without extra attributes (IVY-1128) (thanks
to Michael Scheetz)
 - FIX: IvyBuildNumber non-deterministic behaviour (IVY-1120)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java?rev=828822&r1=828821&r2=828822&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/AbstractModuleDescriptorParser.java
Thu Oct 22 19:18:19 2009
@@ -330,8 +330,8 @@
         } // getLocationString(SAXParseException):String
 
         protected String getDefaultConf() {
-            return defaultConfMapping != null ? defaultConfMapping
-                    : (defaultConf != null ? defaultConf : DEFAULT_CONF_MAPPING);
+            return defaultConf != null ? defaultConf 
+                    : (defaultConfMapping != null ? defaultConfMapping : DEFAULT_CONF_MAPPING);
         }
 
         protected void setDefaultConf(String defaultConf) {

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=828822&r1=828821&r2=828822&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 Oct 22 19:18:19 2009
@@ -191,7 +191,7 @@
         }
 
         protected static final List ALLOWED_VERSIONS = Arrays.asList(
-            new String[] {"1.0", "1.1", "1.2", "1.3", "1.4", "2.0"});
+            new String[] {"1.0", "1.1", "1.2", "1.3", "1.4", "2.0", "2.1"});
 
         /* how and what do we have to parse */
         private ParserSettings settings;
@@ -436,10 +436,15 @@
                 getMd().addConfiguration(configs[i]);
             }
             if (parser.getDefaultConfMapping() != null) {
-                Message.debug("setting default conf from imported configurations file: "
+                Message.debug("setting default conf mapping from imported configurations
file: "
                         + parser.getDefaultConfMapping());
                 setDefaultConfMapping(parser.getDefaultConfMapping());
             }
+            if (parser.getDefaultConf() != null) {
+                Message.debug("setting default conf from imported configurations file: "
+                        + parser.getDefaultConf());
+                setDefaultConf(parser.getDefaultConf());
+            }
             if (parser.getMd().isMappingOverride()) {
                 Message.debug("enabling mapping-override from imported configurations" 
                         + " file");
@@ -622,6 +627,7 @@
             state = State.CONF;
             setDefaultConfMapping(settings
                     .substitute(attributes.getValue("defaultconfmapping")));
+            setDefaultConf(settings.substitute(attributes.getValue("defaultconf")));
             getMd()
                     .setMappingOverride(Boolean.valueOf(
                         settings.substitute(attributes.getValue("confmappingoverride")))

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd?rev=828822&r1=828821&r2=828822&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd Thu Oct 22 19:18:19
2009
@@ -116,6 +116,7 @@
 					      		</xs:element>
 					      	</xs:choice>
 				        </xs:sequence>
+				        <xs:attribute name="defaultconf" type="xs:string"/>
 						<xs:attribute name="defaultconfmapping" type="xs:string"/>				  
 						<xs:attribute name="confmappingoverride" type="xs:boolean" />      
 			      </xs:complexType>

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java?rev=828822&r1=828821&r2=828822&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
Thu Oct 22 19:18:19 2009
@@ -560,6 +560,36 @@
                 + "/" + artifact.getExt());
     }
 
+    public void testDefaultConfWithDefaultConfMapping() throws Exception {
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
+            getClass().getResource("test-defaultconf-withdefaultconfmapping.xml"), true);
+        assertNotNull(md);
+        
+        DependencyDescriptor[] dependencies = md.getDependencies();
+        assertNotNull(dependencies);
+        assertEquals(2, dependencies.length);
+
+        // no conf def => defaults to defaultConf: default
+        DependencyDescriptor dd = getDependency(dependencies, "mymodule1");
+        assertNotNull(dd);
+        assertEquals("myorg", dd.getDependencyId().getOrganisation());
+        assertEquals("1.0", dd.getDependencyRevisionId().getRevision());
+        assertEquals(Arrays.asList(new String[] {"default"}), Arrays.asList(dd
+                .getModuleConfigurations()));
+        assertEquals(Arrays.asList(new String[] {"default"}), Arrays.asList(dd
+                .getDependencyConfigurations("default")));
+
+        // confs def: *->*
+        dd = getDependency(dependencies, "mymodule2");
+        assertNotNull(dd);
+        assertEquals("myorg", dd.getDependencyId().getOrganisation());
+        assertEquals("2.0", dd.getDependencyRevisionId().getRevision());
+        assertEquals(Arrays.asList(new String[] {"test"}), 
+                     Arrays.asList(dd.getModuleConfigurations()));
+        assertEquals(Arrays.asList(new String[] {"default"}),
+            Arrays.asList(dd.getDependencyConfigurations("test")));        
+    }
+    
     public void testDefaultConf() throws Exception {
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
             getClass().getResource("test-defaultconf.xml"), true);

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml?rev=828822&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml
Thu Oct 22 19:18:19 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml-stylesheet type="text/xsl" href="http://www.jayasoft.fr/org/ivyrep/ivy-doc.xsl"?>
+<!--
+   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="myorg"
+	       module="mymodule"
+	       revision="myrev"
+	       status="integration"
+	       publication="20041101110000"/>
+	<configurations defaultconfmapping="test->default" defaultconf="default">
+		<conf name="default"/>
+		<conf name="test"/>
+	</configurations>
+	<dependencies>
+		<dependency name="mymodule1" rev="1.0"/>
+		<dependency name="mymodule2" rev="2.0" conf="test"/>
+	</dependencies>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message