[PATCH] few improvements ( repost )

Costin Manolache <[email protected]>
Newsgroups gmane.comp.jakarta.alexandria.devel
Message-ID <[email protected]>
I'm sending the patch again ( trying to get in sync ).
Please let me know if there's any problem with it.

Changes:
- indentation
- "priority" attribute to bubble projects to the top 
- read a customization script
- pass custom options to java
- echo the command and classpath before executing

Costin

Index: java/Jenny.java
===================================================================
RCS file: /home/cvs/jakarta-alexandria/proposal/gump/java/Jenny.java,v
retrieving revision 1.19
diff -u -r1.19 Jenny.java
--- java/Jenny.java     27 Aug 2002 14:54:09 -0000      1.19
+++ java/Jenny.java     21 Nov 2002 20:12:05 -0000
@@ -62,7 +62,7 @@
 // TRaX classes
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.*;
 
 // Java API for XML Parsing classes
 import javax.xml.parsers.DocumentBuilder;
@@ -328,7 +328,9 @@
     private void output(Node dom, String dest) throws Exception {
         DOMSource in = new DOMSource(dom);
         StreamResult out = new StreamResult(dest);
-        tFactory.newTransformer().transform(in, out);
+        Transformer t=tFactory.newTransformer();
+        t.setOutputProperty( OutputKeys.INDENT, "yes" );
+        t.transform(in, out);
     }
 
     /**
Index: java/Project.java
===================================================================
RCS file: /home/cvs/jakarta-alexandria/proposal/gump/java/Project.java,v
retrieving revision 1.44
diff -u -r1.44 Project.java
--- java/Project.java   27 Aug 2002 14:54:09 -0000      1.44
+++ java/Project.java   21 Nov 2002 20:12:05 -0000
@@ -497,8 +497,10 @@
     }
 
     /**
-     * Implement a deterministing sort order.  Projects which are most
-     * referenced get priority.  After that, order is determined 
alphabetically.
+     * Implement a deterministing sort order.  Projects with high 
'priority' attribute
+     * are first. Then projects which are most referenced get priority.
+     * After that, order is determined alphabetically.
+     * 
      */
     private static class Ranker implements Comparator {
         public int compare(Object o1, Object o2) {
@@ -508,6 +510,16 @@
             if (p1 == null) return -1;
             if (p2 == null) return 1;
 
+            String p1Priority=p1.get("priority");
+            if( "".equals( p1Priority )) p1Priority=null;
+            String p2Priority=p2.get("priority");
+            if( "".equals( p2Priority )) p2Priority=null;
+            if( p1Priority!=null || p2Priority!=null ) {
+                if( p1Priority==null ) return 1;
+                if( p2Priority==null ) return -1;
+                return (p1Priority).compareTo( p2Priority);
+            }
+            
             int diff = p2.referencedBy.size() - p1.referencedBy.size();
             if (diff != 0) return diff;
 
Index: stylesheet/bash.xsl
===================================================================
RCS file: /home/cvs/jakarta-alexandria/proposal/gump/stylesheet/bash.xsl,v
retrieving revision 1.81
diff -u -r1.81 bash.xsl
--- stylesheet/bash.xsl 24 Jul 2002 11:34:37 -0000      1.81
+++ stylesheet/bash.xsl 21 Nov 2002 20:12:06 -0000
@@ -58,6 +58,7 @@
 
   <xsl:template match="build">
     <xsl:text>#!/bin/bash&#10;</xsl:text>
+    <xsl:text>if [ -f gump_local.sh ] ; then source gump_local.sh ; fi 
&#10;</xsl:text>
     <xsl:text>export SCORECARD_FILE="</xsl:text><xsl:value-of 
select="scorecard/@file"/><xsl:text>"&#10;</xsl:text>
     <xsl:text>export SCORECARD="&gt;&gt;$SCORECARD_FILE"&#10;</xsl:text>
     <xsl:text>rm -f $SCORECARD_FILE&#10;</xsl:text>
@@ -423,13 +424,69 @@
       <xsl:text>`cygpath --path --windows "$CLASSPATH"`&#10;</xsl:text>
     </xsl:if>
 
+    <!-- Display the executed command and params -->
+    <xsl:text>eval "pwd $OUT 2&gt;&amp;1"&#10;</xsl:text>
+    <xsl:text>eval "echo CLASSPATH=$CLASSPATH &lt;/dev/null $OUT 
2&gt;&amp;1"&#10;</xsl:text>
+
+    <xsl:text>eval "echo </xsl:text>
+    <xsl:text>java </xsl:text>
+
+    <xsl:if test="bootclass">
+      <xsl:text> -Xbootclasspath/p:</xsl:text>
+      <xsl:for-each select="bootclass">
+        <xsl:if test="position()!=1">
+          <xsl:text>:</xsl:text>
+        </xsl:if>
+        <xsl:value-of select="translate(@location,'\','/')"/>
+      </xsl:for-each>
+    </xsl:if>
+
+    <xsl:text> $GUMP_JAVA_OPTS</xsl:text>
+
+    <xsl:text> </xsl:text><xsl:value-of select="$ant-cmd"/>
+
+    <xsl:text> $GUMP_ANT_OPTS</xsl:text>
+
+    <xsl:if test="@buildfile">
+      <xsl:text> -f </xsl:text>
+      <xsl:value-of select="translate(@buildfile,'\','/')"/>
+    </xsl:if>
+
+    <xsl:for-each select="property">
+      <xsl:text> -D</xsl:text>
+      <xsl:value-of select="@name"/>
+      <xsl:text>=</xsl:text>
+      <xsl:choose>
+        <xsl:when test="@type = 'path' and $cygwin = 1">
+          <xsl:text>'`cygpath --path --windows "</xsl:text>
+          <xsl:value-of select="@value"/>
+          <xsl:text>"`'</xsl:text>
+        </xsl:when>
+        <xsl:otherwise><xsl:value-of select="@value"/></xsl:otherwise>
+      </xsl:choose>
+    </xsl:for-each>
+
+    <xsl:choose>
+      <xsl:when test="count(../ant)=1">
+        <xsl:text> $TARGET</xsl:text>
+      </xsl:when>
+      <xsl:when test="@target">
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="@target"/>
+      </xsl:when>
+    </xsl:choose>
+
+    <xsl:text> &lt;/dev/null $OUT 2&gt;&amp;1"&#10;</xsl:text>
+
+    <!-- Do the real thing -->
+
     <xsl:text>eval </xsl:text>
     <xsl:if test="$cmd-prefix">
        <xsl:text>"</xsl:text>
        <xsl:value-of select="$cmd-prefix"/>
        <xsl:text>" </xsl:text>
     </xsl:if>
-    <xsl:text>"java</xsl:text>
+    <xsl:text>"java </xsl:text>
 
     <xsl:if test="bootclass">
       <xsl:text> -Xbootclasspath/p:</xsl:text>
@@ -441,7 +498,11 @@
       </xsl:for-each>
     </xsl:if>
 
+    <xsl:text> $GUMP_JAVA_OPTS</xsl:text>
+
     <xsl:text> </xsl:text><xsl:value-of select="$ant-cmd"/>
+
+    <xsl:text> $GUMP_ANT_OPTS</xsl:text>
 
     <xsl:if test="@buildfile">
       <xsl:text> -f </xsl:text>
Index: stylesheet/update.xsl
===================================================================
RCS file: /home/cvs/jakarta-alexandria/proposal/gump/stylesheet/update.xsl,v
retrieving revision 1.18
diff -u -r1.18 update.xsl
--- stylesheet/update.xsl       24 Jul 2002 11:34:37 -0000      1.18
+++ stylesheet/update.xsl       21 Nov 2002 20:12:06 -0000
@@ -1,4 +1,5 @@
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">
+  <xsl:output method="XML" indent="yes" />
 
   <xsl:variable name="basedir" select="/workspace/@basedir"/>
   <xsl:variable name="logdir"  select="/workspace/@logdir"/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.