ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r737358 - in /ant/ivy/core/trunk: src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java test/java/org/apache/ivy/plugins/resolver/MockResolver.java
Date Sat, 24 Jan 2009 14:05:24 GMT
Author: xavier
Date: Sat Jan 24 14:05:24 2009
New Revision: 737358

URL: http://svn.apache.org/viewvc?rev=737358&view=rev
Log:
fix problems introduced with IVY-1012

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/MockResolver.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java?rev=737358&r1=737357&r2=737358&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java Sat
Jan 24 14:05:24 2009
@@ -58,6 +58,7 @@
 import org.apache.ivy.plugins.resolver.ChainResolver.ResolvedModuleRevisionArtifactInfo;
 import org.apache.ivy.plugins.resolver.util.HasLatestStrategy;
 import org.apache.ivy.plugins.resolver.util.ResolvedResource;
+import org.apache.ivy.util.Checks;
 import org.apache.ivy.util.Message;
 
 /**
@@ -337,9 +338,19 @@
 
     protected ResolvedModuleRevision findModuleInCache(
             DependencyDescriptor dd, ResolveData data, boolean anyResolver) {
-        return getRepositoryCacheManager().findModuleInCache(
-            dd, dd.getDependencyRevisionId(), 
-            getCacheOptions(data), anyResolver ? null : getName());
+        ResolvedModuleRevision rmr = getRepositoryCacheManager().findModuleInCache(
+                    dd, dd.getDependencyRevisionId(), 
+                    getCacheOptions(data), anyResolver ? null : getName());
+        if (rmr == null) {
+            return null;
+        }
+        if (data.getReport() != null 
+                && data.isBlacklisted(data.getReport().getConfiguration(), rmr.getId()))
{
+            Message.verbose("\t" + getName() + ": found revision in cache: " 
+                        + rmr.getId() + " for " + dd + ", but it is blacklisted");
+            return null;
+        }
+        return rmr;
     }
 
     public void setChangingMatcher(String changingMatcherName) {
@@ -496,25 +507,25 @@
             DependencyDescriptor dd,
             ResolvedModuleRevision newModuleFound,
             ResolveData data) {
+        Checks.checkNotNull(dd, "dd");
+        Checks.checkNotNull(data, "data");
+        
         // check if latest is asked and compare to return the most recent
         ResolvedModuleRevision previousModuleFound = data.getCurrentResolvedModuleRevision();
         String newModuleDesc = describe(newModuleFound);
         Message.debug("\tchecking " + newModuleDesc + " against " + describe(previousModuleFound));
         if (previousModuleFound == null) {
             Message.debug("\tmodule revision kept as first found: " + newModuleDesc);
-            getRepositoryCacheManager().saveResolvedRevision(
-                dd.getDependencyRevisionId(), newModuleFound.getId().getRevision());
+            saveModuleRevisionIfNeeded(dd, newModuleFound);
             return newModuleFound;
         } else if (isAfter(newModuleFound, previousModuleFound, data.getDate())) {
             Message.debug("\tmodule revision kept as younger: " + newModuleDesc);
-            getRepositoryCacheManager().saveResolvedRevision(
-                dd.getDependencyRevisionId(), newModuleFound.getId().getRevision());
+            saveModuleRevisionIfNeeded(dd, newModuleFound);
             return newModuleFound;
         } else if (!newModuleFound.getDescriptor().isDefault() 
                 && previousModuleFound.getDescriptor().isDefault()) {
             Message.debug("\tmodule revision kept as better (not default): " + newModuleDesc);
-            getRepositoryCacheManager().saveResolvedRevision(
-                dd.getDependencyRevisionId(), newModuleFound.getId().getRevision());
+            saveModuleRevisionIfNeeded(dd, newModuleFound);
             return newModuleFound;
         } else {
             Message.debug("\tmodule revision discarded as older: " + newModuleDesc);
@@ -522,6 +533,15 @@
         }
     }
 
+    protected void saveModuleRevisionIfNeeded(DependencyDescriptor dd,
+            ResolvedModuleRevision newModuleFound) {
+        if (newModuleFound != null 
+                && getSettings().getVersionMatcher().isDynamic(dd.getDependencyRevisionId()))
{
+            getRepositoryCacheManager().saveResolvedRevision(
+                dd.getDependencyRevisionId(), newModuleFound.getId().getRevision());
+        }
+    }
+
     private String describe(ResolvedModuleRevision rmr) {
         if (rmr == null) {
             return "[none]";

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/MockResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/MockResolver.java?rev=737358&r1=737357&r2=737358&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/MockResolver.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/MockResolver.java Sat Jan
24 14:05:24 2009
@@ -111,4 +111,7 @@
         return null;
     }
 
+    protected void saveModuleRevisionIfNeeded(DependencyDescriptor dd,
+            ResolvedModuleRevision newModuleFound) {
+    }
 }



Mime
View raw message