You are viewing a plain text version of this content. The canonical link for it is here.
Posted to alexandria-dev@jakarta.apache.org by ru...@apache.org on 2002/01/13 00:03:25 UTC

cvs commit: jakarta-alexandria/proposal/gump/java Project.java

rubys       02/01/12 15:03:25

  Modified:    proposal/gump/java Project.java
  Log:
  Refactor; also ensure that inherit="jars" is processed in addition to
  whatever other inheritance is specified.
  
  Revision  Changes    Path
  1.25      +31 -41    jakarta-alexandria/proposal/gump/java/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-alexandria/proposal/gump/java/Project.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Project.java	12 Jan 2002 13:07:05 -0000	1.24
  +++ Project.java	12 Jan 2002 23:03:25 -0000	1.25
  @@ -316,39 +316,34 @@
               Project p = (Project) projects.get(depend.getAttribute("project"));
               if (p == null) continue;
   
  -            // if inherit="all" is specified on a depends element, then all
  -            // of the optional and depends elements on the referenced project
  -            // are inherited by this project.
  -            //
  -            // if inherit="hard", the same thing happens except that all 
  -            // optional dependencies are converted to "hard" dependencies in 
  -            // the copy.
  -            if (inherit.equals("all") || inherit.equals("hard")) {
  -                for (Enumeration d=p.dependsOn.keys(); d.hasMoreElements(); ) {
  -                    String name = (String) d.nextElement();
  -                    if (dependsOn.get(name) == null) {
  -                        Element source = (Element) p.dependsOn.get(name);
  -                        String type = source.getNodeName();
  -                        Element clone = (Element) source.cloneNode(true);
  -                        if (inherit.equals("hard") && type.equals("option")) {
  -                            Element renamed = document.createElement("depend");
  -                            Jenny.moveChildren(clone, renamed);
  -                            clone = renamed;
  -                        }
  -                        clone.setAttribute("inherited", "true");
  -                        dependsOn.put(name,clone);
  -                        element.appendChild(clone);
  +            for (Enumeration d=p.dependsOn.keys(); d.hasMoreElements(); ) {
  +                String name = (String) d.nextElement();
  +                if (dependsOn.get(name) != null) continue;
  +                Element source = (Element) p.dependsOn.get(name);
  +                String type = source.getNodeName();
  +
  +                // if inherit="all" is specified on a depends element, then all
  +                // of the optional and depends elements on the referenced 
  +                // project are inherited by this project.
  +                //
  +                // if inherit="hard", the same thing happens except that all 
  +                // optional dependencies are converted to "hard" dependencies
  +                // in the copy.
  +                if (inherit.equals("all") || inherit.equals("hard")) {
  +                    Element clone = (Element) source.cloneNode(true);
  +                    if (inherit.equals("hard") && type.equals("option")) {
  +                        Element renamed = document.createElement("depend");
  +                        Jenny.moveChildren(clone, renamed);
  +                        clone = renamed;
                       }
  -                }
  -            } else if (inherit.equals("runtime")) {
  +                    clone.setAttribute("inherited", "true");
  +                    dependsOn.put(name,clone);
  +                    element.appendChild(clone);
  +
                   // look for runtime="true" dependencies in the referenced
                   // project.  Convert depends to options if the reference to
                   // the project is an option.
  -                String type = depend.getNodeName();
  -                for (Enumeration d=p.dependsOn.keys(); d.hasMoreElements(); ) {
  -                    String name = (String) d.nextElement();
  -                    if (dependsOn.get(name) != null) continue;
  -                    Element source = (Element) p.dependsOn.get(name);
  +                } else if (inherit.equals("runtime")) {
                       if (source.getAttribute("runtime").equals("true")) {
                           Element clone = (Element) source.cloneNode(true);
                           if (type.equals("option")) {
  @@ -361,21 +356,16 @@
                           element.appendChild(clone);
                       }
                   }
  -            } else {
  +
                   // if this project depends on any project which in turn has
                   // a dependency which specifies inherit="jars", then inherit
                   // that dependency.
  -                for (Enumeration d=p.dependsOn.keys(); d.hasMoreElements(); ) {
  -                    String name = (String) d.nextElement();
  -                    if (dependsOn.get(name) != null) continue;
  -                    Element source = (Element) p.dependsOn.get(name);
  -                    if (source.getAttribute("inherit").equals("jars")) {
  -                        Element clone = (Element) source.cloneNode(true);
  -                        clone.setAttribute("inherited", "true");
  -                        clone.removeAttribute("inherit");
  -                        dependsOn.put(name,clone);
  -                        element.appendChild(clone);
  -                    }
  +                if (source.getAttribute("inherit").equals("jars")) {
  +                    Element clone = (Element) source.cloneNode(true);
  +                    clone.setAttribute("inherited", "true");
  +                    clone.removeAttribute("inherit");
  +                    dependsOn.put(name,clone);
  +                    element.appendChild(clone);
                   }
               }
           }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>