You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2012/08/28 17:11:39 UTC
svn commit: r1378166 - in /ant/ivy/core/branches/2.3.x: ./
src/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/core/resolve/
test/repositories/1/org2/mod2.6/ivys/
Author: hibou
Date: Tue Aug 28 15:11:38 2012
New Revision: 1378166
URL: http://svn.apache.org/viewvc?rev=1378166&view=rev
Log:
merge r1378164: Fix global exclude rule in root ivy files
Added:
ant/ivy/core/branches/2.3.x/test/repositories/1/org2/mod2.6/ivys/ivy-0.14.xml
- copied unchanged from r1378164, ant/ivy/core/trunk/test/repositories/1/org2/mod2.6/ivys/ivy-0.14.xml
Modified:
ant/ivy/core/branches/2.3.x/ (props changed)
ant/ivy/core/branches/2.3.x/CHANGES.txt
ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java
ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java
Propchange: ant/ivy/core/branches/2.3.x/
------------------------------------------------------------------------------
Merged /ant/ivy/core/trunk:r1378164
Modified: ant/ivy/core/branches/2.3.x/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/CHANGES.txt?rev=1378166&r1=1378165&r2=1378166&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/CHANGES.txt (original)
+++ ant/ivy/core/branches/2.3.x/CHANGES.txt Tue Aug 28 15:11:38 2012
@@ -145,6 +145,7 @@ for detailed view of each issue, please
- FIX: The ignore circular dependency strategy is clobbering the warn strategy (IVY-1353) (Thanks to Carl Quinn)
- FIX: Buildnumber and IvyFindRevision Ant tasks should honour defaultBranch setting (IVY-1344) (Thanks to Ales Nosek)
- FIX: ApacheURLLister.retrieveListing() fails if the encoding of the URL list is different from the default encoding (IVY-1060) (Thanks to Robin Fernandes)
+- FIX: global exclude rules is not applying to root ivy files
2.3.0-rc1
=====================================
Modified: ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java?rev=1378166&r1=1378165&r2=1378166&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java (original)
+++ ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNode.java Tue Aug 28 15:11:38 2012
@@ -336,7 +336,7 @@ public class IvyNode implements Comparab
continue;
}
ModuleRevisionId requestedDependencyRevisionId = dd.getDependencyRevisionId();
- if (isDependencyModuleExcluded(rootModuleConf, requestedDependencyRevisionId, conf)) {
+ if (isDependencyModuleExcluded(dd, rootModuleConf, requestedDependencyRevisionId, conf)) {
// the whole module is excluded, it is considered as not being part of dependencies
// at all
Message.verbose("excluding " + dd + " in " + conf);
@@ -380,10 +380,40 @@ public class IvyNode implements Comparab
return (DependencyDescriptor) dds.get(parent);
}
- private boolean isDependencyModuleExcluded(String rootModuleConf,
+ private boolean isDependencyModuleExcluded(DependencyDescriptor dd, String rootModuleConf,
ModuleRevisionId dependencyRevisionId, String conf) {
- return callers.doesCallersExclude(rootModuleConf, DefaultArtifact.newIvyArtifact(
- dependencyRevisionId, null));
+ Artifact a = DefaultArtifact.newIvyArtifact(dependencyRevisionId, null);
+ if (isRoot()) {
+ // no callers, but maybe some exclude
+ Boolean exclude = doesExclude(md, rootModuleConf, new String[] {rootModuleConf}, dd, a,
+ new Stack());
+ return exclude == null ? false : exclude.booleanValue();
+ }
+ return callers.doesCallersExclude(rootModuleConf, a);
+ }
+
+ Boolean doesExclude(ModuleDescriptor md, String rootModuleConf, String[] moduleConfs,
+ DependencyDescriptor dd, Artifact artifact, Stack callersStack) {
+ // artifact is excluded if it match any of the exclude pattern for this dependency...
+ if (dd != null) {
+ if (dd.doesExclude(moduleConfs, artifact.getId().getArtifactId())) {
+ return Boolean.TRUE;
+ }
+ }
+ if (md.doesExclude(moduleConfs, artifact.getId().getArtifactId())) {
+ return Boolean.TRUE;
+ }
+ // ... or if it is excluded by all its callers
+ IvyNode c = getData().getNode(md.getModuleRevisionId());
+ if (c != null) {
+ if (callersStack.contains(c.getId())) {
+ // a circular dependency, we cannot be conclusive here
+ return null;
+ }
+ return Boolean.valueOf(c.doesCallersExclude(rootModuleConf, artifact, callersStack));
+ } else {
+ return Boolean.FALSE;
+ }
}
public boolean hasConfigurationsToLoad() {
Modified: ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java?rev=1378166&r1=1378165&r2=1378166&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java (original)
+++ ant/ivy/core/branches/2.3.x/src/java/org/apache/ivy/core/resolve/IvyNodeCallers.java Tue Aug 28 15:11:38 2012
@@ -278,7 +278,7 @@ public class IvyNodeCallers {
return false;
}
ModuleDescriptor md = callers[i].getModuleDescriptor();
- Boolean doesExclude = doesExclude(md, rootModuleConf, callers[i].getCallerConfigurations(),
+ Boolean doesExclude = node.doesExclude(md, rootModuleConf, callers[i].getCallerConfigurations(),
callers[i].getDependencyDescriptor(), artifact, callersStack);
if (doesExclude != null) {
if (!doesExclude.booleanValue()) {
@@ -293,28 +293,4 @@ public class IvyNodeCallers {
}
}
- private Boolean doesExclude(ModuleDescriptor md, String rootModuleConf, String[] moduleConfs,
- DependencyDescriptor dd, Artifact artifact, Stack callersStack) {
- // artifact is excluded if it match any of the exclude pattern for this dependency...
- if (dd != null) {
- if (dd.doesExclude(moduleConfs, artifact.getId().getArtifactId())) {
- return Boolean.TRUE;
- }
- }
- if (md.doesExclude(moduleConfs, artifact.getId().getArtifactId())) {
- return Boolean.TRUE;
- }
- // ... or if it is excluded by all its callers
- IvyNode c = node.getData().getNode(md.getModuleRevisionId());
- if (c != null) {
- if (callersStack.contains(c.getId())) {
- // a circular dependency, we cannot be conclusive here
- return null;
- }
- return Boolean.valueOf(c.doesCallersExclude(rootModuleConf, artifact, callersStack));
- } else {
- return Boolean.FALSE;
- }
- }
-
}
Modified: ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1378166&r1=1378165&r2=1378166&view=diff
==============================================================================
--- ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/branches/2.3.x/test/java/org/apache/ivy/core/resolve/ResolveTest.java Tue Aug 28 15:11:38 2012
@@ -3861,6 +3861,18 @@ public class ResolveTest extends TestCas
ModuleRevisionId.newInstance("org2", "mod2.3", "0.4")).exists());
}
+ public void testResolveExcludesConf3() throws Exception {
+ ResolveReport report = ivy.resolve(new File(
+ "test/repositories/1/org2/mod2.6/ivys/ivy-0.14.xml"),
+ getResolveOptions(new String[] {"exclude"}));
+ ModuleDescriptor md = report.getModuleDescriptor();
+ assertEquals(ModuleRevisionId.newInstance("org2", "mod2.6", "0.14"), md
+ .getModuleRevisionId());
+
+ assertFalse(getIvyFileInCache(
+ ModuleRevisionId.newInstance("org2", "mod2.5", "0.9")).exists());
+ }
+
public void testResolveExceptConfiguration() throws Exception {
// mod10.2 depends on mod5.1 conf *, !A
ivy.resolve(new File("test/repositories/2/mod10.2/ivy-2.0.xml").toURL(),