Browse Source

Make apply's dest attribute optional.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277464 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 20 years ago
parent
commit
23a1c7d3a7
4 changed files with 38 additions and 10 deletions
  1. +3
    -0
      WHATSNEW
  2. +22
    -0
      src/etc/testcases/taskdefs/exec/apply.xml
  3. +9
    -10
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  4. +4
    -0
      src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java

+ 3
- 0
WHATSNEW View File

@@ -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:
-----------



+ 22
- 0
src/etc/testcases/taskdefs/exec/apply.xml View File

@@ -406,6 +406,28 @@
</fail>
</target>

<target name="testNoDest" depends="init,xyz" if="echo.can.run">
<presetdef name="ekko">
<apply executable="echo" addsourcefile="false" force="true">
<filelist dir="${basedir}" files="x" />
<globmapper from="*" to="${basedir}/*" />
<targetfile />
</apply>
</presetdef>
<ekko outputproperty="dest" dest="${basedir}" />
<ekko outputproperty="nodest" />
<fail>
<condition>
<or>
<available file="${dest}" />
<not>
<available file="${nodest}" />
</not>
</or>
</condition>
</fail>
</target>

<target name="cleanup">
<delete>
<fileset refid="xyz" />


+ 9
- 10
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -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();
}
}


+ 4
- 0
src/testcases/org/apache/tools/ant/taskdefs/ExecuteOnTest.java View File

@@ -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;


Loading…
Cancel
Save