On Wednesday 10 September 2003 13:28, Stefan Bodewig wrote:
> On 10 Sep 2003, Stefan Bodewig <[EMAIL PROTECTED]> wrote:
> > (I'll soon commit a version that should make Axis happy for the next
> > - i.e. tomorrow's - Gump run).
>
> I could use some help here.
>
> The Axis build works if I back out Peter's change for Ant.java's
> revision 1.84 - and I don't have a good grasp of why this should be
> so.

I figured out that this was the change ;-).. I did not
really understand the original code, or why it was necessary.
I assumed that the changes in 1.6 from 1.5 with the deferred
execution of UnknownElement may be resposible - but was not
sure.

>
> If I do, Ant's CallTargetTest#testMultiCall fails with
>     [junit] expecting log to contain "multi is SETmulti is SET" log was
> "multi is SETmulti is DEFAULT"

This was the test (as far as I remember) that showed
the problem.

>
> The details, so that anybody who wants to help doesn't have to try to
> understand the Axis build process.
>
> The starting point is axis/java/buildTest.xml[1] with the target
> compileJunit.  The <foreach> is implemented by ForeachTask[2] which is
> strange enough in itself.
>
> This task creates a single instance of the Ant task and for each file
> in the nested fileset invokes Ant#createProperty to create a property
> named file with the absolute file name - it then goes on and executes
> the task, invoking the same build file using a target named
> compile-component (defined in the entity included targets.xml) which
> then dispatches to the named build file.

The code is a bit strange, it would have been simpler (and saver) to create
a new Ant object each time. Note that #executeForkedAntTask this is (by
accident) the behaviour.

I have made a change to Ant.java (attached) which will weed out
duplicate property elements. This should allow the Axis code to work.

I can commit this (with test case) if it solves the Axis problem.

Peter
>
> The last details are irrelevant.
>
> What happens is that with the CVS HEAD version, the property named
> file will always have the first file name in each child build file.
> If I back out Revision 1.84 it will have the last one, but it looks
> more as if the previous <property> would be ignored, rather than that
> some kind of override was going on.
>
> I'll look further, but maybe anybody else can see what's happening.
>
> Stefan
>
> Footnotes:
> [1]  http://cvs.apache.org/viewcvs/ws-axis/java/buildTest.xml
>
> [2] 
> http://cvs.apache.org/viewcvs/ws-axis/java/tools/org/apache/axis/tools/ant/
>foreach/ForeachTask.java
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
Index: src/main/org/apache/tools/ant/taskdefs/Ant.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v
retrieving revision 1.87
diff -u -r1.87 Ant.java
--- src/main/org/apache/tools/ant/taskdefs/Ant.java	4 Sep 2003 11:46:03 -0000	1.87
+++ src/main/org/apache/tools/ant/taskdefs/Ant.java	10 Sep 2003 13:09:28 -0000
@@ -62,6 +62,8 @@
 import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.Vector;
+import java.util.Set;
+import java.util.HashSet;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildListener;
 import org.apache.tools.ant.DefaultLogger;
@@ -434,6 +436,16 @@
      * @throws BuildException under unknown circumstances
      */
     private void overrideProperties() throws BuildException {
+        // remove duplicate properties - last property wins
+        Set set = new HashSet();
+        for (int i = properties.size() - 1; i >= 0; --i) {
+            Property p = (Property) properties.get(i);
+            if (set.contains(p.getName())) {
+                properties.remove(i);
+            } else {
+                set.add(p.getName());
+            }
+        }
         Enumeration e = properties.elements();
         while (e.hasMoreElements()) {
             Property p = (Property) e.nextElement();

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to