You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2010/08/05 22:44:31 UTC

svn commit: r982773 - in /ant/core/trunk: WHATSNEW docs/manual/Tasks/apply.html src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java src/tests/antunit/taskdefs/exec/apply-test.xml

Author: bodewig
Date: Thu Aug  5 20:44:30 2010
New Revision: 982773

URL: http://svn.apache.org/viewvc?rev=982773&view=rev
Log:
nested redirectors and parrallel-apply don't mix well - PR 49594

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/docs/manual/Tasks/apply.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
    ant/core/trunk/src/tests/antunit/taskdefs/exec/apply-test.xml

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=982773&r1=982772&r2=982773&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Aug  5 20:44:30 2010
@@ -110,6 +110,11 @@ Fixed bugs:
    to the toString invocation already.
    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:
 --------------
 

Modified: ant/core/trunk/docs/manual/Tasks/apply.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/Tasks/apply.html?rev=982773&r1=982772&r2=982773&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/Tasks/apply.html (original)
+++ ant/core/trunk/docs/manual/Tasks/apply.html Thu Aug  5 20:44:30 2010
@@ -391,6 +391,9 @@ file mapping will take place with each i
 user the capacity to receive input from, and send output to, different
 files for each sourcefile.
 </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>
 <blockquote><pre>
 &lt;apply executable=&quot;ls&quot;&gt;

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java?rev=982773&r1=982772&r2=982773&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java Thu Aug  5 20:44:30 2010
@@ -708,6 +708,11 @@ public class ExecuteOn extends ExecTask 
             String[] command = getCommandline(s, b);
             log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
             exe.setCommandline(command);
+            if (redirectorElement != null) {
+                setupRedirector();
+                redirectorElement.configure(redirector, null);
+                exe.setStreamHandler(redirector.createHandler());
+            }
             runExecute(exe);
         } else {
             int stillToDo = fileNames.size();

Modified: ant/core/trunk/src/tests/antunit/taskdefs/exec/apply-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/exec/apply-test.xml?rev=982773&r1=982772&r2=982773&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/exec/apply-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/exec/apply-test.xml Thu Aug  5 20:44:30 2010
@@ -756,4 +756,37 @@
     <au:assertLogContains text="${z}.bar,x out" />
   </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>