You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2006/10/03 23:35:07 UTC

svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Author: peterreilly
Date: Tue Oct  3 14:35:06 2006
New Revision: 452635

URL: http://svn.apache.org/viewvc?view=rev&rev=452635
Log:
Always handle refid first.
Refid normally cannot be used with other
attributes and some types check for this.
The code is broken in a number of places -
if refid is not set first. To fix this,
runtimeconfigurable will now always process
refid first.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java?view=diff&rev=452635&r1=452634&r2=452635
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java Tue Oct  3 14:35:06 2006
@@ -70,6 +70,12 @@
      *  We could also just use SAX2 Attributes and convert to SAX1 ( DOM
      *  attribute Nodes can also be stored in SAX2 Attributes )
      *  XXX under JDK 1.4 you can just use a LinkedHashMap for this purpose -jglick
+     * The only exception to this order is the treatment of
+     * refid. A number of datatypes check if refid is set
+     * when other attributes are set. This check will not
+     * work if the build script has the other attribute before
+     * the "refid" attribute, so now (ANT 1.7) the refid
+     * attribute will be processed first.
      */
     private List/*<String>*/ attributeNames = null;
 
@@ -185,7 +191,11 @@
                 attributeNames = new ArrayList();
                 attributeMap = new HashMap();
             }
-            attributeNames.add(name);
+            if (name.toLowerCase(Locale.US).equals("refid")) {
+                attributeNames.add(0, name);
+            } else {
+                attributeNames.add(name);
+            }
             attributeMap.put(name, value);
             if (name.equals("id")) {
                 this.id = value;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Posted by Peter Reilly <pe...@gmail.com>.
On 10/5/06, Peter Reilly <pe...@gmail.com> wrote:
> On 10/4/06, Antoine Levy-Lambert <an...@gmx.de> wrote:
> > Hi,
> >
> > I think that some guys do the following :
> >
> > <fileset dir="foo" id="foofileset"/>
> > <zipfileset refid="foofileset" prefix="libraries"/>
> >
> > We came across this when I did the work to make zipfileset become a top level type in 1.6. At some stage the construct above did not work any more and some projects in gump did not build. I do not remember the exact details.
> I do not think that it would ever have worked.
Mmm.
Sorry, I did not see the "fileset"..,
should this work or not?

Peter

>
> Peter
>
> >
> > Antoine
> > -------- Original-Nachricht --------
> > Datum: Wed, 4 Oct 2006 17:00:55 -0500
> > Von: "Dominique Devienne" <dd...@gmail.com>
> > An: "Ant Developers List" <de...@ant.apache.org>
> > Betreff: Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java
> >
> > > > > Why stop there, and not enforce refid as the sole authorized attribute
> > > >
> > > > Good point, However, I am sure that some type out there depends
> > > > on the current behaviour.   Peter
> > >
> > > Since they break the principle of least surprise, I wouldn't mind
> > > breaking them ;-)  But I fear I don't represent the majority in the
> > > case. Yet the core substituting the reference with the proper
> > > referenced type would be so much better. --DD
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail: dev-help@ant.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Posted by Peter Reilly <pe...@gmail.com>.
On 10/4/06, Antoine Levy-Lambert <an...@gmx.de> wrote:
> Hi,
>
> I think that some guys do the following :
>
> <fileset dir="foo" id="foofileset"/>
> <zipfileset refid="foofileset" prefix="libraries"/>
>
> We came across this when I did the work to make zipfileset become a top level type in 1.6. At some stage the construct above did not work any more and some projects in gump did not build. I do not remember the exact details.
I do not think that it would ever have worked.

Peter

>
> Antoine
> -------- Original-Nachricht --------
> Datum: Wed, 4 Oct 2006 17:00:55 -0500
> Von: "Dominique Devienne" <dd...@gmail.com>
> An: "Ant Developers List" <de...@ant.apache.org>
> Betreff: Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java
>
> > > > Why stop there, and not enforce refid as the sole authorized attribute
> > >
> > > Good point, However, I am sure that some type out there depends
> > > on the current behaviour.   Peter
> >
> > Since they break the principle of least surprise, I wouldn't mind
> > breaking them ;-)  But I fear I don't represent the majority in the
> > case. Yet the core substituting the reference with the proper
> > referenced type would be so much better. --DD
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hi,

Actually, I just read this bug report [1] that Peter processed and which describes a similar scenario with a zipfileset which gets specialized in a refid.

 <zipfileset id="test.fileset"
                dir="${basedir}"
                includes="test1.jar,test2.jar,test3.jar"/>
                
    <target name="fails">
        <jar destfile="test.war">
            <zipfileset refid="test.fileset"
                        prefix="WEB-INF/lib/"/>
        </jar>
    </target>

Regards,

Antoine
[1] http://issues.apache.org/bugzilla/show_bug.cgi?id=30498

-------- Original-Nachricht --------
Datum: Thu, 05 Oct 2006 00:43:44 +0200
Von: "Antoine Levy-Lambert" <an...@gmx.de>
An: "Ant Developers List" <de...@ant.apache.org>
Betreff: Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

> Hi,
> 
> I think that some guys do the following :
> 
> <fileset dir="foo" id="foofileset"/>
> <zipfileset refid="foofileset" prefix="libraries"/>
> 
> We came across this when I did the work to make zipfileset become a top
> level type in 1.6. At some stage the construct above did not work any more
> and some projects in gump did not build. I do not remember the exact details.
> 
> Antoine
> -------- Original-Nachricht --------
> Datum: Wed, 4 Oct 2006 17:00:55 -0500
> Von: "Dominique Devienne" <dd...@gmail.com>
> An: "Ant Developers List" <de...@ant.apache.org>
> Betreff: Re: svn commit: r452635 -
> /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java
> 
> > > > Why stop there, and not enforce refid as the sole authorized
> attribute
> > >
> > > Good point, However, I am sure that some type out there depends
> > > on the current behaviour.   Peter
> > 
> > Since they break the principle of least surprise, I wouldn't mind
> > breaking them ;-)  But I fear I don't represent the majority in the
> > case. Yet the core substituting the reference with the proper
> > referenced type would be so much better. --DD
> > 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hi,

I think that some guys do the following :

<fileset dir="foo" id="foofileset"/>
<zipfileset refid="foofileset" prefix="libraries"/>

We came across this when I did the work to make zipfileset become a top level type in 1.6. At some stage the construct above did not work any more and some projects in gump did not build. I do not remember the exact details.

Antoine
-------- Original-Nachricht --------
Datum: Wed, 4 Oct 2006 17:00:55 -0500
Von: "Dominique Devienne" <dd...@gmail.com>
An: "Ant Developers List" <de...@ant.apache.org>
Betreff: Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

> > > Why stop there, and not enforce refid as the sole authorized attribute
> >
> > Good point, However, I am sure that some type out there depends
> > on the current behaviour.   Peter
> 
> Since they break the principle of least surprise, I wouldn't mind
> breaking them ;-)  But I fear I don't represent the majority in the
> case. Yet the core substituting the reference with the proper
> referenced type would be so much better. --DD
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Posted by Dominique Devienne <dd...@gmail.com>.
> > Why stop there, and not enforce refid as the sole authorized attribute
>
> Good point, However, I am sure that some type out there depends
> on the current behaviour.   Peter

Since they break the principle of least surprise, I wouldn't mind
breaking them ;-)  But I fear I don't represent the majority in the
case. Yet the core substituting the reference with the proper
referenced type would be so much better. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Posted by Peter Reilly <pe...@gmail.com>.
On 10/4/06, Dominique Devienne <dd...@gmail.com> wrote:
> > Log:
> > Always handle refid first.
> > Refid normally cannot be used with other
> > attributes and some types check for this.
> > The code is broken in a number of places -
> > if refid is not set first. To fix this,
> > runtimeconfigurable will now always process
> > refid first.
>
> Why stop there, and not enforce refid as the sole authorized attribute

Good point,
However, I am sure that some type out there depends
on the current behaviour.
Peter

> in the core then? I've always felt it was were it belonged, especially
> as I kept writing the same logic over and over in my datatypes... --DD
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: svn commit: r452635 - /ant/core/trunk/src/main/org/apache/tools/ant/RuntimeConfigurable.java

Posted by Dominique Devienne <dd...@gmail.com>.
> Log:
> Always handle refid first.
> Refid normally cannot be used with other
> attributes and some types check for this.
> The code is broken in a number of places -
> if refid is not set first. To fix this,
> runtimeconfigurable will now always process
> refid first.

Why stop there, and not enforce refid as the sole authorized attribute
in the core then? I've always felt it was were it belonged, especially
as I kept writing the same logic over and over in my datatypes... --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org