jonas
Rev 2904 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<project default="publish" basedir=".">
<!-- customizable properties -->
<property file="build.properties" />
<!-- uncustomizable properties -->
<property name="common_web.archive" value="common_web.zip" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="xml.dir" value="${basedir}/xml" />
<property name="html.src" value="${basedir}/html" />
<property name="cgi.src" value="${basedir}/cgi-bin" />
<property name="common.dir" value="${basedir}/common" />
<property name="dtd.dir" value="${common.dir}/dtd" />
<property name="stylesheets.dir" value="${common.dir}/stylesheets" />
<property name="stylesheet.browsable" value="${stylesheets.dir}/browsable.xsl" />
<property name="stylesheet.printable" value="${stylesheets.dir}/printable.xsl" />
<property name="last-modified.pattern" value="yyyy-MM-dd hh:mm aa" />
<!-- classpath -->
<path id="externals.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ===================================================================== -->
<!-- publish -->
<!-- ===================================================================== -->
<target name="publish"
depends="prepare, check, html_print, html"
description="Build the Web site">
<touch file="${basedir}/.build"/>
</target>
<!-- ===================================================================== -->
<!-- prepare -->
<!-- ===================================================================== -->
<target name="prepare"
depends="unzip_common_web"
description="Prepare the Web site build">
<!-- rebuild HTML files only when needed -->
<uptodate property="rebuild.notNeeded" targetfile="${basedir}/.build">
<srcfiles dir="${dtd.dir}" includes="**/*.dtd"/>
<srcfiles dir="${stylesheets.dir}" includes="**/*.xsl"/>
<srcfiles dir="${xml.dir}" includes="**/*.xml"/>
</uptodate>
<!-- mkdirs -->
<mkdir dir="${html.dest}"/>
<mkdir dir="${cgi.dest}"/>
<!-- set the time build -->
<tstamp>
<format property="last.modified" pattern="${last-modified.pattern}"/>
</tstamp>
<!-- copy css stylesheet into ${html.dest} -->
<copy todir="${html.dest}">
<fileset dir="${stylesheets.dir}">
<include name="*.css"/>
</fileset>
</copy>
<!-- copy common images into ${html.dest}/images -->
<copy todir="${html.dest}/images">
<fileset dir="${common.dir}/images" />
</copy>
<!-- copy HTML files into ${html.dest} -->
<copy todir="${html.dest}">
<fileset dir="${html.src}" />
</copy>
<!-- copy js into ${html.dest} -->
<copy todir="${html.dest}/js">
<fileset dir="${common.dir}/js" />
</copy>
<!-- copy cgi-bin scripts into ${cgi.dest} -->
<copy todir="${cgi.dest}">
<fileset dir="${cgi.src}" />
</copy>
<chmod dir="${cgi.dest}" perm="ugo+x" includes="*.*"/>
</target>
<!-- ===================================================================== -->
<!-- check -->
<!-- ===================================================================== -->
<target name="check"
depends="unzip_common_web"
description="Check the XML files syntax"
unless="rebuild.notNeeded">
<xmlvalidate failonerror="yes"
lenient="no"
warn="yes"
classname="org.apache.xerces.parsers.SAXParser">
<classpath refid="externals.classpath"/>
<fileset dir="${xml.dir}">
<include name="**/*.xml"/>
</fileset>
</xmlvalidate>
</target>
<!-- ===================================================================== -->
<!-- zip_common_web -->
<!-- ===================================================================== -->
<target name="zip_common_web"
description="Zip the ${common.dir} directory into ${common_web.archive}">
<zip zipfile="${common_web.archive}">
<zipfileset dir="${common.dir}" />
</zip>
</target>
<!-- ===================================================================== -->
<!-- unzip_common_web -->
<!-- ===================================================================== -->
<target name="unzip_common_web"
description="Unzip the ${common_web.archive} file into ${common.dir}">
<unzip src="${common_web.archive}"
dest="${common.dir}"
overwrite="false"/>
</target>
<!-- ===================================================================== -->
<!-- html_print -->
<!-- ===================================================================== -->
<target name="html_print"
description="Build Web site (printable version)"
unless="rebuild.notNeeded">
<!-- root Web site -->
<antcall target="real_html">
<param name="srcdir" value="${xml.dir}/root" />
<param name="destdir" value="${html.dest}" />
<param name="project.file" value="project/project.xml" />
<param name="style" value="${stylesheet.printable}" />
<param name="extension" value="_print.html" />
</antcall>
</target>
<!-- ===================================================================== -->
<!-- html -->
<!-- ===================================================================== -->
<target name="html"
description="Build Web site (browsable version)"
unless="rebuild.notNeeded">
<!-- root Web site -->
<antcall target="real_html">
<param name="srcdir" value="${xml.dir}/root" />
<param name="destdir" value="${html.dest}" />
<param name="project.file" value="project/project.xml" />
<param name="style" value="${stylesheet.browsable}" />
<param name="extension" value=".html" />
</antcall>
</target>
<!-- ===================================================================== -->
<!-- real_html -->
<!-- ===================================================================== -->
<target name="real_html"
description="Do the real transformation xml -> html">
<style basedir="${srcdir}"
destdir="${destdir}"
style="${style}"
extension="${extension}"
processor="org.objectweb.util.ant.Xalan2Liaison"
force="true">
<include name="**/*.xml"/>
<exclude name="${project.file}"/>
<classpath refid="externals.classpath"/>
<param name="project-file" expression="${xml.dir}/${project.file}" />
<param name="last-modified" expression="${last.modified}" />
</style>
</target>
<!-- ===================================================================== -->
<!-- clean -->
<!-- ===================================================================== -->
<target name="clean"
description="Delete the generated files">
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${html.dest}"/>
<fileset dir="${cgi.dest}"/>
<fileset dir="${common.dir}"/>
</delete>
<delete file="${basedir}/.build"/>
</target>
</project>