ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r642425 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/ant/IvyPostResolveTask.java test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java
Date Fri, 28 Mar 2008 23:24:39 GMT
Author: maartenc
Date: Fri Mar 28 16:24:38 2008
New Revision: 642425

URL: http://svn.apache.org/viewvc?rev=642425&view=rev
Log:
FIX: multiple cleancache and inline retrieve error (IVY-778)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=642425&r1=642424&r2=642425&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Fri Mar 28 16:24:38 2008
@@ -75,6 +75,7 @@
 - IMPROVEMENT: Parse description and home page from poms (IVY-767)
 - IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher
and GlobPatternMatcher
 
+- FIX: multiple cleancache and inline retrieve error (IVY-778)
 - FIX: buildlist evicts modules with the same name, but different organisation (IVY-731)
 - FIX: Out of memory/Stack overflow for new highly coupled project (IVY-595)
 - FIX: Compatibility with maven's dependencyMangement (IVY-753) (not completed yet)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java?rev=642425&r1=642424&r2=642425&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java Fri Mar 28 16:24:38
2008
@@ -20,8 +20,10 @@
 import java.io.File;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Iterator;
 
 import org.apache.ivy.Ivy;
+import org.apache.ivy.core.cache.ResolutionCacheManager;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
@@ -245,7 +247,24 @@
             } else {
                 confs = splitConfs(conf);
             }
+            
             HashSet rconfsSet = new HashSet(Arrays.asList(rconfs));
+            
+            // for each resolved configuration, check if the report still exists
+            ResolutionCacheManager cache = getSettings().getResolutionCacheManager();
+            for (Iterator it = rconfsSet.iterator(); it.hasNext(); ) {
+                String resolvedConf = (String) it.next();
+                String resolveId = getResolveId();
+                if (resolveId == null) {
+                    resolveId = ResolveOptions.getDefaultResolveId(reference);
+                }
+                File report = cache.getConfigurationResolveReportInCache(resolveId, resolvedConf);
+                if (!report.exists()) {
+                    // the report doesn't exist any longer, we have to recreate it...
+                    it.remove();
+                }
+            }
+            
             HashSet confsSet = new HashSet(Arrays.asList(confs));
             Message.debug("resolved configurations:   " + rconfsSet);
             Message.debug("asked configurations:      " + confsSet);

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml?rev=642425&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml Fri Mar 28 16:24:38
2008
@@ -0,0 +1,35 @@
+<!--
+   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.    
+-->
+<project xmlns:ivy="antlib:org.apache.ivy.ant" basedir="../../../../../..">
+  <target name="setUp">
+    <property name="ivy.cache.repository" value="build/cache" />
+  </target>
+
+  <target name="tearDown">
+  	<delete dir="build/cache" />
+  </target>
+
+  <target name="testMultipleInlineRetrievesWithCacheCleaning">
+  	<ivy:settings file="test/repositories/ivysettings.xml" />
+  	<ivy:retrieve organisation="org1" module="mod1.2" revision="2.0" inline="true" keep="true"
/>
+  	<ivy:cleancache />
+  	<ivy:retrieve organisation="org1" module="mod1.2" revision="2.0" inline="true" keep="true"
/>
+  </target>
+
+</project>
\ No newline at end of file

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java?rev=642425&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java Fri Mar
28 16:24:38 2008
@@ -0,0 +1,36 @@
+/*
+ *  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.
+ *
+ */
+package org.apache.ivy.ant;
+
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.tools.ant.BuildFileTest;
+
+public class IvyRetrieveBuildFileTest extends BuildFileTest {
+    
+    protected void setUp() throws Exception {
+        configureProject("test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml");
+    }
+    
+    public void testMultipleInlineRetrievesWithCacheCleaning() {
+        executeTarget("testMultipleInlineRetrievesWithCacheCleaning");
+        ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
+        assertNotNull(report);
+        assertFalse(report.hasError());
+        assertEquals(1, report.getDependencies().size());
+    }
+}



Mime
View raw message