nacho 2003/04/02 12:22:35
Modified: stylesheet win2k.xsl build.xsl
. gen.bat
Added: java Launcher.java
stylesheet winxp.xsl
Log:
* Added Launcher class to overcome command line length problems on w2k.
* Added winxp.xsl stylesheet, this is the old win2k.xsl file renamed
* Patched win2k.xsl to use the new launcher class, and to produce properties files
instead of set commands..
* Patched build.xsl to add a reference to basedir, need to construct the bare
classpath to run the launcher..
* Added jenny.jar to the build dir in w2k builds..
Revision Changes Path
1.1 jakarta-gump/java/Launcher.java
Index: Launcher.java
===================================================================
/* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Gump", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
import java.lang.reflect.Method;
import java.util.Properties;
import java.net.URLClassLoader;
import java.net.URL;
import java.io.FileInputStream;
import java.io.File;
import java.util.Vector;
import java.util.Enumeration;
public class Launcher {
public static void main(String[] args) throws Exception {
if (args.length < 2) {
printUsage();
}
String[] realArgs = new String[args.length - 2];
for (int i = 0, c = realArgs.length; i < c; i++) {
realArgs[i] = args[ i + 2];
System.out.println("args="+args[ i + 2]);
}
// Build the classloader
URLClassLoader fc;
Properties p=new Properties();
Vector v=new Vector();
try{
p.load(new FileInputStream(args[0]));
for(Enumeration e=p.propertyNames();e.hasMoreElements();){
String name=(String)e.nextElement();
if (name.indexOf(".boot") > 0)
v.add(0, p.getProperty(name));
else
v.add(p.getProperty(name));
}
} catch (Throwable e) {
e.printStackTrace();
System.exit(1);
}
URL[] cp=new URL[v.size()];
for( int i=0 ; i<v.size() ; i++ ){
File f=new File((String)v.get(i));
cp[i]=f.toURL();
}
// First try to find the class
fc=new URLClassLoader(cp,p.getClass().getClassLoader()){
public Class loadClass(String name) throws ClassNotFoundException {
return super.loadClass(name);
}
};
Class clazz = null;
try {
clazz = fc.loadClass(args[1]);
} catch (ClassNotFoundException e) {
System.err.println("The class " + args[1] + " was not found in the
classpath.");
System.exit(1);
} catch (Throwable e) {
e.printStackTrace();
System.exit(1);
}
// if the class exists, get the main method
Method mainMethod = null;
try {
mainMethod = clazz.getMethod("main", new Class[]{String[].class});
} catch (NoSuchMethodException e) {
System.err.println("No method public static void main(String[] args) in
" + clazz.getName());
System.exit(1);
} catch (Throwable e) {
e.printStackTrace();
System.exit(1);
}
// try to make sure the main method is accessible
try {
mainMethod.setAccessible(true);
} catch (Throwable e) {
}
try {
mainMethod.invoke(null, new Object[]{realArgs});
} catch (IllegalAccessException e) {
System.err.println("Please make sure the class " + clazz.getName() +
" and the method main(String[] args) are public.");
System.exit(1);
} catch (Throwable e) {
e.printStackTrace();
System.exit(1);
}
}
/**
* Description of the Method
*/
static void printUsage() {
String usage = "Launcher - Wrapper to overcome command line length problems
in some OSes\n" +
"Usage: Launcher classpath.properties class [args...]\n" +
"\n";
System.out.println(usage);
System.exit(1);
}
}
1.47 +14 -8 jakarta-gump/stylesheet/win2k.xsl
Index: win2k.xsl
===================================================================
RCS file: /home/cvs/jakarta-gump/stylesheet/win2k.xsl,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- win2k.xsl 3 Feb 2003 13:26:37 -0000 1.46
+++ win2k.xsl 2 Apr 2003 20:22:34 -0000 1.47
@@ -266,6 +266,10 @@
<xsl:value-of select="$basedir"/>
<xsl:text> </xsl:text>
+ <xsl:text>copy ..\jenny.jar </xsl:text>
+ <xsl:value-of select="$basedir"/>
+ <xsl:text> </xsl:text>
+
<xsl:text>echo. </xsl:text>
<xsl:text>goto :eof </xsl:text>
</xsl:template>
@@ -346,17 +350,19 @@
<!-- =================================================================== -->
<xsl:template match="classpath">
- <xsl:text>SET CLASSPATH=%CP%;%JAVA_HOME%\lib\tools.jar </xsl:text>
+ <xsl:text>set CLASSPATH=%CP%;</xsl:text><xsl:value-of
select="translate(/build/@basedir,'/','\')"/><xsl:text>\jenny.jar </xsl:text>
+ <xsl:text>del cp.properties >nul </xsl:text>
+ <xsl:text>echo cp0=%JAVA_HOME:\=/%/lib/tools.jar >>cp.properties
</xsl:text>
<xsl:for-each select="pathelement">
<xsl:if test="not(@type='boot')">
- <xsl:text>SET CLASSPATH=%CLASSPATH%;</xsl:text>
- <xsl:value-of select="translate(@location,'/','\')"/>
- <xsl:text> </xsl:text>
+ <xsl:text>echo cp</xsl:text><xsl:value-of
select="position()"/><xsl:text>=</xsl:text>
+ <xsl:value-of select="translate(@location,'\','/')"/>
+ <xsl:text> >>cp.properties </xsl:text>
</xsl:if>
<xsl:if test="@type='boot'">
- <xsl:text>SET CLASSPATH=</xsl:text>
- <xsl:value-of select="translate(@location,'/','\')"/>
- <xsl:text>;%CLASSPATH% </xsl:text>
+ <xsl:text>echo cp</xsl:text><xsl:value-of
select="position()"/><xsl:text>.boot=</xsl:text>
+ <xsl:value-of select="translate(@location,'\','/')"/>
+ <xsl:text> >>cp.properties </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
@@ -385,7 +391,7 @@
<xsl:value-of select="@value"/>
</xsl:for-each>
- <xsl:text> org.apache.tools.ant.Main</xsl:text>
+ <xsl:text> Launcher </xsl:text><xsl:value-of
select="translate(../initdir/@dir,'/','\')"/><xsl:text>\cp.properties
org.apache.tools.ant.Main</xsl:text>
<xsl:if test="@buildfile">
<xsl:text> -buildfile </xsl:text>
1.54 +1 -1 jakarta-gump/stylesheet/build.xsl
Index: build.xsl
===================================================================
RCS file: /home/cvs/jakarta-gump/stylesheet/build.xsl,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- build.xsl 8 Feb 2003 00:14:37 -0000 1.53
+++ build.xsl 2 Apr 2003 20:22:34 -0000 1.54
@@ -21,7 +21,7 @@
<xsl:template match="workspace">
- <build sync="[EMAIL PROTECTED]">
+ <build sync="[EMAIL PROTECTED]" basedir="{$basedir}" >
<scorecard file="{$logdir}/results.txt"/>
1.1 jakarta-gump/stylesheet/winxp.xsl
Index: winxp.xsl
===================================================================
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output method="text" omit-xml-declaration="yes"/>
<!-- =================================================================== -->
<!-- build -->
<!-- =================================================================== -->
<xsl:template match="scorecard">
</xsl:template>
<xsl:template match="build">
<xsl:text>@echo off </xsl:text>
<xsl:text>@if "%GUMP_ECHO%" == "on" echo %GUMP_ECHO% </xsl:text>
<xsl:text>SETLOCAL </xsl:text>
<xsl:text>SET CP=%CLASSPATH% </xsl:text>
<xsl:text>if "%1"=="all" goto header </xsl:text>
<xsl:text>SET TARGET=%2 %3 %4 %5 %6 %7 %8 %9 </xsl:text>
<xsl:for-each select=".//project">
<xsl:text>if "%1"=="</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" goto </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
</xsl:for-each>
<xsl:text>if not "%1"=="" echo Unknown project: %1 </xsl:text>
<xsl:text>echo Usage: build all ^| clean ^| </xsl:text>
<xsl:text>project [target...] </xsl:text>
<xsl:text>goto eoj </xsl:text>
<xsl:text> :header </xsl:text>
<xsl:apply-templates/>
<xsl:text> :eoj </xsl:text>
<xsl:text>ENDLOCAL </xsl:text>
</xsl:template>
<xsl:template match="build//project">
<xsl:choose>
<xsl:when test="@name='clean'">
<xsl:text> echo Restoring build directories </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> echo Building </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count(.//ant)=1">
<xsl:text>SET TARGET=</xsl:text>
<xsl:value-of select=".//ant/@target"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
<!-- =================================================================== -->
<!-- cvs update -->
<!-- =================================================================== -->
<xsl:template match="update">
<xsl:text>@echo off </xsl:text>
<xsl:text>@if "%GUMP_ECHO%" == "on" echo %GUMP_ECHO% </xsl:text>
<xsl:text>SETLOCAL </xsl:text>
<xsl:text>chdir /d </xsl:text>
<xsl:value-of select="translate(@cvsdir,'/','\')"/>
<xsl:text> </xsl:text>
<xsl:text>if "%1"=="all" goto header </xsl:text>
<xsl:text>:top </xsl:text>
<xsl:for-each select=".//module">
<xsl:text>if "%1"=="</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>" goto </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
</xsl:for-each>
<xsl:text>if not "%1"=="" echo Unknown module: %1 </xsl:text>
<xsl:text>echo Usage: update all ^| module... </xsl:text>
<xsl:text>goto eoj </xsl:text>
<xsl:text> :header </xsl:text>
<xsl:apply-templates/>
<xsl:text> :eoj </xsl:text>
<xsl:text>shift </xsl:text>
<xsl:text>if not "%1"=="" goto top </xsl:text>
<xsl:text>chdir /d </xsl:text>
<xsl:value-of select="@basedir"/>
<xsl:text> </xsl:text>
<xsl:text>ENDLOCAL </xsl:text>
</xsl:template>
<xsl:template match="update//module">
<xsl:text> echo Updating </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<!-- =================================================================== -->
<!-- cross reference -->
<!-- =================================================================== -->
<xsl:template match="xref">
<xsl:text>@echo off </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<!-- =================================================================== -->
<!-- publish an xml source -->
<!-- =================================================================== -->
<xsl:template match="publish">
<xsl:text>@echo off </xsl:text>
<xsl:text>@if "%GUMP_ECHO%" == "on" echo %GUMP_ECHO% </xsl:text>
<xsl:text>echo - %1 </xsl:text>
<xsl:text>SET OUT=^>^>%2 </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="publish//arg">
<xsl:text>echo %1 %OUT% </xsl:text>
</xsl:template>
<xsl:template match="sed">
<xsl:text>perl </xsl:text>
<xsl:value-of select="@script"/>
<xsl:text> %1 %OUT% </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- publish all xml sources -->
<!-- =================================================================== -->
<xsl:template match="workspace">
<xsl:variable name="basedir" select="translate(@basedir, '/', '\')"/>
<xsl:variable name="cvsdir" select="translate(@cvsdir, '/', '\')"/>
<xsl:variable name="logdir" select="translate(@logdir, '/', '\')"/>
<xsl:text>@echo off </xsl:text>
<xsl:text>@if "%GUMP_ECHO%" == "on" echo %GUMP_ECHO% </xsl:text>
<xsl:text>if not exist </xsl:text>
<xsl:value-of select="$basedir"/>
<xsl:text> mkdir </xsl:text>
<xsl:value-of select="$basedir"/>
<xsl:text> </xsl:text>
<xsl:text>if not exist </xsl:text>
<xsl:value-of select="$logdir"/>
<xsl:text> mkdir </xsl:text>
<xsl:value-of select="$logdir"/>
<xsl:text> </xsl:text>
<xsl:text>if not exist </xsl:text>
<xsl:value-of select="$cvsdir"/>
<xsl:text> mkdir </xsl:text>
<xsl:value-of select="$cvsdir"/>
<xsl:text> </xsl:text>
<xsl:text>call publish.bat %1 </xsl:text>
<xsl:value-of select="$logdir"/>
<xsl:text>\workspace.html </xsl:text>
<xsl:for-each select="project">
<xsl:sort select="@defined-in"/>
<xsl:if test="@defined-in">
<xsl:variable name="defined-in" select="@defined-in"/>
<xsl:if test="not(preceding::[EMAIL PROTECTED])">
<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"/>
<xsl:text>\module_</xsl:text>
<xsl:value-of select="@defined-in"/>
<xsl:text>.html </xsl:text>
</xsl:if>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="repository">
<xsl:sort select="defined-in"/>
<xsl:variable name="defined-in" select="@defined-in"/>
<xsl:if test="not(preceding::[EMAIL PROTECTED])">
<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"/>
<xsl:text>\repository_</xsl:text>
<xsl:value-of select="@defined-in"/>
<xsl:text>.html </xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="profile">
<xsl:sort select="defined-in"/>
<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"/>
<xsl:text>\profile_</xsl:text>
<xsl:value-of select="@defined-in"/>
<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::[EMAIL PROTECTED])">
<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 </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>
<xsl:text>call xref.bat </xsl:text>
<xsl:text>copy update.bat </xsl:text>
<xsl:value-of select="$basedir"/>
<xsl:text> </xsl:text>
<xsl:text>copy build.bat </xsl:text>
<xsl:value-of select="$basedir"/>
<xsl:text> </xsl:text>
<xsl:text>echo. </xsl:text>
<xsl:text>goto :eof </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- core logic for a project -->
<!-- =================================================================== -->
<xsl:template match="logic">
<xsl:text>echo ^<XMP^> %OUT% </xsl:text>
<xsl:text>:</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
<xsl:apply-templates/>
<xsl:text>if not "%1"=="all" goto eoj </xsl:text>
<xsl:text>echo ^</XMP^> %OUT% </xsl:text>
<xsl:text>:end_</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text> </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- status information -->
<!-- =================================================================== -->
<xsl:template match="start-time">
<xsl:text>echo %START:~0,8% %OUT% </xsl:text>
</xsl:template>
<xsl:template match="status">
<xsl:text>echo %STATUS% %OUT% </xsl:text>
</xsl:template>
<xsl:template match="date">
<xsl:text>date /t %OUT% </xsl:text>
</xsl:template>
<xsl:template match="date-time">
<xsl:text>SET START=%TIME% </xsl:text>
<xsl:text>date /t %OUT% </xsl:text>
<xsl:text>echo at %START:~0,8% %OUT% </xsl:text>
</xsl:template>
<xsl:template match="[EMAIL PROTECTED]'status']">
<xsl:text>SET STYLE= class="warn" </xsl:text>
<xsl:text>IF "%STATUS%"=="SUCCESS" SET STYLE= </xsl:text>
<xsl:text>IF "%STATUS%"=="FAILED" </xsl:text>
<xsl:text>SET STYLE= class="fail" </xsl:text>
<xsl:text>echo ^<td%STYLE%^> %OUT% </xsl:text>
<xsl:apply-templates/>
<xsl:text>echo ^</td^> %OUT% </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- check for prereqs -->
<!-- =================================================================== -->
<xsl:template match="prereq">
<xsl:variable name="project" select="ancestor::project/@name"/>
<xsl:text>SET STATUS=PREQ FAILURE - </xsl:text>
<xsl:value-of select="@project"/>
<xsl:text> </xsl:text>
<xsl:for-each select="file">
<xsl:text>IF NOT EXIST </xsl:text>
<xsl:value-of select="translate(@path,'/','\')"/>
<xsl:text> goto end_</xsl:text>
<xsl:value-of select="$project"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
<!-- =================================================================== -->
<!-- create the classpath -->
<!-- =================================================================== -->
<xsl:template match="classpath">
<xsl:text>SET CLASSPATH=%CP%;%JAVA_HOME%\lib\tools.jar </xsl:text>
<xsl:for-each select="pathelement">
<xsl:if test="not(@type='boot')">
<xsl:text>SET CLASSPATH=%CLASSPATH%;</xsl:text>
<xsl:value-of select="translate(@location,'/','\')"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="@type='boot'">
<xsl:text>SET CLASSPATH=</xsl:text>
<xsl:value-of select="translate(@location,'/','\')"/>
<xsl:text>;%CLASSPATH% </xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!-- =================================================================== -->
<!-- process Ant based builds -->
<!-- =================================================================== -->
<xsl:template match="ant">
<xsl:text>SET STATUS=SUCCESS </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:for-each select="jvmarg">
<xsl:text> </xsl:text>
<xsl:value-of select="@value"/>
</xsl:for-each>
<xsl:text> org.apache.tools.ant.Main</xsl:text>
<xsl:if test="@buildfile">
<xsl:text> -buildfile </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'">
<xsl:value-of select="translate(@value,'/','\')"/>
</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> <nul %OUT% 2>&1 </xsl:text>
<xsl:text>if errorlevel 1 SET STATUS=FAILED </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- make directories -->
<!-- =================================================================== -->
<xsl:template match="mkdir">
<xsl:text>if not exist </xsl:text>
<xsl:value-of select="translate(@dir,'/','\')"/>
<xsl:text> mkdir </xsl:text>
<xsl:value-of select="translate(@dir,'/','\')"/>
<xsl:text> %OUT% 2>&1 </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- change directories -->
<!-- =================================================================== -->
<xsl:template match="chdir">
<xsl:text>chdir /d </xsl:text>
<xsl:value-of select="translate(@dir,'/','\')"/>
<xsl:text> %OUT% 2>&1 </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- remove directories -->
<!-- =================================================================== -->
<xsl:template match="delete">
<xsl:text>if exist </xsl:text>
<xsl:value-of select="translate(@dir,'/','\')"/>
<xsl:text> rmdir /s /q </xsl:text>
<xsl:value-of select="translate(@dir,'/','\')"/>
<xsl:text> %OUT% 2>&1 </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- copy directories -->
<!-- =================================================================== -->
<xsl:template match="copy">
<xsl:if test="@fromdir">
<xsl:text>xcopy /E /I /Q /R /K </xsl:text>
<xsl:value-of select="translate(@fromdir,'/','\')"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(@todir,'/','\')"/>
<xsl:text> %OUT% 2>&1 </xsl:text>
</xsl:if>
<xsl:if test="@file">
<xsl:text>if exist </xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> if not exist </xsl:text>
<xsl:value-of select="translate(@todir,'/','\')"/>
<xsl:text> mkdir </xsl:text>
<xsl:value-of select="translate(@todir,'/','\')"/>
<xsl:text> %OUT% 2>&1 </xsl:text>
<xsl:text>if exist </xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> copy /Y </xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(@todir,'/','\')"/>
<xsl:text> %OUT% 2>&1 </xsl:text>
</xsl:if>
</xsl:template>
<!-- =================================================================== -->
<!-- Move a file or directory -->
<!-- =================================================================== -->
<xsl:template match="move">
<xsl:if test="@quiet">
<xsl:text>if exist </xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>move </xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(@todir,'/','\')"/>
<xsl:text> </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- Synch a directory -->
<!-- =================================================================== -->
<xsl:template match="sync">
<xsl:value-of select="/build/@sync"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(@fromdir,'/','\')"/>
<xsl:text>\ </xsl:text>
<xsl:value-of select="translate(@todir,'/','\')"/>
<xsl:text> $OUT 2>&1" </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- initialize a directory if it does not currently exist -->
<!-- =================================================================== -->
<xsl:template match="initdir">
<xsl:text>if not exist </xsl:text>
<xsl:value-of select="translate(@dir,'/','\')"/>
<xsl:text> xcopy /E /I /Q /R /K </xsl:text>
<xsl:value-of select="translate(@basedon,'/','\')"/>
<xsl:text> </xsl:text>
<xsl:value-of select="translate(@dir,'/','\')"/>
<xsl:text> </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- batch file / shell scripts -->
<!-- =================================================================== -->
<xsl:template match="script">
<xsl:text>SET STATUS=SUCCESS </xsl:text>
<xsl:text>call .\</xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>.bat %OUT% 2>&1 </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- java compile -->
<!-- =================================================================== -->
<xsl:template match="javac">
<xsl:text>javac </xsl:text>
<xsl:if test="@sourcedir">
<xsl:text>-sourcepath </xsl:text>
<xsl:value-of select="javac/@sourcedir"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="javac/@destdir">
<xsl:text>-d </xsl:text>
<xsl:value-of select="@destdir"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="javac/@sourcedir">
<xsl:text>-sourcepath </xsl:text>
<xsl:value-of select="@sourcedir"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@sourcedir"/>
<xsl:text>/</xsl:text>
</xsl:if>
<xsl:value-of select="javac/@file"/>
<xsl:text> </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- cvs update -->
<!-- =================================================================== -->
<xsl:template match="[EMAIL PROTECTED]">
<xsl:text>SET STATUS=SUCCESS </xsl:text>
<!-- update -->
<xsl:text>if exist </xsl:text>
<xsl:value-of select="translate(@srcdir,'/','\')"/>
<xsl:text> SET CMD=cvs </xsl:text>
<xsl:value-of select="@compress"/>
<xsl:text> -d </xsl:text>
<xsl:value-of select="@cvsroot"/>
<xsl:text> update -P -d</xsl:text>
<xsl:if test="@tag">
<xsl:text> -r </xsl:text>
<xsl:value-of select="@tag"/>
</xsl:if>
<xsl:if test="not(@tag)">
<xsl:text> -A</xsl:text>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="@srcdir"/>
<xsl:text> </xsl:text>
<!-- checkout -->
<xsl:text>if not exist </xsl:text>
<xsl:value-of select="translate(@srcdir,'/','\')"/>
<xsl:text> SET CMD=cvs </xsl:text>
<xsl:value-of select="@compress"/>
<xsl:text> -d </xsl:text>
<xsl:value-of select="@cvsroot"/>
<xsl:text> checkout -P</xsl:text>
<xsl:if test="@tag">
<xsl:text> -r </xsl:text>
<xsl:value-of select="@tag"/>
</xsl:if>
<xsl:if test="@[EMAIL PROTECTED]">
<xsl:text> -d </xsl:text>
<xsl:value-of select="@srcdir"/>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="@module"/>
<xsl:text> </xsl:text>
<!-- execute -->
<xsl:text>@echo %CMD% %OUT% </xsl:text>
<xsl:text>@echo. %OUT% </xsl:text>
<xsl:text>%CMD% %OUT% 2>&1 </xsl:text>
<xsl:text>if errorlevel 1 SET STATUS=FAILED </xsl:text>
<xsl:text>if not "%1"=="all" goto eoj </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- svn update -->
<!-- =================================================================== -->
<xsl:template match="svn">
<xsl:text>SET STATUS=SUCCESS </xsl:text>
<!-- update -->
<xsl:text>if exist </xsl:text>
<xsl:value-of select="translate(@srcdir,'/','\')"/>
<xsl:text> SET CMD=svn update </xsl:text>
<xsl:value-of select="@srcdir"/>
<xsl:text> </xsl:text>
<!-- checkout -->
<xsl:text>if not exist </xsl:text>
<xsl:value-of select="translate(@srcdir,'/','\')"/>
<xsl:text> SET CMD=svn checkout </xsl:text>
<xsl:value-of select="@url"/>
<xsl:text> -d </xsl:text>
<xsl:value-of select="@srcdir"/>
<xsl:text> </xsl:text>
<!-- execute -->
<xsl:text>@echo %CMD% %OUT% </xsl:text>
<xsl:text>@echo. %OUT% </xsl:text>
<xsl:text>%CMD% %OUT% 2>&1 </xsl:text>
<xsl:text>if errorlevel 1 SET STATUS=FAILED </xsl:text>
<xsl:text>if not "%1"=="all" goto eoj </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- support for capturing and including static text -->
<!-- =================================================================== -->
<xsl:template match="output">
<xsl:text>SET OUT=^>^></xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> </xsl:text>
<xsl:text>echo ^<!-- </xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> --^%OUT% </xsl:text>
<xsl:apply-templates/>
<xsl:text>echo ^</!-- </xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> --^> %OUT% </xsl:text>
</xsl:template>
<xsl:template match="include">
<xsl:text>type </xsl:text>
<xsl:value-of select="translate(@file,'/','\')"/>
<xsl:text> %OUT% </xsl:text>
<xsl:apply-templates/>
</xsl:template>
<!-- =================================================================== -->
<!-- default catchers for html and text -->
<!-- =================================================================== -->
<xsl:template match="html">
<xsl:if test="@log">
<xsl:text>SET OUT=^>^></xsl:text>
<xsl:value-of select="translate(@log,'/','\')"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:text>echo ^<html^%OUT% </xsl:text>
<xsl:apply-templates/>
<xsl:text>echo ^</html^> %OUT% </xsl:text>
<xsl:if test="ancestor::html/@log">
<xsl:text>SET OUT=^>^></xsl:text>
<xsl:value-of select="translate(ancestor::html/@log,'/','\')"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="a[count(*)=0 and count(@*)=1]">
<xsl:text>echo ^<a href="</xsl:text>
<xsl:value-of select="@href"/>
<xsl:text>"^></xsl:text>
<xsl:value-of select="."/>
<xsl:text>^</a^> %OUT% </xsl:text>
</xsl:template>
<xsl:template match="*">
<xsl:text>echo ^<</xsl:text>
<xsl:value-of select="name()"/>
<xsl:for-each select="@*">
<xsl:text> </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>="</xsl:text>
<xsl:call-template name="escape">
<xsl:with-param name="string">
<xsl:value-of select="normalize-space(.)"/>
</xsl:with-param>
</xsl:call-template>
<xsl:text>"</xsl:text>
</xsl:for-each>
<xsl:choose>
<xsl:when test="count(*|text())=0">
<!-- note: to accomodate old browsers, a space before the slash -->
<xsl:text> /^> %OUT% </xsl:text>
</xsl:when>
<xsl:when test="count(*)=0">
<!-- put entire tag on one line -->
<xsl:text>^></xsl:text>
<xsl:call-template name="escape">
<xsl:with-param name="string">
<xsl:value-of select="normalize-space(.)"/>
</xsl:with-param>
</xsl:call-template>
<xsl:text>^</</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>^> %OUT% </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>^> %OUT% </xsl:text>
<xsl:apply-templates select="*|text()"/>
<xsl:text>echo ^</</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>^> %OUT% </xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="text()">
<xsl:text>echo </xsl:text>
<xsl:value-of select="normalize-space(.)"/>
<xsl:text> %OUT% </xsl:text>
</xsl:template>
<!-- =================================================================== -->
<!-- escaping strings for the command line -->
<!-- =================================================================== -->
<xsl:template name="escape">
<xsl:param name="string"/>
<xsl:variable name="special"><![CDATA[%&]]></xsl:variable>
<xsl:variable name="work" select="translate($string,$special,'%%')"/>
<xsl:choose>
<xsl:when test="contains($work,'%')">
<xsl:variable name="pre" select="substring-before($work, '%')"/>
<xsl:variable name="char"
select="substring($string, string-length($pre)+1,1)"/>
<xsl:value-of select="$pre"/>
<xsl:choose>
<xsl:when test="$char='%'">
<xsl:text>%%</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>^&</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="escape">
<xsl:with-param name="string">
<xsl:value-of select="substring-after($string, $char)"/>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- =================================================================== -->
<!-- Generate the move script for the cached files -->
<!-- =================================================================== -->
<xsl:template match="movefiles">
<xsl:text>@echo off </xsl:text>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
1.29 +13 -7 jakarta-gump/gen.bat
Index: gen.bat
===================================================================
RCS file: /home/cvs/jakarta-gump/gen.bat,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- gen.bat 8 Feb 2003 20:16:17 -0000 1.28
+++ gen.bat 2 Apr 2003 20:22:35 -0000 1.29
@@ -5,6 +5,13 @@
@REM
@REM SET CLASSPATH=%JAXP%\crimson.jar;%JAXP%\jaxp.jar;%JAXP%\xalan.jar;%CLASSPATH%
+set OS_stylesheet=winxp
+ver | find "Windows 2000" >nul
+if errorlevel 1 goto xalan
+set OS_stylesheet=win2k
+
+
+:xalan
IF NOT "%XALAN%"=="" SET CLASSPATH=%XALAN%\bin\xml-apis.jar
IF NOT "%XALAN%"=="" SET CLASSPATH=%XALAN%\bin\xalan.jar;%CLASSPATH%
IF NOT "%XALAN%"=="" SET CLASSPATH=%XALAN%\bin\xerces.jar;%CLASSPATH%
@@ -12,7 +19,6 @@
SET SOURCE=%1
IF "%1"=="" SET SOURCE=%COMPUTERNAME%.xml
-
IF "%HOME%"=="" SET HOME=%USERPROFILE%
IF "%HOME%"=="" SET HOME=%HOMEDRIVE%%HOMEPATH%
IF "%HOME%"=="" SET HOME=C:\
@@ -45,7 +51,7 @@
if not errorlevel 0 goto fail
echo Generating update script
-java org.apache.xalan.xslt.Process -EDUMP -text -in work\updatesite.xml -xsl
stylesheet\win2k.xsl -out work\update.bat
+java org.apache.xalan.xslt.Process -EDUMP -text -in work\updatesite.xml -xsl
stylesheet\%os_stylesheet%.xsl -out work\update.bat
if not errorlevel 0 goto fail
@REM ********************************************************************
@@ -59,7 +65,7 @@
if not errorlevel 0 goto fail
echo Generating build script
-java org.apache.xalan.xslt.Process -EDUMP -text -in work\buildsite.xml -xsl
stylesheet\win2k.xsl -out work\build.bat
+java org.apache.xalan.xslt.Process -EDUMP -text -in work\buildsite.xml -xsl
stylesheet\%os_stylesheet%.xsl -out work\build.bat
if not errorlevel 0 goto fail
@REM ********************************************************************
@@ -73,13 +79,13 @@
if not errorlevel 0 goto fail
echo Generating xref script
-java org.apache.xalan.xslt.Process -EDUMP -text -in work\xrefsite.xml -xsl
stylesheet\win2k.xsl -out work\xref.bat
+java org.apache.xalan.xslt.Process -EDUMP -text -in work\xrefsite.xml -xsl
stylesheet\%os_stylesheet%.xsl -out work\xref.bat
if not errorlevel 0 goto fail
@REM ********************************************************************
echo Generate script to publish all xml source files
-java org.apache.xalan.xslt.Process -text -in work\merge.xml -xsl
stylesheet\win2k.xsl -out work\puball.bat
+java org.apache.xalan.xslt.Process -text -in work\merge.xml -xsl
stylesheet\%os_stylesheet%.xsl -out work\puball.bat
if not errorlevel 0 goto fail
echo Generate template for publishing an xml source file
@@ -91,7 +97,7 @@
if not errorlevel 0 goto fail
echo Generating publish script
-java org.apache.xalan.xslt.Process -EDUMP -text -in work\pubsite.xml -xsl
stylesheet\win2k.xsl -out work\publish.bat
+java org.apache.xalan.xslt.Process -EDUMP -text -in work\pubsite.xml -xsl
stylesheet\%os_stylesheet%.xsl -out work\publish.bat
if not errorlevel 0 goto fail
echo Generate editing instructions
@@ -107,7 +113,7 @@
if not errorlevel 0 goto fail
echo Generate move script for cached files
-java org.apache.xalan.xslt.Process -text -in work\move.xml -xsl
stylesheet\win2k.xsl -out work\move.bat
+java org.apache.xalan.xslt.Process -text -in work\move.xml -xsl
stylesheet\%os_stylesheet%.xsl -out work\move.bat
if not errorlevel 0 goto fail
@REM ********************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]