Browse Source

nested redirectors and parrallel-apply don't mix well - PR 49594

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@982773 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 15 years ago
parent
commit
5d1bf32637
4 changed files with 46 additions and 0 deletions
  1. +5
    -0
      WHATSNEW
  2. +3
    -0
      docs/manual/Tasks/apply.html
  3. +5
    -0
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  4. +33
    -0
      src/tests/antunit/taskdefs/exec/apply-test.xml

+ 5
- 0
WHATSNEW View File

@@ -110,6 +110,11 @@ Fixed bugs:
to the toString invocation already. to the toString invocation already.
Bugzilla Report 49588. Bugzilla Report 49588.


* <apply> in parallel mode didn't work together with a nested
<redirector> if maxparallel was <= 0 (the default) or no source
files matched.
Bugzilla Report 49594.

Other changes: Other changes:
-------------- --------------




+ 3
- 0
docs/manual/Tasks/apply.html View File

@@ -391,6 +391,9 @@ file mapping will take place with each iteration. This grants the
user the capacity to receive input from, and send output to, different user the capacity to receive input from, and send output to, different
files for each sourcefile. files for each sourcefile.
</p> </p>
<p>In <i>parallel</i>-mode the redirector will be reset for each batch
of executions (with <i>maxparallel</i> &gt; 0) and null will be used
a source file just like it is in the case of <code>exec</code>.</p>
<h3>Examples</h3> <h3>Examples</h3>
<blockquote><pre> <blockquote><pre>
&lt;apply executable=&quot;ls&quot;&gt; &lt;apply executable=&quot;ls&quot;&gt;


+ 5
- 0
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -708,6 +708,11 @@ public class ExecuteOn extends ExecTask {
String[] command = getCommandline(s, b); String[] command = getCommandline(s, b);
log(Commandline.describeCommand(command), Project.MSG_VERBOSE); log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
exe.setCommandline(command); exe.setCommandline(command);
if (redirectorElement != null) {
setupRedirector();
redirectorElement.configure(redirector, null);
exe.setStreamHandler(redirector.createHandler());
}
runExecute(exe); runExecute(exe);
} else { } else {
int stillToDo = fileNames.size(); int stillToDo = fileNames.size();


+ 33
- 0
src/tests/antunit/taskdefs/exec/apply-test.xml View File

@@ -756,4 +756,37 @@
<au:assertLogContains text="${z}.bar,x out" /> <au:assertLogContains text="${z}.bar,x out" />
</target> </target>


<target name="testRedirectorWithParallel" if="test.can.run" depends="xyz">
<apply executable="sh" dest="${input}" parallel="true" addsourcefile="yes">
<arg value="parrot.sh" />
<targetfile/>
<fileset refid="xyz" />
<globmapper from="*" to="*.bar"/>
<redirector output="${output}/all_out.txt" append="yes"/>
</apply>
<au:assertResourceContains resource="${output}/all_out.txt"
value="x.bar out"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="x.bar err"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="x out"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="x err"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="y.bar out"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="y.bar err"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="y out"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="y err"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="z.bar out"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="z.bar err"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="z out"/>
<au:assertResourceContains resource="${output}/all_out.txt"
value="z err"/>
</target>
</project> </project>

Loading…
Cancel
Save