blob: 21d404fa93610cd80c29e677b88c15b9ad28e491 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Copyright 2002-2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project default="jar" basedir="." name="Forrest build file">
<import file="src/forrestbar/build.xml"/>
<description>
Build system for Apache Xml Forrest.
Run the build script: build.bat or build.sh
</description>
<target name="init">
<tstamp>
<format property="YEAR" pattern="yyyy" locale="en"/>
</tstamp>
<xmlproperty file="module.xml" prefix="xgump" keeproot="true" collapseAttributes="true" />
<xmlproperty file="status.xml" prefix="xstatus" keeproot="false" collapseAttributes="true" />
<xmlproperty file="properties.xml" keeproot="false" collapseAttributes="true" />
<property name="name" value="apache-forrest"/>
<property name="packages" value="${xgump.module.project.packages}"/>
<property name="version"
value="${xgump.module.project.version.major}.${xgump.module.project.version.minor}${xgump.module.project.version.tag}"/>
<property name="java.dir" location="src/java"/>
<property name="build.dir" location="build"/>
<property name="build.docs" location="${build.dir}/docs"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="dist.dir" location="${build.dir}/dist" />
<property name="dist-shbat.dir" location="${dist.dir}/shbat" />
<property name="tools.dir" location="tools"/>
<property name="tools.jar" location="${java.home}/../lib/tools.jar"/>
<available file="${tools.jar}" property="tools.jar.present"/>
<property name="src-fresh-site" location="src/core/fresh-site"/>
<property name="forrestbot.dir" location="scratchpad/forrestbot2"/>
<buildnumber file="etc/build.number"/>
<echo>
--------------------------------------------------------------
Using ${ant.version}
Build file ${ant.file}
Use 'build.[sh|bat] -projecthelp' to see other options.
Build system home ${ant.home}
Build number ${build.number}
Project Name ${ant.project.name}
Java Version ${ant.java.version}
Timestamp ${DSTAMP}${TSTAMP}
This is: ${name} ${version}
--------------------------------------------------------------
</echo>
<mkdir dir="${build.dir}"/>
<path id="classpath">
<fileset dir="lib" includes="**/*.jar"/>
<fileset dir="${tools.dir}/jetty" includes="servlet*.jar"/>
<pathelement location="${tools.jar}"/>
</path>
</target>
<target name="clean" depends="init" description="Delete all generated files">
<delete dir="${build.dir}"/>
<delete dir="${forrestbot.dir}/logs"/>
<delete dir="${forrestbot.dir}/work"/>
<delete dir="${forrestbot.dir}/build"/>
<delete dir="${forrestbot.dir}/webapp/target"/>
<delete dir="${forrestbot.dir}/webapp/maven.log"/>
<delete dir="src/core/context/WEB-INF/logs"/>
</target>
<target name="dist-clean" depends="init, clean" description="Delete all non-forrest files">
<delete dir="${forrestbot.dir}/*.settings"/>
<delete file="**/*.bak"/>
<delete file="**/*~"/>
</target>
<!-- =================================================================== -->
<!-- Make release distributions -->
<!-- =================================================================== -->
<target name="release-dist" depends="init, dist-clean, dist-shbat"
description="Makes release distributions">
<property name="release-name-bin" value="${name}-${version}"/>
<zip
file="${dist.dir}/${release-name-bin}.zip" >
<zipfileset dir="${dist-shbat.dir}" prefix="${release-name-bin}"/>
<zipfileset dir="etc" prefix="${release-name-bin}/etc"/>
<zipfileset dir="etc" prefix="${release-name-bin}" includes="RELEASE-NOTES-${version}.txt"/>
</zip>
<tar longfile="gnu" compression="gzip"
destfile="${dist.dir}/${release-name-bin}.tar.gz" >
<tarfileset prefix="${release-name-bin}" dir="${dist-shbat.dir}"
username="forrest" group="forrest">
<exclude name="**/*.sh"/>
<exclude name="**/ant"/>
<exclude name="**/forrest"/>
</tarfileset>
<tarfileset prefix="${release-name-bin}" dir="${dist-shbat.dir}"
mode="755" username="forrest" group="forrest">
<include name="**/*.sh"/>
<include name="**/ant"/>
<include name="**/forrest"/>
</tarfileset>
<tarfileset prefix="${release-name-bin}/etc" dir="etc"/>
<tarfileset prefix="${release-name-bin}" dir="etc" includes="RELEASE-NOTES-${version}.txt"/>
</tar>
</target>
<!-- =================================================================== -->
<!-- Make all known distributions -->
<!-- =================================================================== -->
<target name="dist"
description="Makes all the known incarnations of forrest"
depends="clean,dist-shbat" />
<!-- =================================================================== -->
<!-- Validate the important core configuration files -->
<!-- =================================================================== -->
<target name="validate-config" depends="init"
description="Validate the important core configuration files">
<!-- FIXME allow switch if="validate.config" -->
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask">
<classpath>
<fileset dir="./lib/core" includes="*.jar" />
</classpath>
</taskdef>
<!-- skinconf.xml -->
<echo message="validating **/skinconf.xml ..."/>
<xmlvalidate failonerror="true" lenient="no" warn="yes">
<attribute name="http://apache.org/xml/features/validation/dynamic" value="true"/>
<xmlcatalog >
<dtd publicId="-//APACHE//DTD Skin Configuration V0.6//EN"
location="src/core/context/resources/schema/dtd/skinconfig-v06.dtd"/>
</xmlcatalog>
<fileset dir="./src/core"
includes="**/skinconf.xml" />
</xmlvalidate>
<!-- All stylesheets **/*.xsl -->
<echo message="validating stylesheets **/*.xsl ..."/>
<jing rngfile="./src/core/context/resources/schema/relaxng/xslt.rng">
<fileset dir="./src/core" includes="**/*.xsl"/>
<fileset dir="${tools.dir}" includes="**/*.xsl"/>
</jing>
<!-- sitemap.xmap -->
<echo message="validating **/sitemap.xmap ..."/>
<jing rngfile="./src/core/context/resources/schema/relaxng/sitemap-v06.rng">
<fileset dir="./src/core/context/" includes="*.xmap"/>
</jing>
<!-- book.xml -->
<!-- FIXME: Need Norm Walsh catalog entity resolver or Jeff's DoctypeChanger.
<echo message="validating **/book.xml ..."/>
<jing rngfile="./src/resources/schema/relaxng/book-v01.rng">
<fileset dir="./src" includes="**/book.xml"/>
</jing>
-->
</target>
<target name="dist-shbat"
depends="init, jar, validate-config" >
<!-- fresh drop-off location for the distribution -->
<delete dir="${dist-shbat.dir}" />
<mkdir dir="${dist-shbat.dir}" />
<!-- copy all Forrest -->
<copy todir="${dist-shbat.dir}">
<fileset dir="." >
<exclude name="build/**"/>
</fileset>
</copy>
<copy todir="${dist-shbat.dir}">
<fileset dir="." >
<include name="build/xml-forrest.jar"/>
</fileset>
</copy>
<!-- Fix bin/ permissions -->
<fixcrlf eol="crlf" srcdir="${dist-shbat.dir}/src/core/bin" includes="*.bat"/>
<fixcrlf eol="lf" srcdir="${dist-shbat.dir}/src/core/bin" excludes="*.bat"/>
<chmod dir="${dist-shbat.dir}/src/core/bin" perm="ugo+rx" excludes="*.bat"/>
<!-- Fix ant/bin/ permissions -->
<fixcrlf eol="crlf" srcdir="${dist-shbat.dir}/tools/ant/bin" includes="*.bat"/>
<fixcrlf eol="lf" srcdir="${dist-shbat.dir}/tools/ant/bin" excludes="*.bat"/>
<chmod dir="${dist-shbat.dir}/tools/ant/bin" perm="ugo+rx" excludes="*.bat"/>
<echo>
*-----------------------------------------------------------------
| installation notice
*-----------------------------------------------------------------
| You have succesfully built the shell-bat distribution 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
| ${dist-shbat.dir}/src/core
| 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 -projecthelp
| win: %FORREST_HOME%\bin\forrest -projecthelp
| will list options for the 'forrest' command
| More help at http://xml.apache.org/forrest/ and forrest-dev@xml.apache.org
*-----------------------------------------------------------------
</echo>
</target>
<!-- =================================================================== -->
<!-- Generate project-site -->
<!-- =================================================================== -->
<target name="docs" depends="site"/>
<target name="site" depends="dist-shbat"
description="Generates static HTML documentation">
<property name="forrest.home" value="${dist-shbat.dir}" />
<ant antfile="${forrest.home}/forrest.antproxy.xml" target="site"/>
</target>
<!-- ================================== -->
<!-- Test targets -->
<!-- ================================== -->
<target name="test"
depends="testseed"
description="Test that the features are ok before committing."/>
<target name="testseed" depends="init" description="Test that the features are ok before committing.">
<property name="forrest.home" value="${dist-shbat.dir}" />
<property name="test.dir" value="${build.dir}/test"/>
<delete dir="${test.dir}"/>
<mkdir dir="${test.dir}"/>
<ant antfile="${forrest.home}/forrest.build.xml" target="seed">
<property name="forrest.home" value="${dist-shbat.dir}" />
<property name="project.home" value="${test.dir}"/>
</ant>
<ant antfile="${test.dir}/forrest-targets.xml" target="site"/>
<!--
<ant antfile="${forrest.home}/forrest.build.xml" target="site">
<property name="forrest.home" value="${dist-shbat.dir}" />
<property name="project.home" value="${test.dir}"/>
</ant>-->
</target>
<!-- ================================== -->
<!-- Target used by Gump -->
<!-- ================================== -->
<target name="gump" description="Target used by Gump">
<!--<antcall target="test"/>-->
<antcall target="site"/>
<antcall target="webapp"/>
</target>
<!-- =================================================================== -->
<!-- Compile Cocoon java classes -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<mkdir dir="${build.classes}"/>
<!-- this is put so that CVS ignores the contents even if the build dir is renamed -->
<copy file="src/core/var/full.cvsignore" tofile="${build.dir}/.cvsignore"/>
<javac srcdir= "${java.dir}"
destdir= "${build.classes}"
debug= "${build.compiler.debug}"
optimize= "${build.compiler.optimize}"
deprecation= "${build.compiler.deprecation}"
nowarn= "${build.compiler.nowarn}"
classpathref= "classpath">
</javac>
</target>
<!-- =================================================================== -->
<!-- Jar Cocoon classes -->
<!-- =================================================================== -->
<target name="jar" depends="init, compile">
<jar destfile="${build.dir}/xml-forrest.jar"
basedir="${build.classes}"/>
</target>
<!-- =================================================================== -->
<!-- Generate DTDs with entities expanded -->
<!-- =================================================================== -->
<target name='expand-dtd' depends="init" description="Generates '-full' DTDs,
with all entity refs expanded, for use with catalog-ignorant editors like
IDEA">
<taskdef name="dtd2xml" classpathref="classpath" classname="org.cyberneko.dtd.anttasks.DTD2XML"/>
<property name="dtdx.dir" location="build/tmp/dtdx"/>
<mkdir dir="${dtdx.dir}"/>
<!-- Generate an intermediate XML representation of each DTD -->
<dtd2xml classpathref="classpath" outputDir="${dtdx.dir}" preserveDirs="yes" extension=".dtdx">
<fileset dir="./src/core/context/resources/schema/dtd">
<include name="changes-v12.dtd"/>
<include name="document-v11.dtd"/>
<include name="document-v12.dtd"/>
<include name="faq-v12.dtd"/>
<include name="howto-v12.dtd"/>
<include name="todo-v12.dtd"/>
<include name="v20a/document-v20.dtd"/>
<include name="v20a/faq-v20.dtd"/>
</fileset>
</dtd2xml>
<!-- Now transform the intermediate format back to the regular DTD format -->
<!-- Note that we could also transform to XSD or RNG -->
<xslt basedir="${dtdx.dir}"
destdir="${dist-shbat.dir}/context/resources/schema/dtd"
extension="-full.dtd"
style="tools/dtdconverters/dtdx2dtd.xsl">
<include name="*.dtdx"/>
<include name="v20a/*.dtdx"/>
</xslt>
</target>
<!-- =================================================================== -->
<!-- Use Apache Ant to generate a patch file -->
<!-- =================================================================== -->
<target name="patch">
<ant antfile="tools/targets/patch.xml" target="patchpackage"/>
</target>
</project>