You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2009/06/23 10:26:30 UTC
svn commit: r787585 - in /ant/ivy/core/trunk:
src/java/org/apache/ivy/core/module/descriptor/
test/java/org/apache/ivy/core/resolve/ test/repositories/1/org2/mod2.8/
test/repositories/1/org2/mod2.8/ivys/ test/repositories/1/org2/mod2.8/jars/
test/repos...
Author: xavier
Date: Tue Jun 23 08:26:29 2009
New Revision: 787585
URL: http://svn.apache.org/viewvc?rev=787585&view=rev
Log:
improvement in configuration intersection support: support *->@+something (IVY-1093)
Added:
ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/
ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/ivys/
ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/ivys/ivy-0.6.xml (with props)
ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/
ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-linux-debug-0.6.jar (with props)
ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-linux-debug-thread-0.6.jar (with props)
ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-win-debug-0.6.jar (with props)
ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-win-debug-thread-0.6.jar (with props)
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.4.xml
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java?rev=787585&r1=787584&r2=787585&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java Tue Jun 23 08:26:29 2009
@@ -46,9 +46,9 @@
* method.
*/
public class DefaultDependencyDescriptor implements DependencyDescriptor {
- private static final Pattern SELF_FALLBACK_PATTERN = Pattern.compile("@(\\(.*\\))?");
+ private static final Pattern SELF_FALLBACK_PATTERN = Pattern.compile("@(\\+[^\\(]+)?(\\(.*\\))?");
- private static final Pattern THIS_FALLBACK_PATTERN = Pattern.compile("#(\\(.*\\))?");
+ private static final Pattern THIS_FALLBACK_PATTERN = Pattern.compile("#(\\+[^\\(]+)?(\\(.*\\))?");
/**
* Transforms the given dependency descriptor of the given namespace and return a new dependency
@@ -258,13 +258,64 @@
if (intersectedDepConfs.isEmpty()) {
intersectedDepConfs.addAll(depConfs);
} else {
- intersectedDepConfs.retainAll(depConfs);
+ if (intersectedDepConfs.contains("*")) {
+ intersectedDepConfs.remove("*");
+ intersectedDepConfs.addAll(depConfs);
+ } else if (depConfs.contains("*")) {
+ // nothing to do, intersection of 'something'
+ // with 'everything' is 'something'
+ } else {
+ Set /*<String>*/ intersectedDepConfsCopy = intersectedDepConfs;
+ intersectedDepConfs = new HashSet();
+ for (Iterator it = intersectedDepConfsCopy.iterator(); it.hasNext();) {
+ String intersectedDepConf = (String) it.next();
+ if (depConfs.contains(intersectedDepConf)) {
+ // the conf is present in both sets,
+ // so it is in the intersection
+ intersectedDepConfs.add(intersectedDepConf);
+ continue;
+ }
+ /*
+ we do not handle special confs like *!sg or [cond]* in right hand
+ confs yet: it would require supporting parenthesis grouping in
+ configurations intersection interpretation
+
+ for (Iterator it2 = depConfs.iterator(); it2.hasNext();) {
+ String depConf = (String) it2.next();
+ if (depConf.startsWith("*")) {
+ if (intersectedDepConf
+ .indexOf("(" + depConf + ")") != -1) {
+ intersectedDepConfs.add(intersectedDepConf);
+ } else {
+ intersectedDepConfs.add(
+ "(" + intersectedDepConf + ")+(" + depConf + ")");
+ }
+ } else if (intersectedDepConf.startsWith("*")) {
+ if (depConf
+ .indexOf("(" + intersectedDepConf + ")") != -1) {
+ intersectedDepConfs.add(depConf);
+ } else {
+ intersectedDepConfs.add(
+ depConf + "+" + intersectedDepConf);
+ }
+ }
+ }
+ */
+ }
+ }
}
}
if (intersectedDepConfs.isEmpty()) {
List defConfs = (List) confs.get("*");
- if (defConfs != null && defConfs.contains("@")) {
- return new String[] {moduleConfiguration};
+ if (defConfs != null) {
+ for (Iterator it = defConfs.iterator(); it.hasNext();) {
+ String mappedConf = (String) it.next();
+ if (mappedConf != null && mappedConf.startsWith("@+")) {
+ return new String[] {moduleConfiguration + mappedConf.substring(1)};
+ } else if (mappedConf != null && mappedConf.equals("@")) {
+ return new String[] {moduleConfiguration};
+ }
+ }
}
}
return (String[]) intersectedDepConfs.toArray(new String[intersectedDepConfs.size()]);
@@ -353,11 +404,14 @@
final String conf, final String moduleConfiguration) {
Matcher matcher = pattern.matcher(conf);
if (matcher.matches()) {
+ String mappedConf = moduleConfiguration;
if (matcher.group(1) != null) {
- return moduleConfiguration + matcher.group(1);
- } else {
- return moduleConfiguration;
+ mappedConf = mappedConf + matcher.group(1);
+ }
+ if (matcher.group(2) != null) {
+ mappedConf = mappedConf + matcher.group(2);
}
+ return mappedConf;
}
return null;
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=787585&r1=787584&r2=787585&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Tue Jun 23 08:26:29 2009
@@ -3727,6 +3727,7 @@
// mod5.1;4.4 -> mod1.2;2.0 (B,xplatform->default)
// mod5.1;4.4 -> mod2.2;0.9 (B,windows->myconf1;B,linux->myconf2)
// mod5.1;4.4 -> mod2.1;0.5 (B,windows->A+B)
+ // mod5.1;4.4 -> mod2.8;0.6 (windows,linux->@+thread+debug;A,B->*)
ivy.resolve(new File("test/repositories/2/mod5.2/ivy-3.0.xml").toURL(),
getResolveOptions(new String[] {"B+linux"}));
@@ -3740,6 +3741,10 @@
assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.5", "art21A", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.5", "art21B", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org2", "mod2.1", "0.5", "art21AB", "jar", "jar").exists());
+ assertTrue(getArchiveFileInCache("org2", "mod2.8", "0.6", "art28-linux-debug-thread", "jar", "jar").exists());
+ assertFalse(getArchiveFileInCache("org2", "mod2.8", "0.6", "art28-linux-debug", "jar", "jar").exists());
+ assertFalse(getArchiveFileInCache("org2", "mod2.8", "0.6", "art28-windows-debug-thread", "jar", "jar").exists());
+ assertFalse(getArchiveFileInCache("org2", "mod2.8", "0.6", "art28-windows-debug", "jar", "jar").exists());
}
public void testResolveFallbackConfiguration() throws Exception {
Added: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/ivys/ivy-0.6.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/ivys/ivy-0.6.xml?rev=787585&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/ivys/ivy-0.6.xml (added)
+++ ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/ivys/ivy-0.6.xml Tue Jun 23 08:26:29 2009
@@ -0,0 +1,42 @@
+<!--
+ 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="org2"
+ module="mod2.8"
+ revision="0.6"
+ status="integration"
+ />
+ <configurations>
+ <conf name="windows" />
+ <conf name="linux" />
+
+ <conf name="thread" />
+ <conf name="nothread" />
+
+ <conf name="debug" />
+ <conf name="nodebug" />
+ </configurations>
+ <publications>
+ <artifact name="art28-win-debug" conf="windows,debug,nothread" />
+ <artifact name="art28-linux-debug" conf="linux,debug,nothread" />
+
+ <artifact name="art28-win-debug-thread" conf="windows,debug,thread" />
+ <artifact name="art28-linux-debug-thread" conf="linux,debug,thread" />
+ </publications>
+</ivy-module>
Propchange: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/ivys/ivy-0.6.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-linux-debug-0.6.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-linux-debug-0.6.jar?rev=787585&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-linux-debug-0.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-linux-debug-thread-0.6.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-linux-debug-thread-0.6.jar?rev=787585&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-linux-debug-thread-0.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-win-debug-0.6.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-win-debug-0.6.jar?rev=787585&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-win-debug-0.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-win-debug-thread-0.6.jar
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-win-debug-thread-0.6.jar?rev=787585&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ant/ivy/core/trunk/test/repositories/1/org2/mod2.8/jars/art28-win-debug-thread-0.6.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.4.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.4.xml?rev=787585&r1=787584&r2=787585&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.4.xml (original)
+++ ant/ivy/core/trunk/test/repositories/2/mod5.1/ivy-4.4.xml Tue Jun 23 08:26:29 2009
@@ -41,5 +41,6 @@
<dependency org="org1" name="mod1.2" rev="2.0" conf="B,xplatform->default"/>
<dependency org="org2" name="mod2.2" rev="0.9" conf="B,windows->myconf1;B,linux->myconf2"/>
<dependency org="org2" name="mod2.1" rev="0.5" conf="B,windows->A+B"/>
+ <dependency org="org2" name="mod2.8" rev="0.6" conf="windows,linux->@+thread+debug;A,B->*"/>
</dependencies>
</ivy-module>