You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by mp...@apache.org on 2002/08/21 17:55:43 UTC
cvs commit: xml-forrest/src/resources/forrest-shbat/bin forrest.bat forrest.sh
mpo 2002/08/21 08:55:43
Added: . build.build.xml forrest.build.xml
src/resources/forrest-shbat/bin forrest.bat forrest.sh
Log:
Initial checkin of Refactoring Build.
[wip] This just lays down some structure of solution.
So others can discuss and step in.
Warning- this is not running (has not even been parsed)
Revision Changes Path
1.1 xml-forrest/build.build.xml
Index: build.build.xml
===================================================================
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="./tools/antipede/resources/stylesheets/build.xsl"?>
<!--<!DOCTYPE project SYSTEM "./tools/antipede/build.dtd" >-->
<!DOCTYPE project [
<!-- antipede -->
<!ENTITY import-antipede SYSTEM "./tools/antipede/build.xtarget">
]>
<project default="interactive" basedir="." name="project build file">
<description>
* ===================================== *
| Krysalis Centipede Build System |
* ===================================== *
by
Nicola Ken Barozzi (nicolaken@apache.org)
Marc Johnson (mjohnson@apache.org)
For a simple interactive build, simply
run the build script (build.bat or build.sh)
</description>
<path id="classpath">
<fileset dir="./lib/endorsed">
<include name="*.jar"/>
</fileset>
<fileset dir="./lib/core">
<include name="*.jar"/>
</fileset>
<fileset dir="./lib/optional">
<include name="*.jar"/>
</fileset>
</path>
<!-- =================================================================== -->
<!-- Targets for this project -->
<!-- =================================================================== -->
<target name="init" depends="-init">
<property name="name" value="${xgump.module.project.name}"/>
<property name="packages" value="${xgump.module.project.packages}"/>
<property name="build.root" value="${xlayout.build.dir}"/>
<property name="build.dir" value="${xlayout.build.dir}"/>
<property name="resource.dir" value="${xlayout.source.resources.dir}"/>
<property name="context.dir" value="${xlayout.source.documentation.dir}"/>
<property name="build.docs" value="${xlayout.build.documentation.dir}"/>
<property name="build.javadocs" value="${xlayout.build.documentation.javadocs.dir}"/>
<property name="build.context" value="${xlayout.build.work.dir}"/>
<property name="build.dest" value="${xlayout.build.classes.dir}"/>
<property name="build.scratchpad.dest" value="${xlayout.build.scratchpad.classes.dir}"/>
<property name="tools.dir" value="./tools"/>
<property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
<available file="${tools.jar}" property="tools.jar.present"/>
</target>
<!-- =================================================================== -->
<!-- Interactive build -->
<!-- =================================================================== -->
<target name="interactive" description="Interactive Build" depends="-init">
<echo>
--------------------------------------------------------------
${xgump.module.project.name} ${xgump.module.project.version.major}.${xgump.module.project.version.minor} [${YEAR}]
--------------------------------------------------------------
Using ${ant.version}
Build file ${ant.file}
--------------------------------------------------------------
These are the most common build targets.
You can also invoke them directly; see build.xml for more info.
Builds will be in /build directory, distributions in /dist.
forrest-typical targets:
dist ------------- build all incarnation distributions:
dist-shbat ------- build the forrest.sh/bat incarnation (requires ant to *run*)
dist-cent ??? ??? future target making centipede-cent
dist-maven ??? ??? future target making maven plugin
dist-jar ??? ??? future target making jar that has both main as ant-task wrapper classes
forrest-test targets:
docs ------------- generates static Forrest website for itself as the project to run on.
webapp ----------- builds webapp (.war) deployable version of Forrest website
bot.run ---------- runs the forrestbot using the configuration specified in
forrestbot.conf.xml
default centipede targets:
compile ---------- compiles the source code
test ------------- performs the jUnit tests
jar -------------- create the jar files
docs ------------- generates the html docs - clean not needed
javadocs --------- generates the API documentation
site ------------- generates the html site (docs+reports)
clean ------------ cleans the build directory
dist ------------- creates src and bin distributions
scratchpad ------- build-run scratchpad code
contrib ---------- build-run contributed code
</echo>
<property name="input.selection" value="docs"/>
<centipede-user-input name="input.selection">Please select a target </centipede-user-input>
<antcall target="call-cent">
<param name="cent-name" value="centipede"/>
<param name="cent-target" value="splash"/>
</antcall>
<antcall target="${input.selection}"/>
</target>
<!-- ================================== -->
<!-- Compile -->
<!-- ================================== -->
<target name="compile" depends="-init"
description="Compile java source code">
<antcall target="call-cent">
<param name="cent-name" value="centipede"/>
<param name="cent-target" value="compile"/>
</antcall>
</target>
<!-- ================================== -->
<!-- jar -->
<!-- ================================== -->
<target name="jar" depends="-init"
description="Make jars">
<antcall target="call-cent">
<param name="cent-name" value="centipede"/>
<param name="cent-target" value="package"/>
</antcall>
</target>
<!-- ================================== -->
<!-- Scratchpad -->
<!-- ================================== -->
<target name="scratchpad" depends="-init"
description="Execute scratchpad targets">
<ant antfile="${xlayout.source.scratchpad.targets.dir}/scratchpad.xml"/>
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadocs"
description="* Generates the API documentation">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
destdir="${build.javadocs}"
author="true"
version="true"
use="false"
noindex="true"
windowtitle="${Name} API"
doctitle="${Name}"
bottom="Copyright © ${year} ${fullname} project. All Rights Reserved."
stylesheetfile="${resource.dir}/javadoc.css">
<classpath refid="classpath"/>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- Make all known distributions -->
<!-- =================================================================== -->
<target name="dist"
description="Makes all the known incarnations of forrest"
depends="dist-shbat" />
<!-- =================================================================== -->
<!-- Make the zip that holds what a fresh site should look like -->
<!-- =================================================================== -->
<target name="fresh-site-zip" depends="init">
<property name="fresh-site.zip" value="./build/fresh-site.zip" />
<echo>
TODO... COMPLETE THIS
... I need to build a zip that holds the typical content of a basic (empty forrest project)
(including the siteplan.xml, a hint fot build.xml, status.xml,...)
(see what acorn provides, I really think this should just be managed in some
./src/resources/fresh-site directory if you ask me )
</echo>
</target>
<!-- =================================================================== -->
<!-- Make the WEB-INF directory like cocoon (CLI or webapp) needs it -->
<!-- =================================================================== -->
<target name="webapp-webinf" depends="init, compile" >
<property name="webapp.webinf.dir" value="./build/webapp/WEB-INF" />
<echo>
TODO... COMPLETE THIS
... I need to build the WEB-INF directory for inclusion in the webapp and
in the many distributions that will use me.
Those distributions need me to extend their classpath when calling the
cocoon CLI.
</echo>
</target>
<!-- =================================================================== -->
<!-- Make the shell-bat distribution -->
<!-- =================================================================== -->
<target name="dist-shbat" depends="compile, fresh-site-zip, webapp-webinf" >
<!-- TODO: decide on a better place to read/set this prop from/to -->
<property name="dist-shbat.dir" value="./build/dist/shbat" />
<!-- fresh drop-off location for the distribution -->
<delete dir="${dist-shbat.dir}" />
<mkdir dir="${dist-shbat.dir}" />
<!-- copy the ant script at the heart of the distribution -->
<copy todir="${dist-shbat.dir}" file="forrest.build.xml" />
<!-- copy the fresh-site.zip to clone from -->
<copy todir="${dist-shbat.dir}" file="${fresh-site.zip}" />
<!-- copy the prepared and wrapper stuff for the distribution -->
<copy todir="${dist-shbat.dir}">
<fileset dir="./src/resources/forrest-shbat" />
</copy>
<!-- copy the web-inf as needed by the cocoon CLI -->
<mkdir dir="${dist-shbat.dir}/WEB-INF">
<copy todir="${dist-shbat.dir}/WEB-INF">
<fileset dir="${webapp.webinf.dir}" />
</copy>
<echo>
*-----------------------------------------------------------------
| installation notice
*-----------------------------------------------------------------
| You have succesfully build the shell-bat version of forrest.
| Please find it at: ${dist-shbat.dir}
| Please copy the contents to the install directory of your choice
| Please have the environment variable FORREST_HOME point to it.
| It is recommended to add
| unix: $FORREST_HOME/bin: to your $PATH
| win: %FORREST_HOME%\bin; to your %PATH%
| Calling
| unix: $FORREST_HOME/bin/forrest.sh usage
| win: %FORREST_HOME%\bin\forrest.bat usage
| will explain how to use this distribution.
| More help at http://xml.apache.org/forrest and forrest-dev@xml.apache.org
*-----------------------------------------------------------------
</echo>
</target>
<!-- =================================================================== -->
<!-- Validate xml -->
<!-- =================================================================== -->
<target name="validate-docs" description="Checks that the xml files are valid and conform to the DTD.">
<xmlvalidate failonerror="yes" lenient="yes" warn="yes"
className="org.apache.xerces.parsers.SAXParser">
<classpath>
<fileset dir="./lib/endorsed">
<include name="*.jar"/>
</fileset>
</classpath>
<fileset dir="."
includes="*.x*" excludes="build.xml"/>
</xmlvalidate>
</target>
<!-- =================================================================== -->
<!-- Generate project-site -->
<!-- =================================================================== -->
<target name="site" >
<echo>
NOT DONE YET - probably depends on some compilation stuff (rather then on our distributions?)
... this should set forrest.home and project.home and get the docs out.
via the forrest.build.xml instead.
should have some comment inside explaining THIS IS NOT the way to do it
for your own projects.
</echo>
</target>
<!-- =================================================================== -->
<!-- Generate cocoon-webapp for project-site -->
<!-- =================================================================== -->
<target name="webapp" >
<echo>
NOT DONE YET - probably depends on some compilation stuff
... this should set forrest.home and project.home and get the docs out.
via the forrest.build.xml instead.
</echo>
</target>
<!-- =================================================================== -->
<!-- ForrestBar for Mozilla -->
<!-- =================================================================== -->
<target name="forrestbar" depends="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir}/work/forrestbar" />
<jar jarfile="${build.dir}/work/forrestbar/forrestbar.jar">
<fileset dir="src/resources/forrestbar" includes="content/**/*" />
</jar>
<copy file="src/resources/forrestbar/install.js"
todir="${build.dir}/work/forrestbar" overwrite="true" />
<zip zipfile="${build.dir}/forrestbar.xpi"
basedir="${build.dir}/work/forrestbar" />
</target>
<!-- ================================== -->
<!-- Target used by Gump -->
<!-- ================================== -->
<target name="gump" description="Target used by Gump">
<antcall target="docs"/>
<antcall target="webapp"/>
</target>
<!-- =================================================================== -->
<!-- Import Ant-Centipede init targets - sets up basic build stuff -->
<!-- =================================================================== -->
<!--
This is the target that initializes tasks and properties used
commonly in every other target.
Remember to add depends="init" to every target, so that this
target is called before any other.
This target is internal; to make it unusable from the commandline,
its name starts with a hyphen.
To make it invisible when using -projecthelp, it lacks a description.
-->
&import-antipede;
</project>
1.1 xml-forrest/forrest.build.xml
Index: forrest.build.xml
===================================================================
<?xml version="1.0"?>
<!--
Ant template-targets holding the actions forrest can peform on your project.
Eventually all of this should be wrapped up into a Java Class and/or ant task
This should be called by some forrest.bat or forrest.sh having a project-dir
as its argument (. if none)
That should be passed to here with -Dproject.home
-->
<project default="site" basedir="." name="Forrest template targets">
<description>
*=======================================================*
| Forrest ant based site building target-temaplates |
*=======================================================*
by
Marc Portier (mpo@apache.org)
Call this through the ./bin/forrest.sh or *.bat
</description>
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- ** ** -->
<!-- ** ** -->
<!-- ** COMMON SETTINGS ** -->
<!-- ** ** -->
<!-- ** ** -->
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- ===============================================================
Loads user defined settings.
Steps back to defaults when they are not set.
Echo's the settings if requested.
=============================================================== -->
<target name="init">
<!-- setting defaults for parameters -->
<!-- people should use -D switch, or <ant><property>s to override these -->
<property name="forrest.home" value="." />
<property name="project.home" value="." />
<!-- people should use forrest.properties to override following defaults -->
<property file="${project.home}/forrest.properties" />
<property name="project.site-dir" value="${project.home}/build/site" />
<property name="project.siteplan" value="${project.home}/siteplan.xml" />
<property name="project.temp-dir" value="${project.home}/build/tmp" />
<property name="project.work-dir" value="${project.tmp-dir}/work" />
<property name="project.ctxt-dir" value="${project.tmp-dir}/context" />
<!-- checks for presence of required classes and/or resources -->
<property name="tools.jar" location="${java.home}/../lib/tools.jar"/>
<available file="${tools.jar}" property="tools.jar.present"/>
<!-- echo settings in -Dforrest.echo=true mode -->
<antcall target="echo-settings">
</target>
<!-- ===============================================================
Echo's the settings if requested. [-Dforrest.echo=true]
=============================================================== -->
<target name="echo-settings" depends="init" if="forrest.echo">
<echo>
------------------------------------------------
| Forrest template run.
| Running from $${forrest.home} = ${forrest.home}
| Working on $${project.home} = ${project.home}
------------------------------------------------
| project.site-dir = ${project.site-dir}
| project.siteplan = ${project.siteplan}
| project.temp-dir = ${project.temp-dir}
| project.work-dir = ${project.work-dir}
| project.ctxt-dir = ${project.ctxt-dir}
| tools.jar.present= ${tools.jar.present}
------------------------------------------------
</echo>
</target>
<!-- ===============================================================
Display the usage of this script.
=============================================================== -->
<target name="usage" depends="init">
<echo>
TODO... COMPLETE THIS:
should explain the usage.
part of it being: refering to the shell or bat use
part of it being: <ant antfile=...>
setting FORREST_HOME and the like.
description of the targets.
starting with fresh-project and looking at the siteplan that comes out of it.
</echo>
</target>
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- ** ** -->
<!-- ** ** -->
<!-- ** SITE BUILDING ACTIONS ** -->
<!-- ** ** -->
<!-- ** ** -->
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- ===============================================================
Makes the Cocoon context dir to work in.
Fills it with
forrest predefines.
site-content-parts
derivatives from siteplan
param: location of siteplan $project.siteplan
param: location to make context-dir?
(we could just make up a temp one, and clean when done)
=============================================================== -->
<target name="prepare-context" depends="init" >
<echo>
TODO... COMPLETE THIS:
... some style and copy tasks?
</echo>
</target>
<!-- ===============================================================
Makes the site
param: location of siteplan ${forrest.siteplan}
param: location to put generated site ${forrest.out.dir}
=============================================================== -->
<target name="site" depends="init, prepare-context, clean-site ">
<path id="forrest.cp">
<fileset dir="${forrest.home}/WEB-INF/lib" includes="**/*.jar" />
</path>
<echo>
TODO... COMPLETE THIS:
... should call cocoon CLI on set forrest.cococontxt.dir
</echo>
</target>
<!-- ===============================================================
Cleans the site. (typically before generating the new version)
param: location to clean ${forrest.out.dir}
=============================================================== -->
<target name="clean-site">
<echo>
TODO... COMPLETE THIS:
... should delete the site before building it
</echo>
<!--
<delete dir="${forrest.out.dir}"/>
-->
</target>
<!-- ===============================================================
Builds a cocoon webapp for your project based on the siteplan.
param: location of siteplan ${forrest.siteplan}
param: location to put generated war ${forrest.out.war}
=============================================================== -->
<target name="webapp" depends="init, prepare-context">
<echo>
TODO... COMPLETE THIS:
... this should just war up the prepared context dir.
</echo>
</target>
<!-- ===============================================================
Validates all XML documents in the projects-
param: location of siteplan ${forrest.siteplan}
param: location to put generated war ${forrest.out.war}
=============================================================== -->
<target name="validate-docs" depends="init, prepare-context">
<echo>
TODO... COMPLETE THIS:
... this should just war up the prepared context dir.
</echo>
</target>
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- ** ** -->
<!-- ** ** -->
<!-- ** PROJECT-TEMPLATE BUILDING ACTIONS ** -->
<!-- ** ** -->
<!-- ** ** -->
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- ===============================================================
Copies a template structure over to your project dir.
flag: with or without room for own skin
... flags for others... thers
Mind this is typically called before any forrest.properties
or siteplan.xml exists (we should consider generating those as well
maybe even a template ant build?
dependend task for doing that alone.
>>> filling this with stuff from smart acorn.xml idea.
=============================================================== -->
<target name="fresh-project"
depends="fresh-xdocs, fresh-skin, fresh-descriptors, fresh-build" />
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- ** ** -->
<!-- ** ** -->
<!-- ** BOT EXECUTING ACTIONS ** -->
<!-- ** ** -->
<!-- ** ** -->
<!-- ***************************************************************** -->
<!-- ***************************************************************** -->
<!-- currently just a cut and paste: none of this will work atm. -->
<!-- TODO... COMPLETE THIS: -->
<target name="bot.init" depends="init">
<!-- initializes environment to start on bot targets -->
<property name="bot.build.dir" value="${xlayout.build.bot.dir}"/>
<property name="bot.work.build.xml" value="${bot.build.dir}/work.build.xml"/>
<property name="bot.default.parameters.xml" value="${bot.build.dir}/default.parameters.xml"/>
<property name="bot.forrestbot.xconf" value="forrestbot.conf.xml" />
<property file="ant-mail.properties" />
<property name="bot.templates.build.xml" value="${xlayout.source.resources.forrestbot.ant.di
r}/templates.build.xml" />
<property name="bot.work.builder.xslt" value="${xlayout.source.resources.forrestbot.xslt.d
ir}/config2work.xsl" />
<property name="bot.default.builder.xslt" value="${xlayout.source.resources.forrestbot.xslt.d
ir}/config2defaults.xsl" />
<mkdir dir="${bot.build.dir}" />
<echo message="Using config file: ${bot.forrestbot.xconf}" />
</target>
<target name="bot.conf2build" depends="bot.init" >
<!-- remove previous versions to force generation again -->
<delete file="${bot.work.build.xml}" />
<delete file="${bot.default.parameters.xml}" />
<!-- builds the different xml files this process needs. -->
<style in="${bot.forrestbot.xconf}"
out="${bot.work.build.xml}"
style="${bot.work.builder.xslt}"/>
<style in="${bot.forrestbot.xconf}"
out="${bot.default.parameters.xml}"
style="${bot.default.builder.xslt}"/>
<copy todir="${bot.build.dir}" file="${bot.templates.build.xml}"/>
</target>
<target name="bot.prepare-cp" depends="bot.init, compile" >
<!-- todo: question if it is good practice to share WEB-INF classes -->
<mkdir dir="${bot.build.dir}/WEB-INF/classes"/>
<copy todir="${bot.build.dir}/WEB-INF/classes">
<fileset dir="${resource.dir}/schema">
<include name="CatalogManager.properties"/>
</fileset>
<fileset dir="${build.dest}">
<include name="**/*.class"/>
</fileset>
<fileset dir="${build.scratchpad.dest}">
<include name="**/*.class"/>
</fileset>
</copy>
<path id="forrest.cp">
<path refid="classpath"/>
<fileset dir="${build.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${tools.dir}">
<include name="*/lib/*.jar"/>
</fileset>
<pathelement location="${tools.jar}"/>
<pathelement location="${bot.build.dir}/WEB-INF/classes"/>
</path>
</target>
<!-- delegates to the generated XML file -->
<ant antfile="${bot.work.build.xml}" target="work" inheritRefs="true"/>
</target>
<target name="bot" depends="bot.run" />
</project>
1.1 xml-forrest/src/resources/forrest-shbat/bin/forrest.bat
Index: forrest.bat
===================================================================
@echo off
setlocal
Rem ----- Test if ant is around ----------------------------------------
if %ANT_HOME%a==a goto noant
Rem ----- set the current working dir as the PROJECT_HOME variable ----
set PROJECT_HOME=.
Rem ----- set the ant file to use --------------------------------------
set ANTFILE=%FORREST_HOME%\forrest.build.xml
Rem ----- call ant.. ---------------------------------------------------
call %ANT_HOME%\bin\ant -buildfile %ANTFILE% -Dproject.home=%PROJECT_HOME% -emacs -logger org.apache.tools.ant.NoBannerLogger %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end
:noant
echo You must install Ant (http://jakarta.apache.org/ant)
echo and set ANT_HOME to point at your Ant Installation directory
goto end
:end
endlocal
1.1 xml-forrest/src/resources/forrest-shbat/bin/forrest.sh
Index: forrest.sh
===================================================================
#!/bin/sh
# ----- Test if ant is around ------------------------------------------------
# and bail out if it does not with a message that it is required
if [ "$ANT_HOME" = "" ] ; then
echo You must install Ant (http://jakarta.apache.org/ant)
echo and set ANT_HOME to point at your Ant Installation directory
exit 1
fi
# set the current working dir as the PROJECT_HOME variable
PROJECT_HOME=$PWD
# set the ant file to use
ANTFILE=$FORREST_HOME\forrest.build.xml
# call ant.
$ANT_HOME/bin/ant -buildfile $ANTFILE -Dproject.home=$PROJECT_HOME -emacs -logger org.apache.tools.ant.NoBannerLogger $@