Author: xavier
Date: Tue Jul 3 07:32:47 2007
New Revision: 552853
URL: http://svn.apache.org/viewvc?view=rev&rev=552853
Log:
- FIX: XmlModuleDescriptorWriter does not produce matcher attribute on include
and exclude rules (IVY-556)
- review module wide exclude syntax: use exclude tags in dependencies element
(IVY-431)
Modified:
incubator/ivy/core/trunk/CHANGES.txt
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update.xml
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-full.xml
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test.xml
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/updated.xml
incubator/ivy/core/trunk/test/repositories/1/org2/mod2.6/ivys/ivy-0.11.xml
Modified: incubator/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Tue Jul 3 07:32:47 2007
@@ -64,6 +64,7 @@
- IMPROVEMENT: Javadoc improvements (IVY-544) (with contribution from Tjeerd
Verhagen)
- IMPROVEMENT: Unit test improvements (IVY-545) (thanks to Tjeerd Verhagen)
+- FIX: XmlModuleDescriptorWriter does not produce matcher attribute on include
and exclude rules (IVY-556)
- FIX: pom.groupId is not recognized in maven 2 pom parser (IVY-550)
- FIX: Evicted modules report depends on the order of the dependencies
(IVY-526)
- FIX: Ivy does not work on Turkish machines (IVY-65)
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
Tue Jul 3 07:32:47 2007
@@ -173,6 +173,8 @@
private static final int EXCLUDE = 9;
+ private static final int DEPS = 10;
+
private int _state = NONE;
private final URL xmlURL;
@@ -317,7 +319,7 @@
_artifactsDeclared = true;
checkConfigurations();
} else if ("dependencies".equals(qName)) {
- _state = DEP;
+ _state = DEPS;
String defaultConf =
_ivy.substitute(attributes.getValue("defaultconf"));
if (defaultConf != null) {
setDefaultConf(defaultConf);
@@ -335,9 +337,6 @@
} else if ("conflicts".equals(qName)) {
_state = CONFLICT;
checkConfigurations();
- } else if ("exclude".equals(qName) && _state != DEP) {
- _state = EXCLUDE;
- checkConfigurations();
} else if ("artifact".equals(qName)) {
if (_state == PUB) {
// this is a published artifact
@@ -377,7 +376,12 @@
addIncludeRule(qName, attributes);
} else if ("exclude".equals(qName) && _state == DEP) {
addExcludeRule(qName, attributes);
- } else if ("dependency".equals(qName)) {
+ } else if ("exclude".equals(qName) && _state == DEPS) {
+ _state = EXCLUDE;
+ parseRule(qName, attributes);
+ md.addExcludeRule((ExcludeRule) _confAware);
+ } else if ("dependency".equals(qName)) {
+ _state = DEP;
String org = _ivy.substitute(attributes.getValue("org"));
if (org == null) {
org = md.getModuleRevisionId().getOrganisation();
@@ -490,10 +494,7 @@
return;
}
md.addConflictManager(new ModuleId(org, mod), matcher, cm);
- } else if ("rule".equals(qName) && _state == EXCLUDE) {
- parseRule(qName, attributes);
- md.addExcludeRule((ExcludeRule) _confAware);
- } else if ("include".equals(qName) && _state == CONF) {
+ } else if ("include".equals(qName) && _state == CONF) {
URL url = _ivy.getRelativeUrlResolver().getURL(xmlURL,
_ivy.substitute(attributes.getValue("file")),
_ivy.substitute(attributes.getValue("url")));
@@ -583,7 +584,7 @@
Map extraAtt =
ExtendableItemHelper.getExtraAttributes(attributes, new String[] {
"org", "module", "name", "type", "ext", "matcher",
"conf"});
_confAware = new DefaultIncludeRule(aid, matcher, extraAtt);
- } else { // _state == ARTIFACT_EXCLUDE
+ } else { // _state == ARTIFACT_EXCLUDE || EXCLUDE
PatternMatcher matcher =
getPatternMatcher(attributes.getValue("matcher"));
String org = _ivy.substitute(attributes.getValue("org"));
org = org == null ? PatternMatcher.ANY_EXPRESSION : org;
@@ -663,7 +664,7 @@
}
}
_confAware = null;
- } else if (_state == EXCLUDE && "rule".equals(qName)) {
+ } else if (_state == EXCLUDE) {
if (_confAware.getConfigurations().length == 0) {
String[] confs = md.getConfigurationsNames();
for (int i = 0; i < confs.length; i++) {
@@ -671,8 +672,12 @@
}
}
_confAware = null;
- } else if ("dependency".equals(qName) &&
_dd.getModuleConfigurations().length == 0) {
- parseDepsConfs(getDefaultConf(), _dd);
+ _state = DEPS;
+ } else if ("dependency".equals(qName)) {
+ if (_dd.getModuleConfigurations().length == 0) {
+ parseDepsConfs(getDefaultConf(), _dd);
+ }
+ _state = DEPS;
} else if ("dependencies".equals(qName)) {
_state = NONE;
}
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
---
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
(original)
+++
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorWriter.java
Tue Jul 3 07:32:47 2007
@@ -204,6 +204,7 @@
}
out.print("\"");
}
+ out.print(" matcher=\"" +
includes[j].getMatcher().getName() + "\"");
out.println("/>");
}
}
@@ -233,6 +234,7 @@
}
out.print("\"");
}
+ out.print(" matcher=\"" +
excludes[j].getMatcher().getName() + "\"");
out.println("/>");
}
}
@@ -240,6 +242,33 @@
out.println("/>");
} else {
out.println("\t\t</dependency>");
+ }
+ }
+ ExcludeRule[] excludes = md.getAllExcludeRules();
+ if (excludes.length > 0) {
+ for (int j = 0; j < excludes.length; j++) {
+ out.print("\t\t<exclude");
+ out.print(" org=\""
+ +
excludes[j].getId().getModuleId().getOrganisation() + "\"");
+ out.print(" module=\"" +
excludes[j].getId().getModuleId().getName()
+ + "\"");
+ out.print(" artifact=\"" +
excludes[j].getId().getName() + "\"");
+ out.print(" type=\"" + excludes[j].getId().getType() +
"\"");
+ out.print(" ext=\"" + excludes[j].getId().getExt() +
"\"");
+ String[] ruleConfs = excludes[j].getConfigurations();
+ if (!Arrays.asList(ruleConfs).equals(
+ Arrays.asList(md.getConfigurationsNames()))) {
+ out.print(" conf=\"");
+ for (int k = 0; k < ruleConfs.length; k++) {
+ out.print(ruleConfs[k]);
+ if (k + 1 < ruleConfs.length) {
+ out.print(",");
+ }
+ }
+ out.print("\"");
+ }
+ out.print(" matcher=\"" +
excludes[j].getMatcher().getName() + "\"");
+ out.println("/>");
}
}
out.println("\t</dependencies>");
Modified:
incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd
Tue Jul 3 07:32:47 2007
@@ -201,6 +201,24 @@
<xs:attribute
name="conf" type="xs:string"/>
</xs:complexType>
</xs:element>
+ <xs:element name="exclude"
minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+
<xs:element name="conf" minOccurs="0" maxOccurs="unbounded">
+
<xs:complexType>
+
<xs:attribute name="name" type="xs:string" use="required"/>
+
</xs:complexType>
+
</xs:element>
+ </xs:sequence>
+ <xs:attribute
name="org" type="xs:string"/>
+ <xs:attribute
name="module" type="xs:string"/>
+ <xs:attribute
name="artifact" type="xs:string"/>
+ <xs:attribute
name="type" type="xs:string"/>
+ <xs:attribute
name="ext" type="xs:string"/>
+ <xs:attribute
name="conf" type="xs:string"/>
+ <xs:attribute
name="matcher" type="xs:string"/>
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
<xs:attribute
name="defaultconf" type="xs:string"/>
<xs:attribute
name="defaultconfmapping" type="xs:string"/>
@@ -216,30 +234,6 @@
<xs:attribute
name="module" type="xs:string"/>
<xs:attribute
name="name" type="xs:string"/>
<xs:attribute
name="rev" type="xs:string"/>
- <xs:attribute
name="matcher" type="xs:string"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="exclude" minOccurs="0">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="rule"
minOccurs="0" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
-
<xs:element name="conf" minOccurs="0" maxOccurs="unbounded">
-
<xs:complexType>
-
<xs:attribute name="name" type="xs:string" use="required"/>
-
</xs:complexType>
-
</xs:element>
- </xs:sequence>
- <xs:attribute
name="org" type="xs:string"/>
- <xs:attribute
name="module" type="xs:string"/>
- <xs:attribute
name="artifact" type="xs:string"/>
- <xs:attribute
name="type" type="xs:string"/>
- <xs:attribute
name="ext" type="xs:string"/>
- <xs:attribute
name="conf" type="xs:string"/>
<xs:attribute
name="matcher" type="xs:string"/>
</xs:complexType>
</xs:element>
Modified:
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update.xml?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
---
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update.xml
(original)
+++
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-update.xml
Tue Jul 3 07:32:47 2007
@@ -99,13 +99,12 @@
<exclude name="toexclude"/>
</dependency>
<dependency org="yourorg" name="yourmodule11" rev="11.1"
conf="*->@"/>
+
+ <exclude module="*servlet*" matcher="glob" conf="myconf1" />
+ <exclude org="acme" module="test" artifact="test" type="source"
ext="jar" />
</dependencies>
<conflicts>
<manager org="yourorg" module=".*" name="all" matcher="regexp"/>
<manager org="theirorg" module="theirmodule1" rev="1.0, 1.1"/>
</conflicts>
- <exclude>
- <rule module="*servlet*" matcher="glob" conf="myconf1" />
- <rule org="acme" module="test" artifact="test" type="source"
ext="jar" />
- </exclude>
</ivy-module>
Modified:
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-full.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-full.xml?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
---
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-full.xml
(original)
+++
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test-write-full.xml
Tue Jul 3 07:32:47 2007
@@ -56,10 +56,12 @@
<artifact name="yourartifact9-2" type="jar" ext="jar"
conf="myconf2,myconf3"/>
</dependency>
<dependency org="yourorg" name="yourmodule10" rev="10.1"
conf="*->*">
- <include name="your.*" type="jar" ext="jar"/>
- <include name="*" type="*" ext="xml"/>
- <exclude org="*" module="*" name="toexclude" type="*"
ext="*"/>
+ <include name="your.*" type="jar" ext="jar"
matcher="exact"/>
+ <include name="*" type="*" ext="xml" matcher="exact"/>
+ <exclude org="*" module="*" name="toexclude" type="*"
ext="*" matcher="exact"/>
</dependency>
<dependency org="yourorg" name="yourmodule11" rev="11.1"
conf="*->*"/>
+ <exclude org="*" module="*servlet*" artifact="*" type="*"
ext="*" conf="myconf1" matcher="glob"/>
+ <exclude org="acme" module="test" artifact="test" type="source"
ext="jar" matcher="exact"/>
</dependencies>
</ivy-module>
Modified:
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test.xml?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
---
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test.xml
(original)
+++
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/test.xml
Tue Jul 3 07:32:47 2007
@@ -95,13 +95,12 @@
<exclude name="toexclude"/>
</dependency>
<dependency org="yourorg" name="yourmodule11" rev="11.1"
conf="*->@"/>
+
+ <exclude module="*servlet*" matcher="glob" conf="myconf1" />
+ <exclude org="acme" module="test" artifact="test" type="source"
ext="jar" />
</dependencies>
<conflicts>
<manager org="yourorg" module=".*" name="all" matcher="regexp"/>
<manager org="theirorg" module="theirmodule1" rev="1.0, 1.1"/>
</conflicts>
- <exclude>
- <rule module="*servlet*" matcher="glob" conf="myconf1" />
- <rule org="acme" module="test" artifact="test" type="source"
ext="jar" />
- </exclude>
</ivy-module>
Modified:
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/updated.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/updated.xml?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
---
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/updated.xml
(original)
+++
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/xml/updated.xml
Tue Jul 3 07:32:47 2007
@@ -96,13 +96,12 @@
<exclude name="toexclude"/>
</dependency>
<dependency org="yourorg" name="yourmodule11" rev="11.1"
conf="*->@"/>
+
+ <exclude module="*servlet*" matcher="glob" conf="myconf1"/>
+ <exclude org="acme" module="test" artifact="test" type="source"
ext="jar"/>
</dependencies>
<conflicts>
<manager org="yourorg" module=".*" name="all" matcher="regexp"/>
<manager org="theirorg" module="theirmodule1" rev="1.0, 1.1"/>
</conflicts>
- <exclude>
- <rule module="*servlet*" matcher="glob" conf="myconf1"/>
- <rule org="acme" module="test" artifact="test" type="source"
ext="jar"/>
- </exclude>
</ivy-module>
Modified:
incubator/ivy/core/trunk/test/repositories/1/org2/mod2.6/ivys/ivy-0.11.xml
URL:
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/repositories/1/org2/mod2.6/ivys/ivy-0.11.xml?view=diff&rev=552853&r1=552852&r2=552853
==============================================================================
--- incubator/ivy/core/trunk/test/repositories/1/org2/mod2.6/ivys/ivy-0.11.xml
(original)
+++ incubator/ivy/core/trunk/test/repositories/1/org2/mod2.6/ivys/ivy-0.11.xml
Tue Jul 3 07:32:47 2007
@@ -24,8 +24,7 @@
/>
<dependencies>
<dependency name="mod2.1" rev="0.3" />
+ <dependency org="org1" name="mod1.4" rev="1.0.1" />
+ <exclude module="mod1.1" />
</dependencies>
- <exclude>
- <rule module="mod1.1" />
- </exclude>
</ivy-module>