You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by "Adam R. B. Jack" <aj...@trysybase.com> on 2003/10/20 16:06:13 UTC

Unnamed property in depend

http://jakarta.apache.org/gump/ant.html#depend says that the property (name)
attribute is mandatory, but there are a number of cases where it isn't set.
Anybody know what traditional behaviour was? I.e. name the property after
the project?

regards

Adam

ERROR:gump:Unnamed property in depend for: jdom on jakarta-slide
ERROR:gump:Unnamed property in depend for: wsdl4j on ws-axis
ERROR:gump:Unnamed property in depend for: jakarta-log4j on ws-axis
ERROR:gump:Unnamed property in depend for: commons-collections on
excalibur-thread
ERROR:gump:Unnamed property in depend for: xjavadoc on xdoclet-compile-core
ERROR:gump:Unnamed property in depend for: jakarta-servletapi on
jakarta-turbine-flux
ERROR:gump:Unnamed property in depend for: jakarta-turbine-3 on
jakarta-turbine-flux
ERROR:gump:Unnamed property in depend for: jakarta-turbine-fulcrum on
jakarta-turbine-flux
ERROR:gump:Unnamed property in depend for: jakarta-velocity on
jakarta-turbine-flux
ERROR:gump:Unnamed property in depend for: db-torque on jakarta-turbine-flux
ERROR:gump:Unnamed property in depend for: jaf on jakarta-turbine-flux
ERROR:gump:Unnamed property in depend for: xjavadoc on xdoclet
ERROR:gump:Unnamed property in depend for: jakarta-cactus-integration-ant-13
on jakarta-jetspeed
ERROR:gump:Unnamed property in depend for: jakarta-cactus-framework-12 on
jakarta-jetspeed
ERROR:gump:Unnamed property in depend for: jakarta-cactus-framework-13 on
jakarta-jetspeed
ERROR:gump:Unnamed property in depend for: junit on jakarta-jetspeed
ERROR:gump:Unnamed property in depend for: xjavadoc on xdoclet-examples

--
Experience Sybase Technology...
http://www.try.sybase.com


Re: Unnamed property in depend

Posted by "Adam R. B. Jack" <aj...@trysybase.com>.
Stefan wrote:

> I looked into both project descriptors (assuming I understand the
> message, it should be the projects named jakarta-slide and
> jakarta-jetspeed) and both contain <depend>s inside <ant> with name
> attributes.
[...]
> so the name attribute (if present) wins over the property attribute.
> If both happen to be absent, nothing happens.

Thanks Stefan. The first one I looked at didn't have a 'name' attribute
either, but I can add that. The Python code is currently written pretty 'low
level' with stuff like this (I guess the part of the code that was written
in Java before) and don't handle 'do nothing' to well. As such, for now I'll
add:

    # Name the property...
    if depend.property:

            property['name']=depend.property

    elif not hasattr(property,'name'):

            # :TODO: Reconsider later, but default to project name for
now...

            property['name']=depend.project

            log.warn('Unnamed property in depend for: ' + depend.project + '
on ' + project.name)

Thanks for your help.

regards

Adam


Re: Unnamed property in depend

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 20 Oct 2003, Adam R. B. Jack <aj...@trysybase.com> wrote:

> http://jakarta.apache.org/gump/ant.html#depend says that the
> property (name) attribute is mandatory, but there are a number of
> cases where it isn't set.

Just picking two that I looked into

> ERROR:gump:Unnamed property in depend for: jdom on jakarta-slide
> ERROR:gump:Unnamed property in depend for: junit on jakarta-jetspeed

I looked into both project descriptors (assuming I understand the
message, it should be the projects named jakarta-slide and
jakarta-jetspeed) and both contain <depend>s inside <ant> with name
attributes.

> Anybody know what traditional behaviour was? I.e. name the property
> after the project?

This is the relevan Java code in Project.java:

    /**
     * Replace ant "depend" elements with "property" elements.  This is
     * a convenience "syntatic sugar" that makes for simpler project
     * definitions.  Attribute "property" becomes name.  Attributes
     * reference="jarpath" and classpath="true" are added.
     * @param ant &lt;ant&gt; element to be processed
     */
    private void genProperties(Element ant) throws Exception {

        Node child=ant.getFirstChild();
        while (child != null) {
            Node next = child.getNextSibling();

            if (child.getNodeName().equals("depend")) {
                // create a new element based on existing element
                Element property = document.createElement("property");
                property.setAttribute("reference", "jarpath");
                property.setAttribute("classpath", "add");
                Jenny.moveChildren((Element)child, property);

                // change property attribute to name attribute
                if (property.getAttributeNode("name")==null) {
                   Attr pname = property.getAttributeNode("property");
                   if (pname != null) {
                       property.setAttribute("name",pname.getValue());
                       property.removeAttributeNode(pname);
                   }
                }

                // replace existing element with new one
                ant.replaceChild(property, child);
            }

            child = next;
        }
    }

so the name attribute (if present) wins over the property attribute.
If both happen to be absent, nothing happens.

Stefan