Hi,
To make it easier to work on some Gump failures with the
jakarta-tomcat-xxx projects, I modified Gump to add the
following two features:
1) Gump will make a local copy of external href's, so they can be
published successfully. It works for href's that begin with "http://"
and "file://". I made similar changes in bash.xsl that I made in
win2k.xsl. So far, I have only tested the changes with Win2k.
2) A "remove" attribute on a project (or a module, repository, or
server) will cause it to be ignored. This allows me remove
unnecessary projects in a module file and avoid introducing their
dependencies into the workspace. This lets me get the Gump cycle
time down for dealing with jakarta-tomcat-xxx Gump problems.
Feel free to use a different name than "remove" if there is something
more consistent.
Attached are the diffs for implementing these features.
Cheers,
Larry Isaacs
--- C:\Dev\Jakarta\Misc\jakarta-alexandria\proposal\gump\java\CVS\Base\Jenny.java
Mon Mar 25 08:23:10 2002
+++ C:\Dev\Jakarta\Misc\jakarta-alexandria\proposal\gump\java\Jenny.java Fri
+Apr 19 19:37:41 2002
@@ -21,6 +21,7 @@
import java.util.Date;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Vector;
public class Jenny {
@@ -107,6 +108,9 @@
String source=href.getValue();
Node sub = parse(source);
+ boolean isExtern = source.startsWith("http://")
+ || source.startsWith("file://");
+
if (sub != null) {
if (source.lastIndexOf(".")>0) {
source=source.substring(0,source.lastIndexOf("."));
@@ -134,6 +138,20 @@
node.getParentNode().replaceChild(copy,node);
node = copy;
+
+ // if expanded xml is not local to gump, make a local copy
+ // and "redirect" location using extern-prefix attribute
+ if (isExtern) {
+ String prefix = node.getNodeName() + "_";
+ // try to use name attribute as source, otherwise cross
+ // fingers and hope the current source is unique
+ if (node.getAttribute("name") != null) {
+ source = node.getAttribute("name");
+ }
+ output (sub, "work/" + prefix + source + ".xml");
+ node.setAttribute("defined-in", source);
+ node.setAttribute("extern-prefix",prefix);
+ }
}
}
@@ -182,7 +200,8 @@
/**
* Merge the contents of nodes with the same value for the name attribute.
* Attributes from later definitions get added (or overlay) prior
- * definitions. Elements get appended.
+ * definitions. Elements get appended. Elements marked for removal are
+ * removed.
* @param type Element localname. Typically project or repository.
* @param document Starting point for search.
* @return hashtable of resulting elements
@@ -190,6 +209,7 @@
private Hashtable merge(String type, Node document)
throws Exception
{
+ boolean needRemove = false;
Hashtable list = new Hashtable();
Node child=document.getFirstChild();
@@ -198,6 +218,12 @@
Element element = (Element) child;
String name = element.getAttribute("name");
+ // check for "removed" elements
+ if (!needRemove
+ && !element.getAttribute("remove").equals("")) {
+ needRemove = true;
+ }
+
Element priorDefinition = (Element)list.get(name);
if (priorDefinition != null && priorDefinition != element) {
Element parent = (Element)priorDefinition.getParentNode();
@@ -210,6 +236,24 @@
parent.removeChild(priorDefinition);
}
list.put(name, element);
+ }
+
+ if (needRemove) {
+ Vector removeThem = new Vector();
+ Enumeration enum = list.elements();
+ while (enum.hasMoreElements()) {
+ Element element = (Element)enum.nextElement();
+ if (!element.getAttribute("remove").equals("")) {
+ removeThem.addElement(element);
+ }
+ }
+
+ enum = removeThem.elements();
+ while (enum.hasMoreElements()) {
+ Element element = (Element)enum.nextElement();
+ element.getParentNode().removeChild(element);
+ list.remove(element.getAttribute("name"));
+ }
}
return list;
--- C:\Dev\Jakarta\Misc\jakarta-alexandria\proposal\gump\java\CVS\Base\Module.java
Fri Mar 15 06:41:58 2002
+++ C:\Dev\Jakarta\Misc\jakarta-alexandria\proposal\gump\java\Module.java Fri
+Apr 19 13:33:25 2002
@@ -171,10 +171,13 @@
// Move each project from the module to the workspace
Node parent = element.getParentNode();
String definedIn = element.getAttribute("defined-in");
+ String prefix = element.getAttribute("extern-prefix");
for (Enumeration e=projects.elements(); e.hasMoreElements(); ) {
Element project = (Element) e.nextElement();
if (project.getAttributeNode("defined-in") == null) {
project.setAttribute("defined-in", definedIn);
+ if (!prefix.equals(""))
+ project.setAttribute("extern-prefix",prefix);
}
element.removeChild(project);
parent.appendChild(project);
--- C:\Dev\Jakarta\Misc\jakarta-alexandria\proposal\gump\stylesheet\CVS\Base\win2k.xsl
Sat Mar 16 15:11:52 2002
+++ C:\Dev\Jakarta\Misc\jakarta-alexandria\proposal\gump\stylesheet\win2k.xsl Fri
+Apr 19 10:42:44 2002
@@ -131,7 +131,7 @@
<xsl:template match="sed">
<xsl:text>perl </xsl:text>
<xsl:value-of select="@script"/>
- <xsl:text> ..\%1 %OUT% </xsl:text>
+ <xsl:text> %1 %OUT% </xsl:text>
</xsl:template>
<!-- =================================================================== -->
@@ -172,7 +172,11 @@
<xsl:if test="@defined-in">
<xsl:variable name="defined-in" select="@defined-in"/>
<xsl:if test="not(preceding::project[@defined-in=$defined-in])">
- <xsl:text>call publish project\</xsl:text>
+ <xsl:text>call publish </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>..\project\</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
<xsl:value-of select="@defined-in"/>
<xsl:text>.xml </xsl:text>
<xsl:value-of select="$logdir"/>
@@ -187,7 +191,11 @@
<xsl:sort select="defined-in"/>
<xsl:variable name="defined-in" select="@defined-in"/>
<xsl:if test="not(preceding::project[@defined-in=$defined-in])">
- <xsl:text>call publish repository\</xsl:text>
+ <xsl:text>call publish </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>..\repository\</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
<xsl:value-of select="@defined-in"/>
<xsl:text>.xml </xsl:text>
<xsl:value-of select="$logdir"/>
@@ -200,7 +208,11 @@
<xsl:for-each select="profile">
<xsl:sort select="defined-in"/>
- <xsl:text>call publish profile\</xsl:text>
+ <xsl:text>call publish </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>..\profile\</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
<xsl:value-of select="@defined-in"/>
<xsl:text>.xml </xsl:text>
<xsl:value-of select="$logdir"/>
@@ -209,8 +221,31 @@
<xsl:text>.html </xsl:text>
</xsl:for-each>
+ <xsl:for-each select="server">
+ <xsl:sort select="defined-in"/>
+ <xsl:variable name="defined-in" select="@defined-in"/>
+ <xsl:if test="not(preceding::server[@defined-in=$defined-in])">
+ <xsl:text>call publish </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>..\server\</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
+ <xsl:value-of select="@defined-in"/>
+ <xsl:text>.xml </xsl:text>
+ <xsl:value-of select="$logdir"/>
+ <xsl:text>\server_</xsl:text>
+ <xsl:value-of select="@defined-in"/>
+ <xsl:text>.html </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+
<xsl:text>for %%i in (..\stylesheet\*.xsl) do </xsl:text>
- <xsl:text>call publish stylesheet\%%~nxi </xsl:text>
+ <xsl:text>call publish </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>..\stylesheet\</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
+ <xsl:text>%%~nxi </xsl:text>
<xsl:value-of select="$logdir"/>
<xsl:text>\code_%%~ni.html </xsl:text>
--- C:\Dev\Jakarta\Misc\jakarta-alexandria\proposal\gump\stylesheet\CVS\Base\bash.xsl
Wed Mar 20 11:42:37 2002
+++ C:\Dev\Jakarta\Misc\jakarta-alexandria\proposal\gump\stylesheet\bash.xsl Fri
+Apr 19 10:45:58 2002
@@ -162,7 +162,7 @@
<xsl:template match="sed">
<xsl:text>eval "perl </xsl:text>
<xsl:value-of select="@script"/>
- <xsl:text> ../$1 $OUT" </xsl:text>
+ <xsl:text> $1 $OUT" </xsl:text>
</xsl:template>
<!-- =================================================================== -->
@@ -203,7 +203,11 @@
<xsl:if test="@defined-in">
<xsl:variable name="defined-in" select="@defined-in"/>
<xsl:if test="not(preceding::project[@defined-in=$defined-in])">
- <xsl:text>bash publish.sh project/</xsl:text>
+ <xsl:text>bash publish.sh </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>../project/</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
<xsl:value-of select="@defined-in"/>
<xsl:text>.xml </xsl:text>
<xsl:value-of select="$logdir"/>
@@ -218,7 +222,11 @@
<xsl:sort select="defined-in"/>
<xsl:variable name="defined-in" select="@defined-in"/>
<xsl:if test="not(preceding::repository[@defined-in=$defined-in])">
- <xsl:text>bash publish.sh repository/</xsl:text>
+ <xsl:text>bash publish.sh </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>../repository/</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
<xsl:value-of select="@defined-in"/>
<xsl:text>.xml </xsl:text>
<xsl:value-of select="$logdir"/>
@@ -231,7 +239,11 @@
<xsl:for-each select="profile">
<xsl:sort select="defined-in"/>
- <xsl:text>bash publish.sh profile/</xsl:text>
+ <xsl:text>bash publish.sh </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>../profile/</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
<xsl:value-of select="@defined-in"/>
<xsl:text>.xml </xsl:text>
<xsl:value-of select="$logdir"/>
@@ -244,7 +256,11 @@
<xsl:sort select="defined-in"/>
<xsl:variable name="defined-in" select="@defined-in"/>
<xsl:if test="not(preceding::server[@defined-in=$defined-in])">
- <xsl:text>bash publish.sh server/</xsl:text>
+ <xsl:text>bash publish.sh </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>../server/</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
<xsl:value-of select="@defined-in"/>
<xsl:text>.xml </xsl:text>
<xsl:value-of select="$logdir"/>
@@ -255,7 +271,12 @@
</xsl:for-each>
<xsl:text>for i in ../stylesheet/*.xsl; do </xsl:text>
- <xsl:text> bash publish.sh stylesheet/`basename $i` </xsl:text>
+ <xsl:text> bash publish.sh </xsl:text>
+ <xsl:if test="not(@extern-prefix)">
+ <xsl:text>../stylesheet/</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="@extern-prefix"/>
+ <xsl:text>`basename $i` </xsl:text>
<xsl:value-of select="$logdir"/>
<xsl:text>/code_`basename $i .xsl`.html </xsl:text>
<xsl:text>done </xsl:text>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>