ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r674852 - in /ant/ivy/core/trunk: ./ doc/ivyfile/ src/java/org/apache/ivy/plugins/parser/xml/ test/java/org/apache/ivy/plugins/parser/xml/
Date Tue, 08 Jul 2008 15:04:43 GMT
Author: xavier
Date: Tue Jul  8 08:04:42 2008
New Revision: 674852

URL: http://svn.apache.org/viewvc?rev=674852&view=rev
Log:
IMPROVEMENT: Add defaultconf in publications tag of ivy file (IVY-801)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-publication-defaultconf.xml
  (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/doc/ivyfile/artifact.html
    ant/ivy/core/trunk/doc/ivyfile/publications.html
    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=674852&r1=674851&r2=674852&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Jul  8 08:04:42 2008
@@ -77,6 +77,7 @@
 - NEW: Add transitive dependency version and branch override mechanism (IVY-784)
 - NEW: Add new packager resolver (IVY-829) (thanks to Archie Cobbs)
 
+- IMPROVEMENT: Add defaultconf in publications tag of ivy file (IVY-801)
 - IMPROVEMENT: Support atomic publish with sub directory structure (IVY-856)
 - IMPROVEMENT: Provide ant task to retrieve information from published ivy modules (IVY-838)
(thanks to David Maplesden)
 - IMPROVEMENT: Install task fails but reason is not displayed without using -debug or -verbose
(IVY-834)

Modified: ant/ivy/core/trunk/doc/ivyfile/artifact.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/ivyfile/artifact.html?rev=674852&r1=674851&r2=674852&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/ivyfile/artifact.html (original)
+++ ant/ivy/core/trunk/doc/ivyfile/artifact.html Tue Jul  8 08:04:42 2008
@@ -58,7 +58,7 @@
         <td>No, defaults to type</td></tr>
     <tr><td>conf</td><td>comma separated list of public configurations
in which this artifact is published.
     	'*' wildcard can be used to designate all public configurations of this module</td>
-        <td>No, defaults to '*' if neither conf attribute nor conf children element
is given</td></tr>
+        <td>No, defaults to defaultconf attribute value on parent publications element.</td></tr>
     <tr><td>url</td><td>a url at which this artifact can be found
if it isn't located at the standard location in the repository <span class="since">since
1.4</span></td>
         <td>No, defaults to no url</td></tr>
 </tbody>

Modified: ant/ivy/core/trunk/doc/ivyfile/publications.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/ivyfile/publications.html?rev=674852&r1=674851&r2=674852&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/ivyfile/publications.html (original)
+++ ant/ivy/core/trunk/doc/ivyfile/publications.html Tue Jul  8 08:04:42 2008
@@ -28,18 +28,28 @@
 <b>Tag:</b> publications <b>Parent:</b> <a href="../ivyfile.html">ivy-module</a><br/><br/>
 
 Container for artifact elements, used to describe the artifacts published by this module.

-If this container is not present, it is assumed that the module has one artifact, with the
same name
-as the module, and published in all module configurations.<br/>
-Thus if you have a module which publishes no artifacts (a sort of virtual module, 
-made only to integrate several other modules as a whole), you have to include
-a publications element with no artifact sub element.
+
+If this container is not present, it is assumed that the module has one artifact, with the
same name as the module, and published in all module configurations.<br/>
+
+Thus if you have a module which publishes no artifacts (a sort of virtual module, made only
to integrate several other modules as a whole), you have to include a publications element
with no artifact sub element.
+<h1>Attributes</h1>
+<table class="ivy-attributes">
+<thead>
+    <tr><th class="ivy-att">Attribute</th><th class="ivy-att-desc">Description</th><th
class="ivy-att-req">Required</th></tr>
+</thead>
+<tbody>
+    <tr><td>defaultconf</td><td>comma separated list of public configurations
in which artifacts are published by default (when no specific configurations are set on the
artifact element).
+    	'*' wildcard can be used to designate all public configurations of this module. <span
class="since">since 2.0</span></td>
+        <td>No, defaults to '*'</td></tr>
+</tbody>
+</table>
 <h1>Child elements</h1>
 <table class="ivy-children">
 <thead>
     <tr><th class="ivy-chld">Element</th><th class="ivy-chld-desc">Description</th><th
class="ivy-chld-card">Cardinality</th></tr>
 </thead>
 <tbody>
-    <tr><td>artifact</td><td>declares a published artifact for this
module</td>
+    <tr><td>[[ivyfile/artifact]]</td><td>declares a published artifact
for this module</td>
         <td>0..n</td></tr>
 </tbody>
 </table>

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=674852&r1=674851&r2=674852&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
Tue Jul  8 08:04:42 2008
@@ -193,6 +193,8 @@
         private StringBuffer buffer;
 
         private String descriptorVersion;
+
+        private String[] publicationsDefaultConf;
         
         
 
@@ -294,9 +296,7 @@
                 } else if ("configurations".equals(qName)) {
                     configurationStarted(attributes);
                 } else if ("publications".equals(qName)) {
-                    state = PUB;
-                    artifactsDeclared = true;
-                    checkConfigurations();
+                    publicationsStarted(attributes);
                 } else if ("dependencies".equals(qName)) {
                     dependenciesStarted(attributes);
                 } else if ("conflicts".equals(qName)) {
@@ -344,6 +344,20 @@
             }
         }
 
+        private void publicationsStarted(Attributes attributes) {
+            state = PUB;
+            artifactsDeclared = true;
+            checkConfigurations();
+            String defaultConf = ivy.substitute(attributes.getValue("defaultconf"));
+            if (defaultConf != null) {
+                setPublicationsDefaultConf(defaultConf);
+            }
+        }
+
+        private void setPublicationsDefaultConf(String defaultConf) {
+            this.publicationsDefaultConf = defaultConf == null ? null : defaultConf.split(",");
+        }
+
         private boolean isOtherNamespace(String qName) {
             return qName.indexOf(':') != -1;
         }
@@ -778,10 +792,12 @@
         public void endElement(String uri, String localName, String qName) throws SAXException
{
             if (state == PUB && "artifact".equals(qName)
                     && artifact.getConfigurations().length == 0) {
-                String[] confs = getMd().getConfigurationsNames();
+                String[] confs = publicationsDefaultConf == null 
+                    ? getMd().getConfigurationsNames()
+                    : publicationsDefaultConf;
                 for (int i = 0; i < confs.length; i++) {
-                    artifact.addConfiguration(confs[i]);
-                    getMd().addArtifact(confs[i], artifact);
+                    artifact.addConfiguration(confs[i].trim());
+                    getMd().addArtifact(confs[i].trim(), artifact);
                 }
             } else if ("configurations".equals(qName)) {
                 checkConfigurations();

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=674852&r1=674851&r2=674852&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 Tue Jul  8 08:04:42
2008
@@ -141,6 +141,7 @@
 				            	</xs:complexType>
 				      		</xs:element>
 				        </xs:sequence>
+						<xs:attribute name="defaultconf" type="xs:string"/>				  
 			      </xs:complexType>
       		</xs:element>
       		<xs:element name="dependencies" minOccurs="0">

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=674852&r1=674851&r2=674852&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
Tue Jul  8 08:04:42 2008
@@ -623,6 +623,24 @@
                 .getDependencyConfigurations("test")));
     }
 
+    public void testPublicationDefaultConf() throws Exception {
+        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
+            getClass().getResource("test-publication-defaultconf.xml"), true);
+        assertNotNull(md);
+
+        Artifact[] artifacts = md.getArtifacts("default");
+        assertNotNull(artifacts);
+        assertEquals(3, artifacts.length);
+
+        artifacts = md.getArtifacts("test");
+        assertNotNull(artifacts);
+        assertEquals(2, artifacts.length);
+        
+        artifacts = md.getArtifacts("other");
+        assertNotNull(artifacts);
+        assertEquals(1, artifacts.length);
+    }
+
     public void testDefaultConfMapping() throws Exception {
         ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings,
             getClass().getResource("test-defaultconfmapping.xml"), true);

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-publication-defaultconf.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-publication-defaultconf.xml?rev=674852&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-publication-defaultconf.xml
(added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-publication-defaultconf.xml
Tue Jul  8 08:04:42 2008
@@ -0,0 +1,37 @@
+<?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>
+		<conf name="default"/>
+		<conf name="test"/>
+		<conf name="other"/>
+	</configurations>
+	<publications defaultconf="default,test">
+		<artifact name="art1" type="jar" />
+		<artifact name="art2" type="jar" />
+		<artifact name="art3" type="jar" conf="default,other" />
+	</publications>
+</ivy-module>

Propchange: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-publication-defaultconf.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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



Mime
View raw message