From 23a1c7d3a76b7d15fbddeff0789aa3960879b02f Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Tue, 25 Jan 2005 22:03:35 +0000 Subject: [PATCH] Make apply's dest attribute optional. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277464 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ src/etc/testcases/taskdefs/exec/apply.xml | 22 +++++++++++++++++++ .../apache/tools/ant/taskdefs/ExecuteOn.java | 19 ++++++++-------- .../tools/ant/taskdefs/ExecuteOnTest.java | 4 ++++ 4 files changed, 38 insertions(+), 10 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 6b7580d54..2ea890d1a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -188,6 +188,9 @@ Other changes: * Added a comment attribute to the zip task. Bugzilla report 22793. +* Made the dest attribute of the apply task optional; mapped target + filenames will be interpreted as absolute pathnames when dest is omitted. + Fixed bugs: ----------- diff --git a/src/etc/testcases/taskdefs/exec/apply.xml b/src/etc/testcases/taskdefs/exec/apply.xml index 0d5540ed6..019a57ce5 100755 --- a/src/etc/testcases/taskdefs/exec/apply.xml +++ b/src/etc/testcases/taskdefs/exec/apply.xml @@ -406,6 +406,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index a15fbf41b..0444079da 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -277,16 +277,15 @@ public class ExecuteOn extends ExecTask { throw new BuildException("no filesets and no filelists specified", getLocation()); } - if (targetFilePos != null || mapperElement != null - || destDir != null) { - - if (mapperElement == null) { - throw new BuildException("no mapper specified", getLocation()); - } - if (destDir == null) { - throw new BuildException("no dest attribute specified", - getLocation()); - } + if (targetFilePos != null && mapperElement == null) { + throw new BuildException("targetfile specified without mapper", + getLocation()); + } + if (destDir != null && mapperElement == null) { + throw new BuildException("dest specified without mapper", + getLocation()); + } + if (mapperElement != null) { mapper = mapperElement.getImplementation(); } } diff --git a/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java b/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java index 8939bdfa2..ae7dcd9ba 100755 --- a/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java @@ -558,6 +558,10 @@ public class ExecuteOnTest extends BuildFileTest { executeTarget("force"); } + public void testNoDest() { + executeTarget("testNoDest"); + } + //borrowed from TokenFilterTest private String getFileString(String filename) throws IOException { String result = null;