You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by ni...@apache.org on 2002/07/07 11:53:02 UTC
cvs commit: xml-forrest/tools/ant/bin runant.pl
nicolaken 2002/07/07 02:53:02
Added: tools/antipede/resources/stylesheets xml.xsl status.xsl
tools/antipede tasks.properties
tools/antipede/bin runant.py runant.pl
Removed: tools/centipede/src/java XmlPropertyTask.java
UserInputTask.java
tools/centipede/targets util.xtarget test.xtarget
tools/ant/bin runant.pl
Log:
Updated build system to Centipede 1beta2.
Just as a reminder: next Centipede version will remove the need to have Ant
in the project CVS altogether.
Revision Changes Path
1.1 xml-forrest/tools/antipede/resources/stylesheets/xml.xsl
Index: xml.xsl
===================================================================
<!--
|
| XSLT REC Compliant Version of IE5 Default Stylesheet
|
| Original version by Jonathan Marsh (jmarsh@microsoft.com)
| http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl
|
| Conversion to XSLT 1.0 REC Syntax by Steve Muench (smuench@oracle.com)
|
+-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="no" method="html"/>
<xsl:template match="/">
<HTML>
<HEAD>
<SCRIPT>
<xsl:comment><![CDATA[
function f(e){
if (e.className=="ci") {
if (e.children(0).innerText.indexOf("\n")>0) fix(e,"cb");
}
if (e.className=="di") {
if (e.children(0).innerText.indexOf("\n")>0) fix(e,"db");
} e.id="";
}
function fix(e,cl){
e.className=cl;
e.style.display="block";
j=e.parentElement.children(0);
j.className="c";
k=j.children(0);
k.style.visibility="visible";
k.href="#";
}
function ch(e) {
mark=e.children(0).children(0);
if (mark.innerText=="+") {
mark.innerText="-";
for (var i=1;i<e.children.length;i++) {
e.children(i).style.display="block";
}
}
else if (mark.innerText=="-") {
mark.innerText="+";
for (var i=1;i<e.children.length;i++) {
e.children(i).style.display="none";
}
}
}
function ch2(e) {
mark=e.children(0).children(0);
contents=e.children(1);
if (mark.innerText=="+") {
mark.innerText="-";
if (contents.className=="db"||contents.className=="cb") {
contents.style.display="block";
}
else {
contents.style.display="inline";
}
}
else if (mark.innerText=="-") {
mark.innerText="+";
contents.style.display="none";
}
}
function cl() {
e=window.event.srcElement;
if (e.className!="c") {
e=e.parentElement;
if (e.className!="c") {
return;
}
}
e=e.parentElement;
if (e.className=="e") {
ch(e);
}
if (e.className=="k") {
ch2(e);
}
}
function ex(){}
function h(){window.status=" ";}
document.onclick=cl;
]]>
</xsl:comment>
</SCRIPT>
<STYLE>
BODY {font:x-small 'Verdana'; margin-right:1.5em}
.c {cursor:hand}
.b {color:red; font-family:'Courier New'; font-weight:bold;
text-decoration:none}
.e {margin-left:1em; text-indent:-1em; margin-right:1em}
.k {margin-left:1em; text-indent:-1em; margin-right:1em}
.t {color:#990000}
.xt {color:#990099}
.ns {color:red}
.dt {color:green}
.m {color:blue}
.tx {font-weight:bold}
.db {text-indent:0px; margin-left:1em; margin-top:0px;
margin-bottom:0px;padding-left:.3em;
border-left:1px solid #CCCCCC; font:small Courier}
.di {font:small Courier}
.d {color:blue}
.pi {color:blue}
.cb {text-indent:0px; margin-left:1em; margin-top:0px;
margin-bottom:0px;padding-left:.3em; font:small Courier;
color:#888888}
.ci {font:small Courier; color:#888888}
PRE {margin:0px; display:inline}
</STYLE>
</HEAD>
<BODY class="st">
<xsl:apply-templates/>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="processing-instruction()">
<DIV class="e">
<SPAN class="b">
<xsl:call-template name="nbsp-ref"/>
</SPAN>
<SPAN class="m">
<xsl:text><?</xsl:text>
</SPAN>
<SPAN class="pi">
<xsl:value-of select="name(.)"/>
<xsl:value-of select="."/>
</SPAN>
<SPAN class="m">
<xsl:text>?></xsl:text>
</SPAN>
</DIV>
</xsl:template>
<xsl:template match="processing-instruction('xml')">
<DIV class="e">
<SPAN class="b">
<xsl:call-template name="nbsp-ref"/>
</SPAN>
<SPAN class="m">
<xsl:text><?</xsl:text>
</SPAN>
<SPAN class="pi">
<xsl:text>xml </xsl:text>
<xsl:for-each select="@*">
<xsl:value-of select="name(.)"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>" </xsl:text>
</xsl:for-each>
</SPAN>
<SPAN class="m">
<xsl:text>?></xsl:text>
</SPAN>
</DIV>
</xsl:template>
<xsl:template match="@*">
<SPAN>
<xsl:attribute name="class">
<xsl:if test="xsl:*/@*">
<xsl:text>x</xsl:text>
</xsl:if>
<xsl:text>t</xsl:text>
</xsl:attribute>
<xsl:value-of select="name(.)"/>
</SPAN>
<SPAN class="m">="</SPAN>
<B>
<xsl:value-of select="."/>
</B>
<SPAN class="m">"</SPAN>
</xsl:template>
<xsl:template match="text()">
<DIV class="e">
<SPAN class="b"> </SPAN>
<SPAN class="tx">
<xsl:value-of select="."/>
</SPAN>
</DIV>
</xsl:template>
<xsl:template match="comment()">
<DIV class="k">
<SPAN>
<A STYLE="visibility:hidden" class="b" onclick="return false" onfocus="h()">-</A>
<SPAN class="m">
<xsl:text><!--</xsl:text>
</SPAN>
</SPAN>
<SPAN class="ci" id="clean">
<PRE>
<xsl:value-of select="."/>
</PRE>
</SPAN>
<SPAN class="b">
<xsl:call-template name="nbsp-ref"/>
</SPAN>
<SPAN class="m">
<xsl:text>--></xsl:text>
</SPAN>
<SCRIPT>f(clean);</SCRIPT>
</DIV>
</xsl:template>
<xsl:template match="*">
<DIV class="e">
<DIV STYLE="margin-left:1em;text-indent:-2em">
<SPAN class="b">
<xsl:call-template name="nbsp-ref"/>
</SPAN>
<SPAN class="m"><</SPAN>
<SPAN>
<xsl:attribute name="class">
<xsl:if test="xsl:*">
<xsl:text>x</xsl:text>
</xsl:if>
<xsl:text>t</xsl:text>
</xsl:attribute>
<xsl:value-of select="name(.)"/>
<xsl:if test="@*">
<xsl:text> </xsl:text>
</xsl:if>
</SPAN>
<xsl:apply-templates select="@*"/>
<SPAN class="m">
<xsl:text>/></xsl:text>
</SPAN>
</DIV>
</DIV>
</xsl:template>
<xsl:template match="*[node()]">
<DIV class="e">
<DIV class="c">
<A class="b" href="#" onclick="return false" onfocus="h()">-</A>
<SPAN class="m"><</SPAN>
<SPAN>
<xsl:attribute name="class">
<xsl:if test="xsl:*">
<xsl:text>x</xsl:text>
</xsl:if>
<xsl:text>t</xsl:text>
</xsl:attribute>
<xsl:value-of select="name(.)"/>
<xsl:if test="@*">
<xsl:text> </xsl:text>
</xsl:if>
</SPAN>
<xsl:apply-templates select="@*"/>
<SPAN class="m">
<xsl:text>></xsl:text>
</SPAN>
</DIV>
<DIV>
<xsl:apply-templates/>
<DIV>
<SPAN class="b">
<xsl:call-template name="nbsp-ref"/>
</SPAN>
<SPAN class="m">
<xsl:text></</xsl:text>
</SPAN>
<SPAN>
<xsl:attribute name="class">
<xsl:if test="xsl:*">
<xsl:text>x</xsl:text>
</xsl:if>
<xsl:text>t</xsl:text>
</xsl:attribute>
<xsl:value-of select="name(.)"/>
</SPAN>
<SPAN class="m">
<xsl:text>></xsl:text>
</SPAN>
</DIV>
</DIV>
</DIV>
</xsl:template>
<xsl:template match="*[text() and not (comment() or processing-instruction())]">
<DIV class="e">
<DIV STYLE="margin-left:1em;text-indent:-2em">
<SPAN class="b">
<xsl:call-template name="nbsp-ref"/>
</SPAN>
<SPAN class="m">
<xsl:text><</xsl:text>
</SPAN>
<SPAN>
<xsl:attribute name="class">
<xsl:if test="xsl:*">
<xsl:text>x</xsl:text>
</xsl:if>
<xsl:text>t</xsl:text>
</xsl:attribute>
<xsl:value-of select="name(.)"/>
<xsl:if test="@*">
<xsl:text> </xsl:text>
</xsl:if>
</SPAN>
<xsl:apply-templates select="@*"/>
<SPAN class="m">
<xsl:text>></xsl:text>
</SPAN>
<SPAN class="tx">
<xsl:value-of select="."/>
</SPAN>
<SPAN class="m"></</SPAN>
<SPAN>
<xsl:attribute name="class">
<xsl:if test="xsl:*">
<xsl:text>x</xsl:text>
</xsl:if>
<xsl:text>t</xsl:text>
</xsl:attribute>
<xsl:value-of select="name(.)"/>
</SPAN>
<SPAN class="m">
<xsl:text>></xsl:text>
</SPAN>
</DIV>
</DIV>
</xsl:template>
<xsl:template match="*[*]" priority="20">
<DIV class="e">
<DIV STYLE="margin-left:1em;text-indent:-2em" class="c">
<A class="b" href="#" onclick="return false" onfocus="h()">-</A>
<SPAN class="m"><</SPAN>
<SPAN>
<xsl:attribute name="class">
<xsl:if test="xsl:*">
<xsl:text>x</xsl:text>
</xsl:if>
<xsl:text>t</xsl:text>
</xsl:attribute>
<xsl:value-of select="name(.)"/>
<xsl:if test="@*">
<xsl:text> </xsl:text>
</xsl:if>
</SPAN>
<xsl:apply-templates select="@*"/>
<SPAN class="m">
<xsl:text>></xsl:text>
</SPAN>
</DIV>
<DIV>
<xsl:apply-templates/>
<DIV>
<SPAN class="b">
<xsl:call-template name="nbsp-ref"/>
</SPAN>
<SPAN class="m">
<xsl:text></</xsl:text>
</SPAN>
<SPAN>
<xsl:attribute name="class">
<xsl:if test="xsl:*">
<xsl:text>x</xsl:text>
</xsl:if>
<xsl:text>t</xsl:text>
</xsl:attribute>
<xsl:value-of select="name(.)"/>
</SPAN>
<SPAN class="m">
<xsl:text>></xsl:text>
</SPAN>
</DIV>
</DIV>
</DIV>
</xsl:template>
<xsl:template name="nbsp-ref">
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
1.1 xml-forrest/tools/antipede/resources/stylesheets/status.xsl
Index: status.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method = "html" encoding="Windows-1252" />
<xsl:template match="status">
<h1>Project Status</h1>
<h2>Developers</h2>
<table>
<xsl:for-each select = "developers/person">
<tr><td><xsl:value-of select="@name" /></td>
<td><xsl:value-of select="@email" /></td>
<td>[<xsl:value-of select="@id" />]</td></tr>
</xsl:for-each>
</table>
<h2>To do</h2>
<xsl:for-each select = "todo/actions">
<h3><xsl:value-of select = "@priority"/> priority</h3>
<table>
<tr><th>context</th><th>what</th><th>assigned to</th></tr>
<xsl:for-each select = "action">
<tr><td><xsl:value-of select="@context" /></td>
<td><xsl:value-of select="." /></td>
<td>[<xsl:value-of select="@assigned-to" />]</td></tr>
</xsl:for-each>
</table>
</xsl:for-each>
<h2>Changes</h2>
<xsl:for-each select = "changes/release">
<h3>release <xsl:value-of select = "@version"/> 
of date <xsl:value-of select = "@date"/></h3>
<table>
<tr><th>type</th><th>what</th><th>developer</th></tr>
<xsl:for-each select = "action">
<tr><td><xsl:value-of select="@type" /></td>
<td><xsl:value-of select="." /></td>
<td>[<xsl:value-of select="@dev" />]</td></tr>
</xsl:for-each>
</table>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
1.1 xml-forrest/tools/antipede/tasks.properties
Index: tasks.properties
===================================================================
#Antipede tasks
antipede-foreach=net.sf.antcontrib.logic.ForEach
antipede-if=net.sf.antcontrib.logic.IfTask
antipede-propertycopy=net.sf.antcontrib.property.PropertyCopy
antipede-switch=net.sf.antcontrib.logic.Switch
antipede-trycatch=net.sf.antcontrib.logic.TryCatchTask
antipede-jjar=org.apache.commons.jjar.JJARTask
centipede-user-input=org.krysalis.centipede.ant.task.UserInputTask
centipede-xml-property=org.krysalis.centipede.ant.task.XmlPropertyTask
centipede-class-available=org.krysalis.centipede.ant.task.ClassAvailableTask
xmlproperty=org.apache.tools.ant.taskdefs.XmlProperty
1.1 xml-forrest/tools/antipede/bin/runant.py
Index: runant.py
===================================================================
#!/usr/bin/python
"""
runant.py
This script is a translation of the runant.pl written by Steve Loughran.
It runs ant with/out arguments, it should be quite portable (thanks to
the python os library)
This script has been tested with Python2.0/Win2K
Copyright (c) 2001 The Apache Software Foundation. All rights
reserved.
created: 2001-04-11
author: Pierre Dittgen pierre.dittgen@criltelecom.com
Assumptions:
- the "java" executable/script is on the command path
- ANT_HOME has been set
"""
import os, os.path, string, sys
# Change it to 1 to get extra debug information
debug = 0
#######################################################################
#
# check to make sure environment is setup
#
if not os.environ.has_key('ANT_HOME'):
print '\n\nANT_HOME *MUST* be set!\n\n'
sys.exit(1)
else:
ANT_HOME = os.environ['ANT_HOME']
if not os.environ.has_key('JAVACMD'):
JAVACMD = 'java'
else:
JAVACMD = os.environ['JAVACMD']
# Sets the separator char for CLASSPATH
SEPARATOR = ':'
if os.name == 'dos' or os.name == 'nt':
SEPARATOR = ';'
# Build up standard classpath
localpath = ''
if os.environ.has_key('CLASSPATH'):
localpath = os.environ['CLASSPATH']
else:
if debug:
print 'Warning: no initial classpath\n'
# Add jar files
LIBDIR = os.path.join(ANT_HOME, 'lib')
jarfiles = []
for file in os.listdir(LIBDIR):
if file[-4:] == '.jar':
jarfiles.append(os.path.join(LIBDIR,file))
if debug:
print 'Jar files:'
for jar in jarfiles:
print jar
localpath = localpath + SEPARATOR + string.join(jarfiles, SEPARATOR)
# If JAVA_HOME is defined, look for tools.jar & classes.zip
# and add to classpath
if os.environ.has_key('JAVA_HOME') and os.environ['JAVA_HOME'] != '':
JAVA_HOME = os.environ['JAVA_HOME']
TOOLS = os.path.join(JAVA_HOME, os.path.join('lib', 'tools.jar'))
if os.path.exists(TOOLS):
localpath = localpath + SEPARATOR + TOOLS
CLASSES = os.path.join(JAVA_HOME, os.path.join('lib', 'classes.zip'))
if os.path.exists(CLASSES):
localpath = localpath + SEPARATOR + CLASSES
else:
print '\n\nWarning: JAVA_HOME environment variable is not set.\n', \
'If the build fails because sun.* classes could not be found\n', \
'you will need to set the JAVA_HOME environment variable\n', \
'to the installation directory of java\n'
# Jikes
ANT_OPTS = []
if os.environ.has_key('ANT_OPTS'):
ANT_OPTS = string.split(os.environ['ANT_OPTS'])
if os.environ.has_key('JIKESPATH'):
ANT_OPTS.append('-Djikes.class.path=' + os.environ['JIKESPATH'])
# Builds the commandline
cmdline = '%s -classpath %s -Dant.home=%s %s org.apache.tools.ant.Main %s' \
% (JAVACMD, localpath, ANT_HOME, string.join(ANT_OPTS,' '), \
string.join(sys.argv[1:], ' '))
if debug:
print '\n%s\n\n' % (cmdline)
# Run the biniou!
os.system(cmdline)
1.1 xml-forrest/tools/antipede/bin/runant.pl
Index: runant.pl
===================================================================
#!/usr/bin/perl
#
# Copyright (c) 2001 The Apache Software Foundation. All rights
# reserved.
#
#######################################################################
#
# runant.pl
#
# wrapper script for invoking ant in a platform with Perl installed
# this may include cgi-bin invocation, which is considered somewhat daft.
# (slo: that should be a separate file which can be derived from this
# and returns the XML formatted output)
#
# the code is not totally portable due to classpath and directory splitting
# issues. oops. (NB, use File::Spec::Functions will help and the code is
# structured for the catfile() call, but because of perl version funnies
# the code is not included.
#
# created: 2000-8-24
# last modified: 2000-8-24
# author: Steve Loughran steve_l@sourceforge.net
#######################################################################
#
# Assumptions:
#
# - the "java" executable/script is on the command path
# - ANT_HOME has been set
# - target platform uses ":" as classpath separator or perl indicates it is dos/win32
# - target platform uses "/" as directory separator.
#be fussy about variables
use strict;
#platform specifics (disabled)
#use File::Spec::Functions;
#turn warnings on during dev; generates a few spurious uninitialised var access warnings
#use warnings;
#and set $debug to 1 to turn on trace info
my $debug=0;
#######################################################################
#
# check to make sure environment is setup
#
my $HOME = $ENV{ANT_HOME};
if ($HOME eq "")
{
die "\n\nANT_HOME *MUST* be set!\n\n";
}
my $JAVACMD = $ENV{JAVACMD};
$JAVACMD = "java" if $JAVACMD eq "";
#ISSUE: what java wants to split up classpath varies from platform to platform
#and perl is not too hot at hinting which box it is on.
#here I assume ":" 'cept on win32 and dos. Add extra tests here as needed.
my $s=":";
if(($^O eq "MSWin32") || ($^O eq "dos") || ($^O eq "cygwin"))
{
$s=";";
}
#build up standard classpath
my $localpath=$ENV{CLASSPATH};
if ($localpath eq "")
{
print "warning: no initial classpath\n" if ($debug);
$localpath="";
}
#add jar files. I am sure there is a perl one liner to do this.
my $jarpattern="$HOME/lib/*.jar";
my @jarfiles =glob($jarpattern);
print "jarfiles=@jarfiles\n" if ($debug);
my $jar;
foreach $jar (@jarfiles )
{
$localpath.="$s$jar";
}
#if Java home is defined, look for tools.jar & classes.zip and add to classpath
my $JAVA_HOME = $ENV{JAVA_HOME};
if ($JAVA_HOME ne "")
{
my $tools="$JAVA_HOME/lib/tools.jar";
if (-e "$tools")
{
$localpath .= "$s$tools";
}
my $classes="$JAVA_HOME/lib/classes.zip";
if (-e $classes)
{
$localpath .= "$s$classes";
}
}
else
{
print "\n\nWarning: JAVA_HOME environment variable is not set.\n".
"If the build fails because sun.* classes could not be found\n".
"you will need to set the JAVA_HOME environment variable\n".
"to the installation directory of java\n";
}
#set JVM options and Ant arguments, if any
my @ANT_OPTS=split(" ", $ENV{ANT_OPTS});
my @ANT_ARGS=split(" ", $ENV{ANT_ARGS});
#jikes
if($ENV{JIKESPATH} ne "")
{
push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}";
}
#construct arguments to java
my @ARGS;
push @ARGS, "-classpath", "$localpath", "-Dant.home=$HOME";
push @ARGS, @ANT_OPTS;
push @ARGS, "org.apache.tools.ant.Main", @ANT_ARGS;
push @ARGS, @ARGV;
print "\n $JAVACMD @ARGS\n\n" if ($debug);
my $returnValue = system $JAVACMD, @ARGS;
if ($returnValue eq 0)
{
exit 0;
}
else
{
# only 0 and 1 are widely recognized as exit values
# so change the exit value to 1
exit 1;
}