incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r542927 - in /incubator/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/ant/IvyPostResolveTask.java src/java/org/apache/ivy/ant/IvyResolve.java test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
Date Wed, 30 May 2007 20:39:20 GMT
Author: maartenc
Date: Wed May 30 13:39:19 2007
New Revision: 542927

URL: http://svn.apache.org/viewvc?view=rev&rev=542927
Log:
FIX: The deprecated "keep" attribute on post resolve tasks causes an error (IVY-517)

Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?view=diff&rev=542927&r1=542926&r2=542927
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Wed May 30 13:39:19 2007
@@ -56,6 +56,7 @@
 - IMPROVEMENT: Remove @author tags (thanks to Stephane Bailliez)
 - IMPROVEMENT: Remove use of deprecated elements in ivysettings.xml (IVY-505) (with contribution
from Jan Materne)
 
+- FIX: The deprecated "keep" attribute on post resolve tasks causes an error (IVY-517)
 - FIX: Some circular dependencies not retrieved (IVY-400)
 - FIX: ${version} property not recognized in poms (IVY-512)
 - FIX: Bug on handling dependency artifacts when a module configuration is specified (IVY-507)

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java?view=diff&rev=542927&r1=542926&r2=542927
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java Wed May 30
13:39:19 2007
@@ -58,6 +58,8 @@
     private Filter _artifactFilter = null;
     private boolean useOrigin = false;
     
+    private Boolean keep = null;
+    
     public boolean isUseOrigin() {
     	return useOrigin;
     }
@@ -227,6 +229,7 @@
 		resolve.setHaltonfailure(haltOnFailure);
 		resolve.setUseOrigin(useOrigin);
 		resolve.setValidate(isValidate());
+		resolve.setKeep(isKeep());
 		return resolve;
 	}
 
@@ -326,6 +329,14 @@
 	
 	public File getFile() {
 		return _file;
+	}
+	
+	public void setKeep(boolean keep) {
+		this.keep = Boolean.valueOf(keep);
+	}
+	
+	public boolean isKeep() {
+		return this.keep == null ? !isInline() : this.keep.booleanValue();
 	}
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java?view=diff&rev=542927&r1=542926&r2=542927
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java Wed May 30 13:39:19
2007
@@ -206,8 +206,10 @@
 	                getProject().setProperty("ivy.resolved.configurations", _conf);
 	                settings.setVariable("ivy.resolved.configurations", _conf);
 	            }
-	            getProject().setProperty("ivy.resolved.file", _file.getAbsolutePath());
-	            settings.setVariable("ivy.resolved.file", _file.getAbsolutePath());
+	            if (_file != null) {
+		            getProject().setProperty("ivy.resolved.file", _file.getAbsolutePath());
+		            settings.setVariable("ivy.resolved.file", _file.getAbsolutePath());
+	            }
 	            if (_resolveId != null) {
 		            getProject().setProperty("ivy.organisation." + _resolveId, md.getModuleRevisionId().getOrganisation());
 		            settings.setVariable("ivy.organisation." + _resolveId, md.getModuleRevisionId().getOrganisation());

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java?view=diff&rev=542927&r1=542926&r2=542927
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java Wed
May 30 13:39:19 2007
@@ -159,6 +159,57 @@
     	assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
     }
 
+    public void testWithoutKeep() throws Exception {
+    	IvyResolve resolve = new IvyResolve();
+    	resolve.setProject(_project);
+    	resolve.setCache(_cache);
+    	resolve.setFile(new File("test/java/org/apache/ivy/ant/ivy-multiconf.xml"));
+    	resolve.setConf("compile");
+    	resolve.execute();
+
+    	ResolveReport reportBefore = (ResolveReport) _project.getReference("ivy.resolved.report");
+    	assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", "jar", "jar").exists());
+    	assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+    
+    	_task.setConf("*"); // will trigger a resolve
+    	_task.setKeep(false); // don't keep the resolve results
+    	_task.execute();
+
+    	ResolveReport reportAfter = (ResolveReport) _project.getReference("ivy.resolved.report");
+    	
+    	assertSame("IvyPostResolveTask has kept the resolve report where it should have", reportBefore,
reportAfter);
+    	assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
+    }
+
+    public void testInlineWithoutKeep() throws Exception {
+    	_task.setOrganisation("org1");
+    	_task.setModule("mod1.1");
+    	_task.setRevision("2.0");
+    	_task.setInline(true);
+    	_task.setConf("*"); // will trigger a resolve
+    	_task.execute();
+
+    	ResolveReport reportAfter = (ResolveReport) _project.getReference("ivy.resolved.report");
+    	
+    	assertNull("IvyPostResolveTask has kept the resolve report where it should have", reportAfter);
+    	assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
+    }
+
+    public void testInlineWithKeep() throws Exception {
+    	_task.setOrganisation("org1");
+    	_task.setModule("mod1.1");
+    	_task.setRevision("2.0");
+    	_task.setInline(true);
+    	_task.setKeep(true);
+    	_task.setConf("*"); // will trigger a resolve
+    	_task.execute();
+
+    	ResolveReport reportAfter = (ResolveReport) _project.getReference("ivy.resolved.report");
+    	
+    	assertNotNull("IvyPostResolveTask has kept the resolve report where it should have",
reportAfter);
+    	assertTrue(getArchiveFileInCache("org1", "mod1.2", "2.1", "mod1.2", "jar", "jar").exists());
+    }
+
     public void testWithResolveIdAndPreviousResolveInSameBuildAndLessConfs() throws Exception
{
     	IvyResolve resolve = new IvyResolve();
     	resolve.setProject(_project);



Mime
View raw message