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 2001/09/29 21:52:03 UTC

cvs commit: jakarta-alexandria/proposal/gump/stylesheet sortdep.xsl defaults.xsl

rubys       01/09/29 12:52:03

  Modified:    proposal/gump gen.java
               proposal/gump/project jakarta-ant.xml
               proposal/gump/stylesheet sortdep.xsl
  Removed:     proposal/gump/stylesheet defaults.xsl
  Log:
  XSLT => Java
  
  Revision  Changes    Path
  1.17      +49 -9     jakarta-alexandria/proposal/gump/gen.java
  
  Index: gen.java
  ===================================================================
  RCS file: /home/cvs/jakarta-alexandria/proposal/gump/gen.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- gen.java	2001/09/29 15:41:06	1.16
  +++ gen.java	2001/09/29 19:52:03	1.17
  @@ -213,10 +213,13 @@
         * reference="jarpath" and classpath="true" are added.
         * @param document to be transformed
         */
  -    private void antDependsToProperties(Document document) throws Exception {
  -        NodeIterator nl = XPathAPI.selectNodeIterator(document, "//ant/depend");
  -        for (Node depend=nl.nextNode(); depend!=null; depend=nl.nextNode()) {
  +    private void antDependsToProperties(Element project) throws Exception {
  +        Document document = project.getOwnerDocument();
   
  +        NodeIterator nl = XPathAPI.selectNodeIterator(project, "ant/depend");
  +        for (Node depend=nl.nextNode(); depend!=null;) {
  +            Node next = nl.nextNode();
  +
               // create a new element based on existing element
               Element property = document.createElement("property");
               property.setAttribute("reference", "jarpath");
  @@ -234,6 +237,8 @@
   
               // replace existing element with new one
               depend.getParentNode().replaceChild(property, depend);
  +
  +            depend = next;
           }
       }
   
  @@ -271,6 +276,42 @@
       /**
         * Flatten all projects, and in the process resolve all home directories.
         */
  +    private void genDepends(Element project) throws Exception {
  +        Document document = project.getOwnerDocument();
  +        String name = project.getAttribute("name");
  +
  +        antDependsToProperties(project);
  +
  +        Hashtable depends = new Hashtable();
  +        NodeIterator nl = XPathAPI.selectNodeIterator(project, "depend|option");
  +        for (Node child=nl.nextNode(); child!=null; child=nl.nextNode()) {
  +            depends.put(((Element)child).getAttribute("project"), child);
  +        }
  +
  +        nl = XPathAPI.selectNodeIterator(project, "ant/property");
  +        for (Node child=nl.nextNode(); child!=null; child=nl.nextNode()) {
  +            Element property = (Element) child;
  +
  +            String dependency = property.getAttribute("project");
  +            if (dependency.equals("")) continue;
  +            if (dependency.equals(name)) continue;
  +            if (depends.get(dependency) != null) continue;
  +
  +            if (property.getAttribute("reference").equals("srcdir")) continue;
  +
  +            Element depend = document.createElement("depend");
  +            depend.setAttribute("project", dependency);
  +            if (property.getAttributeNode("classpath") == null)
  +                depend.appendChild(document.createElement("noclasspath"));
  +
  +            project.appendChild(depend);
  +            depends.put(dependency, depend);
  +        }
  +    }
  +
  +    /**
  +      * Flatten all projects, and in the process resolve all home directories.
  +      */
       private void computeHome(Element workspace) throws Exception {
           String basedir = workspace.getAttribute("basedir");
           String pkgdir = workspace.getAttribute("pkgdir");
  @@ -308,6 +349,8 @@
                    if (home.equals("")) home=srcdir;
                    project.setAttribute("home", home);
                }
  +
  +             genDepends(project);
           }
       }
   
  @@ -357,16 +400,13 @@
           Element workspace = (Element)doc.getFirstChild();
           workspaceDefaults(workspace);
   
  -        expand((Element)workspace);
  +        expand(workspace);
           computeSrcdir(workspace);
           computeHome(workspace);
           flatten("repository", workspace);
  -        antDependsToProperties(doc);
  -
  -        Node resolved = transform(doc, "defaults.xsl");
  -        output (resolved, "work/merge.xml");
  +        output (doc, "work/merge.xml");
   
  -        Node sorted   = transform(resolved, "sortdep.xsl");
  +        Node sorted   = transform(doc, "sortdep.xsl");
           output (sorted, "work/sorted.xml");
       }
   
  
  
  
  1.19      +0 -1      jakarta-alexandria/proposal/gump/project/jakarta-ant.xml
  
  Index: jakarta-ant.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-alexandria/proposal/gump/project/jakarta-ant.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- jakarta-ant.xml	2001/08/24 19:28:06	1.18
  +++ jakarta-ant.xml	2001/09/29 19:52:03	1.19
  @@ -31,7 +31,6 @@
       <depend project="xml-xerces"/>
       <depend project="xml-xalan2"/>
       <option project="xml-xalan1-compat"/>
  -    <option project="xml-stylebook1"/>
       <option project="xml-stylebook2"/>
       <option project="bsf"/>
       <option project="junit"/>
  
  
  
  1.4       +1 -1      jakarta-alexandria/proposal/gump/stylesheet/sortdep.xsl
  
  Index: sortdep.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-alexandria/proposal/gump/stylesheet/sortdep.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sortdep.xsl	2001/04/24 02:36:42	1.3
  +++ sortdep.xsl	2001/09/29 19:52:03	1.4
  @@ -90,7 +90,7 @@
         <xsl:for-each select="/workspace/project">
           <xsl:if test="not(contains($done,concat(':',@name,':')))">
              <xsl:variable name="project" select="@name"/>
  -           <xsl:for-each select="depend|option">
  +           <xsl:for-each select="depend">
                <xsl:variable name="depend" select="@project"/>
                <xsl:if test="not(/workspace/project[@name=$depend])">
                  <xsl:message terminate="yes">
  
  
  

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