You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by je...@apache.org on 2002/11/03 11:49:34 UTC
cvs commit: xml-forrest/src/resources/forrestbot/xslt config2work.xsl
jefft 2002/11/03 02:49:33
Modified: src/resources/forrestbot stages.conf.xml
src/resources/forrestbot/ant templates.build.xml
src/resources/forrestbot/xslt config2work.xsl
Added: src/resources/forrestbot forrestbot.build.xml
forrestbot.properties
src/resources/forrestbot/bin forrestbot forrestbot.bat
src/resources/forrestbot/lib ant-contrib-0.1.jar
Log:
Update the Forrestbot to work in the shbat distribution, with
forrest.build.xml. templates.build.xml now delegates most work to
forrest.build.xml. Also remove some centipedisms (antipede-trycatch, xlayout)
Revision Changes Path
1.2 +1 -1 xml-forrest/src/resources/forrestbot/stages.conf.xml
Index: stages.conf.xml
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/forrestbot/stages.conf.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- stages.conf.xml 22 Jul 2002 17:15:09 -0000 1.1
+++ stages.conf.xml 3 Nov 2002 10:49:33 -0000 1.2
@@ -5,4 +5,4 @@
<workstage name="generate"/>
<workstage name="deploy"/>
<workstage name="cleanup"/>
-</stages>
\ No newline at end of file
+</stages>
1.1 xml-forrest/src/resources/forrestbot/forrestbot.build.xml
Index: forrestbot.build.xml
===================================================================
<?xml version="1.0"?>
<!-- Basedir is expected to be the bot's working directory -->
<project default="bot" basedir="." name="Forrestbot build file">
<description>
Generates Forrestbot Ant script for a specified forrestbot.conf.xml file.
</description>
<target name="init">
<property name="forrestbot.home" location="${forrest.home}/forrestbot"/>
<property name="bot.work.builder.xslt" location="${forrestbot.home}/xslt/config2work.xsl" />
<property name="bot.default.builder.xslt" location="${forrestbot.home}/xslt/config2defaults.xsl" />
<echo>Sourcing ${basedir}/forrestbot.properties</echo>
<echo>Sourcing ${forrestbot.home}/forrestbot.properties</echo>
<echo>bot.work.build.xml = ${bot.work.build.xml}</echo>
<property file="forrestbot.properties"/>
<property file="${forrestbot.home}/forrestbot.properties"/>
<echo message="Using config file: ${bot.config}" />
</target>
<target name="conf2build" depends="init" >
<!-- remove previous versions to force generation again -->
<delete file="${bot.work.build.xml}" />
<delete file="${bot.default.parameters.xml}" />
<mkdir dir="${bot.build.dir}" />
<!-- builds the different xml files this process needs. -->
<style in="${bot.config}"
out="${bot.work.build.xml}"
style="${bot.work.builder.xslt}"/>
<style in="${bot.config}"
out="${bot.default.parameters.xml}"
style="${bot.default.builder.xslt}"/>
<copy todir="${bot.build.dir}" file="${bot.templates.build.xml}"/>
</target>
<target name="run" depends="conf2build" >
<!-- delegates to the generated XML file -->
<ant antfile="${bot.work.build.xml}" target="work" inheritRefs="true"/>
</target>
<target name="bot" depends="run" />
</project>
1.1 xml-forrest/src/resources/forrestbot/forrestbot.properties
Index: forrestbot.properties
===================================================================
# Default forrestbot config properties
bot.config=forrestbot.conf.xml
# The bot's working directory.
bot.build.dir=build/bot
bot.work.build.xml=${bot.build.dir}/work.build.xml
bot.default.parameters.xml=${bot.build.dir}/default.parameters.xml
bot.templates.build.xml=${forrestbot.home}/ant/templates.build.xml
1.9 +74 -133 xml-forrest/src/resources/forrestbot/ant/templates.build.xml
Index: templates.build.xml
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/forrestbot/ant/templates.build.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- templates.build.xml 8 Aug 2002 15:48:31 -0000 1.8
+++ templates.build.xml 3 Nov 2002 10:49:33 -0000 1.9
@@ -25,7 +25,7 @@
template.get-src.local-copy <get-src type="local-copy" >
template.generate <generate>
template.deploy.local-copy <deploy type="local-copy" >
- template.delpoy.scp <deploy type="scp" >
+ template.deploy.scp <deploy type="scp" >
template.deploy.mail <deploy type="mail" >
each template target uses its own set of parameters (properties in fact)
@@ -76,8 +76,10 @@
<target name="shared.set-props" >
<!-- where we build the cocoon context per project: -->
- <property name="project.context.dir"
- value="${xlayout.build.bot.projects.dir}/${project.name}/context" />
+ <!--
+ <property name="project.ctxt-dir"
+ value="${xlayout.build.bot.projects.dir}/${project.name}/context" />
+ -->
<!-- where we will temporarily store and cache the various cvsmodules: -->
<property name="project.cvsmodule.dir"
value="${xlayout.build.bot.cvsmodules.dir}/${project.name}" />
@@ -86,11 +88,22 @@
<!-- where cocoon can have his toy-work-environment while generating: -->
<!-- mind: other stages can use this as a temp dir as well -->
- <property name="project.work.dir"
- value="${project.context.dir}/../work" />
+ <!--
+ <property name="project.work-dir"
+ value="${project.ctxt-dir}/../work" />
+ -->
<!-- where cocoon will spit out the generated stuff: -->
- <property name="project.docs.dir"
- value="${project.context.dir}/../docs" />
+ <!--
+ <property name="project.docs-dir" value="${project.ctxt-dir}/../docs" />
+ -->
+
+ <!-- These are OVERRIDES, hence 'project.*' -->
+ <property name="project.build-dir" location="${bot.build.dir}" />
+ <property name="project.temp-dir" location="${project.build-dir}/tmp" />
+ <property name="project.ctxt-dir" location="${project.build-dir}/${project.name}/context" />
+ <property name="project.work-dir" location="${project.build-dir}/${project.name}/work" />
+ <property name="project.site-dir" location="${project.build-dir}/${project.name}/site" />
+
</target>
@@ -102,95 +115,16 @@
</target>
<target name="template.prepare" depends="shared.set-props, echo.prepare">
- <!-- make it a clean space to work in -->
- <delete dir="${project.context.dir}"/>
- <delete dir="${project.docs.dir}"/>
- <mkdir dir="${project.context.dir}"/>
- <mkdir dir="${project.docs.dir}"/>
-
- <!-- copy over forrest config stuf and prepare the environment -->
- <!-- todo: get rid of the filter way of working ?
- InputModes were mentioned -->
- <filter token="skin" value="${prepare.skin}"/>
- <filter token="link1" value="apache"/>
- <filter token="link1.href" value="http://www.apache.org/"/>
- <filter token="link2" value="xml.apache"/>
- <filter token="link2.href" value="http://xml.apache.org/"/>
- <!-- the breadcrumb script already generates it,
- so it needs to be kept blank -->
- <filter token="link3" value=""/>
- <filter token="link3.href" value=""/>
- <filter token="group-logo.src" value="images/group-logo.gif"/>
- <filter token="group-logo.href" value="http://xml.apache.org/"/>
- <filter token="group-logo.alt" value="Apache XML logo"/>
- <filter token="project-logo.src" value="images/project-logo.gif"/>
- <filter token="project-logo.href" value="http://xml.apache.org/forrest/"/>
- <filter token="project-logo.alt" value="Forrest logo"/>
- <filter token="year" value="2002"/>
- <filter token="vendor" value="Apache Sofware Foundation"/>
-
- <!-- we're not dumping in the documentation source -->
- <!-- that will come from the get-src stage -->
-
- <!-- Copy entity catalog, entities and class files -->
- <copy todir="${project.context.dir}/resources/schema" filtering="off">
- <fileset dir="${resource.dir}/schema"/>
- </copy>
-
- <!-- decided to share this among all projects handled by bot
- Todo: remove what is now disabled if it proves to work
-
- <mkdir dir="${project.context.dir}/WEB-INF/classes"/>
- <copy todir="${project.context.dir}/WEB-INF/classes">
- <fileset dir="${project.context.dir}/resources/schema">
- <include name="CatalogManager.properties"/>
- </fileset>
- <fileset dir="${build.dest}">
- <include name="**/*.class"/>
- </fileset>
- <fileset dir="${build.scratchpad.dest}">
- <include name="**/*.class"/>
- </fileset>
- </copy>
- -->
-
- <!-- Copy Cocoon configuration and sitemap -->
- <copy todir="${project.context.dir}" filtering="on">
- <fileset dir="${forrest.context.dir}/conf">
- <include name="sitemap.xmap"/>
- <include name="cocoon.xconf"/>
- <include name="logkit.xconf"/>
- </fileset>
- </copy>
-
- <!-- todo: check where the cocoon Main really looks for the sitemap -->
- <copy todir="${project.context.dir}/WEB-INF/" filtering="on">
- <fileset dir="${forrest.context.dir}/conf">
- <exclude name="sitemap.xmap"/>
- </fileset>
- </copy>
-
- <!-- Copy libraries -->
- <copy todir="${project.context.dir}/library/" filtering="off">
- <fileset dir="${forrest.context.dir}/library">
-
- </fileset>
- </copy>
-
- <!-- Copy skins -->
- <copy todir="${project.context.dir}/skins/" filtering="on">
- <fileset dir="${forrest.context.dir}/skins">
- <exclude name="**/images/**"/>
- </fileset>
- </copy>
- <copy todir="${project.context.dir}/skins/" filtering="off">
- <fileset dir="${forrest.context.dir}/skins">
- <include name="**/images/**"/>
- </fileset>
- </copy>
-
- <!-- Copy the project descriptors can't be done here, since that is
- project specific: see get-src -->
+ <echo>
+ ############################
+ # Target: prepare
+ # Calling ${forrest.home}/forrest.build.xml#bare-context
+ # In dir ${basedir}
+ ############################
+ </echo>
+ <ant dir="${basedir}" antfile="${forrest.home}/forrest.build.xml" target="bare-context">
+ <property name="project.skin" value="${prepare.skin}"/>
+ </ant>
</target>
@@ -222,17 +156,30 @@
quiet="true"
command="checkout -l"
/>
- <!-- copy the xdocs content over to the context space -->
- <copy todir="${project.context.dir}">
+
+ <echo>
+ ############################
+ # Target: get-src.cvs
+ # Calling ${forrest.home}/forrest.build.xml#project-context-bot
+ # In dir="${project.cvsmodule.dir}/${get-src.cvs.module}/${get-src.cvs.dir}"
+ ############################
+ </echo>
+ <ant
+ dir="${project.cvsmodule.dir}/${get-src.cvs.module}/${get-src.cvs.dir}"
+ antfile="${forrest.home}/forrest.build.xml" target="project-context-bot">
+ <property name="forrest.echo" value="true"/>
+ </ant>
+
+ <!--
+ <copy todir="${project.ctxt-dir}">
<fileset dir="${project.cvsmodule.dir}/${get-src.cvs.module}/${get-src.cvs.dir}" />
</copy>
-
- <!-- copy the project descriptors over to the context space -->
- <copy todir="${project.context.dir}" >
+ <copy todir="${project.ctxt-dir}" >
<fileset dir="${project.cvsmodule.dir}/${get-src.cvs.module}">
<include name="*.*ml"/>
</fileset>
</copy>
+ -->
</target>
<!-- [[get-src type local-copy ]] -->
@@ -243,19 +190,18 @@
</target>
<target name="template.get-src.local-copy" depends="shared.set-props, echo.get-src.local-copy">
- <!-- copy the xdocs content over to the context space -->
- <copy todir="${project.context.dir}">
- <fileset dir="${get-src.local-copy.content-dir}" />
- </copy>
- <!-- copy the project descriptors over to the context space -->
- <copy todir="${project.context.dir}" >
- <fileset dir="${get-src.local-copy.project-dir}">
- <include name="*.*ml"/>
- </fileset>
- </copy>
+ <echo>
+ ############################
+ # Target: get-src.local-copy
+ # Calling ${forrest.home}/forrest.build.xml#project-context-bot
+ # In dir ${get-src.local-copy.project-dir}
+ ############################
+ </echo>
+ <ant dir="${get-src.local-copy.project-dir}"
+ antfile="${forrest.home}/forrest.build.xml" target="project-context-bot">
+ </ant>
</target>
-
<!-- ________________ GENERATE TEMPLATES __________________ -->
<target name="echo.generate" if="template.echo">
@@ -267,21 +213,16 @@
</target>
<target name="template.generate" depends="shared.set-props, echo.generate">
- <!-- clean out the temp space -->
- <delete dir="${project.work.dir}"/>
- <mkdir dir="${project.work.dir}"/>
-
- <java classname="org.apache.cocoon.Main" fork="true"
- dir="${project.context.dir}" failonerror="true"
- classpathref="forrest.cp"
- >
- <arg value="-c."/>
- <arg value="-d../docs"/>
- <arg value="-w../work"/>
- <arg value="-l../work/cocoon.log"/>
- <arg value="-u${generate.debuglevel}"/>
- <arg value="index.html"/>
- </java>
+ <echo>
+ ############################
+ # Target: generate
+ # Calling ${forrest.home}/forrest.build.xml#-site
+ # In dir ${get-src.local-copy.project-dir}
+ ############################
+ </echo>
+ <ant dir="${project.ctxt-dir}"
+ antfile="${forrest.home}/forrest.build.xml" target="-site">
+ </ant>
</target>
<!-- ________________ DEPLOY TEMPLATES __________________ -->
@@ -295,13 +236,13 @@
<target name="template.deploy.scp" depends="shared.set-props, echo.deploy.scp">
<!-- clean out the temp space -->
- <delete dir="${project.work.dir}"/>
- <mkdir dir="${project.work.dir}"/>
+ <delete dir="${project.work-dir}"/>
+ <mkdir dir="${project.work-dir}"/>
<property name="tempname" value="${project.name}-deploy" />
<property name="tempfile"
- value="${project.work.dir}/${tempname}" />
+ value="${project.work-dir}/${tempname}" />
<property name="remotedir" value="${deploy.scp.root}/${deploy.scp.dir}" />
- <tar tarfile="${tempfile}.tar" basedir="${project.docs.dir}"/>
+ <tar tarfile="${tempfile}.tar" basedir="${project.site-dir}"/>
<gzip zipfile="${tempfile}.tar.gz" src="${tempfile}.tar"/>
<delete file="${tempfile}.tar"/>
<exec dir="." executable="scp">
@@ -323,7 +264,7 @@
<target name="template.deploy.local-copy" depends="shared.set-props, echo.deploy.local-copy">
<copy todir="${deploy.local-copy.destination}">
- <fileset dir="${project.docs.dir}" />
+ <fileset dir="${project.site-dir}" />
</copy>
</target>
@@ -348,7 +289,7 @@
verbose="no"
ignoreNoncriticalErrors="true"
>
- <fileset dir="${project.docs.dir}" />
+ <fileset dir="${project.site-dir}" />
</ftp>
</target>
1.1 xml-forrest/src/resources/forrestbot/bin/forrestbot
Index: forrestbot
===================================================================
#!/bin/sh
# ----- Test if ant is around ------------------------------------------------
# and bail out if it does not with a message that it is required
if [ ! `which ant` ]; then
echo "You must install Ant (http://jakarta.apache.org/ant)"
echo "and add \$ANT_HOME/bin to your PATH variable"
exit 1
fi
# use the location of this script to infer $FORREST_HOME
FORREST_HOME=`dirname "$0"`/..
FORRESTBOT_HOME="$FORREST_HOME/forrestbot"
# set the ant file to use
ANTFILE="$FORRESTBOT_HOME/forrestbot.build.xml"
# Save old ANT_HOME
OLD_ANT_HOME="$ANT_HOME"
unset ANT_HOME
# ----- Set Up The Runtime Classpath ------------------------------------------
if [ "$TERM" = "cygwin" ] ; then
S=';'
else
S=':'
fi
CP="$CLASSPATH"
export CP
unset CLASSPATH
CLASSPATH=`echo $FORREST_HOME/lib/endorsed/*.jar $FORRESTBOT_HOME/lib/*.jar | tr ' ' $S`
export CLASSPATH
echo "Apache Forrest. Run 'forrest -projecthelp' to list options"
echo
"$FORREST_HOME/ant/bin/ant" -buildfile "$ANTFILE" -Dbasedir="$PWD" -Dforrest.home="$FORREST_HOME" -emacs $@
# ---- Restore Classpath
unset CLASSPATH
CLASSPATH=$CP
export CLASSPATH
# ---- Restore ANT_HOME
# Restore old ANT_HOME
ANT_HOME="$OLD_ANT_HOME"
export ANT_HOME
1.1 xml-forrest/src/resources/forrestbot/bin/forrestbot.bat
Index: forrestbot.bat
===================================================================
@echo off
setlocal
Rem ----- use the location of this script to infer $FORREST_HOME -------
set DEFAULT_FORREST_HOME=%~dp0\..
if "%FORREST_HOME%"=="" set FORREST_HOME=%DEFAULT_FORREST_HOME%
Rem ----- set the current working dir as the PROJECT_HOME variable ----
call "%FORREST_HOME%\bin\setpwdvar.bat"
set FORRESTBOT_HOME="%FORREST_HOME%\forrestbot"
Rem ----- set the ant file to use --------------------------------------
set ANTFILE="%FORRESTBOT_HOME%\forrestbot.build.xml"
Rem ----- Save old ANT_HOME --------------------------------------------
set OLD_ANT_HOME=%ANT_HOME%
set ANT_HOME="%FORREST_HOME%\ant"
set OLD_CLASSPATH=%CLASSPATH%
set CLASSPATH=
for %%i in ("%FORREST_HOME%\lib\endorsed\*.jar") do call appendcp.bat %%i
for %%i in ("%FORRESTBOT_HOME%\lib\*.jar") do call appendcp.bat %%i
echo "Apache Forrest. Run 'forrest -projecthelp' to list options"
Rem ----- call ant.. ---------------------------------------------------
call "%ANT_HOME%\bin\ant" -buildfile %ANTFILE% -Dbasedir="%PWD%" -Dforrest.home="%FORREST_HOME%" -emacs -logger org.apache.tools.ant.NoBannerLogger %1 %2 %3 %4 %5 %6 %7 %8 %9
Rem ---- Restore old ANT_HOME
set ANT_HOME=%OLD_ANT_HOME%
set CLASSPATH=%OLD_CLASSPATH%
endlocal
1.1 xml-forrest/src/resources/forrestbot/lib/ant-contrib-0.1.jar
<<Binary file>>
1.6 +12 -5 xml-forrest/src/resources/forrestbot/xslt/config2work.xsl
Index: config2work.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/forrestbot/xslt/config2work.xsl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- config2work.xsl 31 Jul 2002 09:17:01 -0000 1.5
+++ config2work.xsl 3 Nov 2002 10:49:33 -0000 1.6
@@ -24,6 +24,12 @@
<xsl:template name="listprojects">
+<taskdef name="trycatch" classname="net.sf.antcontrib.logic.TryCatchTask">
+ <classpath>
+ <pathelement location="${{forrest.home}}/forrestbot/lib/ant-contrib-0.1.jar"/>
+ </classpath>
+</taskdef>
+
<!--
per-project invocation of the chain of workstages:
@@ -32,7 +38,7 @@
<target name="work">
<parallel>
- <antipede-trycatch>
+ <trycatch>
<try>
<ant antfile="[this-file]" target="work.[project-name]" .../>
</try>
@@ -42,6 +48,7 @@
<finally>
<mail .../>
</finally>
+ </trycatch>
</parallel>
</target>
-->
@@ -50,10 +57,10 @@
<parallel>
<xsl:for-each select="project">
<!-- todo: wrap it in try catch to make it send in case of fail as well -->
- <antipede-trycatch>
+ <trycatch>
<try>
<ant antfile="${{bot.work.build.xml}}" inheritRefs="true"
- target="work.{@name}" output="${{bot.build.dir}}/work.{@name}.log"/>
+ target="{@name}" output="${{bot.build.dir}}/work.{@name}.log"/>
<property name="mail.completion-status" value="SUCCESS" />
</try>
<catch>
@@ -75,7 +82,7 @@
</ant>
</finally>
</xsl:if>
- </antipede-trycatch>
+ </trycatch>
</xsl:for-each>
</parallel>
</target>
@@ -95,7 +102,7 @@
<xsl:for-each select="project">
<xsl:variable name="project.name" select="@name"/>
- <target name="work.{@name}">
+ <target name="{@name}">
<xsl:attribute name="depends">
<xsl:for-each select="$workstages/stages/workstage">
<xsl:value-of select="concat(@name, '.', $project.name)"/>