helma/build/build.xml
hns 21c00908c1 Updated build scripts.
CVS checkout is now separated from builds. It's possible to
use the script both for building both the jar file and the whole
distribution either from checked-out code or the local copy.
2001-10-22 16:43:40 +00:00

262 lines
11 KiB
XML

<?xml version="1.0"?>
<!-- ======================================================================= -->
<!-- Hop build file -->
<!-- ======================================================================= -->
<project name="Hop" default="main" basedir=".">
<!-- =================================================================== -->
<!-- Initializes some variables -->
<!-- =================================================================== -->
<target name="init">
<property name="Name" value="helma"/>
<property name="year" value="1998-2001"/>
<property name="version" value="1.2"/>
<property name="project" value="helma"/>
<property name="build.compiler" value="classic"/>
<property name="build.dir" value=".."/>
<property name="build.src" value="${build.dir}/src"/>
<property name="build.dest" value="${build.dir}/classes"/>
<property name="build.work" value="${build.dir}/work"/>
<property name="build.checkout" value="${build.work}/checkout"/>
<property name="cvs.root" value=":pserver:anonymous@coletta.helma.at:/opt/cvs"/>
<property name="javadoc.destdir" value="../docs/apidocs"/>
<property name="jar.name" value="helma"/>
<property name="final.name" value="${project}-${version}"/>
<property name="final.dir" value="../${final.name}/"/>
<property name="debug" value="off"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="off"/>
<tstamp/>
<filter token="year" value="${year}"/>
<filter token="version" value="${version}"/>
<filter token="date" value="${TODAY}"/>
<!-- JDK1.1 collections support -->
<property name="coll.import" value="com.sun.java.util.collections"/>
<available classname="${coll.import}.Collection" property="coll.present"/>
</target>
<!-- =================================================================== -->
<!-- Copies the source code to the build directory and does filtering -->
<!-- =================================================================== -->
<target name="checkout" depends="init">
<!-- cvspass cvsroot="${cvs.root}" password=""/ -->
<mkdir dir="${build.src}"/>
<mkdir dir="${build.checkout}"/>
<cvs cvsRoot="${cvs.root}" package="hop" dest="${build.checkout}"/>
<copy todir="${build.src}">
<fileset dir="${build.checkout}/hop"
includes="helma/**/*.java,FESI/**/*.java,Acme/**/*.java"/>
</copy>
<cvs cvsRoot="${cvs.root}" package="hopbuild/lib" dest="${build.checkout}"/>
<copy todir="${build.dir}/lib">
<fileset dir="${build.checkout}/hopbuild/lib"/>
</copy>
<cvs cvsRoot="${cvs.root}" package="hopbuild/skeleton" dest="${build.checkout}"/>
<cvs cvsRoot="${cvs.root}" package="apps/hopblog" dest="${build.checkout}"/>
</target>
<!-- =================================================================== -->
<!-- Does replacement on files for dealing with collections. -->
<!-- XXX The efficiency could be improved here; all replacements should -->
<!-- XXX happen during one read/write phase and only for files that have -->
<!-- XXX changed. -->
<!-- =================================================================== -->
<target name="collections" if="coll.present" depends="init">
<replace dir="${build.src}/helma" includes="**"
token="java.util.Collection" value="${coll.import}.Collection"/>
<replace dir="${build.src}/helma" includes="**"
token="java.util.Map" value="${coll.import}.Map"/>
<replace dir="${build.src}/helma" includes="**"
token="java.util.HashMap" value="${coll.import}.HashMap"/>
<replace dir="${build.src}/helma" includes="**"
token="java.util.List" value="${coll.import}.List"/>
<replace dir="${build.src}/helma" includes="**"
token="java.util.LinkedList" value="${coll.import}.LinkedList"/>
<replace dir="${build.src}/helma" includes="**"
token="java.util.ArrayList" value="${coll.import}.ArrayList"/>
<replace dir="${build.src}/helma" includes="**"
token="java.util.Set" value="${coll.import}.Set"/>
<replace dir="${build.src}/helma" includes="**"
token="java.util.HashSet" value="${coll.import}.HashSet"/>
<replace dir="${build.src}/helma" includes="**"
token="java.util.Iterator" value="${coll.import}.Iterator"/>
<!-- The following replace handles the "import java.util.*" case by -->
<!-- adding an "import com.sun.java.util.collections.*" after it. -->
<!-- BTW, \u000a is the Unicode escape for a new line. (jhunter) -->
<replace dir="${build.src}/helma/framework/core" includes="**"
token="java.util.*"
value="java.util.*;\u000aimport ${coll.import}.*"/>
<replace dir="${build.src}/helma/objectmodel" includes="**"
token="java.util.*"
value="java.util.*;\u000aimport ${coll.import}.*"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<mkdir dir="${build.dest}"/>
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}">
<classpath>
<fileset dir="${build.dir}/lib">
<exclude name="**/helma*.jar" />
<include name="**/*.jar" />
</fileset>
<pathelement path="${classpath}" />
</classpath>
</javac>
<rmic classname="helma.framework.core.Application" base="${build.dest}"/>
<rmic classname="helma.image.Server" base="${build.dest}"/>
<rmic classname="helma.image.RemoteImage" base="${build.dest}"/>
</target>
<!-- =================================================================== -->
<!-- Creates a .jar file -->
<!-- =================================================================== -->
<target name="jar" depends="compile">
<jar jarfile="${build.dir}/${jar.name}-${DSTAMP}.jar"
basedir="${build.dest}"
excludes="**/package.html"/>
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadocs" depends="init">
<mkdir dir="${javadoc.destdir}"/>
<javadoc packagenames="helma.*"
sourcepath="${build.src}"
destdir="${javadoc.destdir}"
author="false"
private="false"
version="false"
windowtitle="${Name} ${version} API"
doctitle="${Name} ${version} API"
bottom="Copyright &#169; 1998-2001 Helma.org. All Rights Reserved."
/>
</target>
<!-- =================================================================== -->
<!-- Package -->
<!-- =================================================================== -->
<target name="package" depends="checkout, jar, javadocs">
<mkdir dir="${final.dir}"/>
<!-- mkdir dir="${final.dir}/static"/ -->
<mkdir dir="${final.dir}/src"/>
<jar jarfile="${final.dir}/src/${Name}-src.jar"
basedir="${build.src}"/>
<!-- copy todir="${final.dir}/src">
<fileset dir="${build.dir}/src"/>
</copy -->
<copy todir="${final.dir}/docs">
<fileset dir="../docs"/>
</copy>
<copy todir="${final.dir}/lib">
<fileset dir="${build.checkout}/hopbuild/lib"/>
</copy>
<copy todir="${final.dir}">
<fileset dir="${build.checkout}/hopbuild/skeleton" excludes="**/CVS"/>
</copy>
<copy todir="${final.dir}/apps">
<fileset dir="${build.checkout}/apps" excludes="**/CVS"/>
</copy>
<copy file="${build.dir}/${jar.name}-${DSTAMP}.jar" tofile="${final.dir}/lib/helma.jar"/>
<chmod file="${final.dir}/hop.sh" perm="755"/>
</target>
<!-- =================================================================== -->
<!-- Packages the distribution with ZIP -->
<!-- =================================================================== -->
<target name="package-zip" depends="package">
<zip zipfile="../${Name}-${version}.zip" basedir="../" includes="**/${final.name}/**"/>
</target>
<!-- =================================================================== -->
<!-- Packages the distribution with TAR-GZIP -->
<!-- =================================================================== -->
<target name="package-tgz" depends="package">
<tar tarfile="../${Name}-${version}.tar" basedir=".." excludes="**">
<tarfileset dir=".." mode="755">
<include name="${final.name}/hop.sh"/>
</tarfileset>
<tarfileset dir="..">
<include name="${final.name}/**"/>
<exclude name="${final.name}/hop.sh"/>
</tarfileset>
</tar>
<gzip zipfile="../${Name}-${version}.tar.gz" src="../${Name}-${version}.tar"/>
</target>
<!-- =================================================================== -->
<!-- Packages the distribution with ZIP and TAG-GZIP -->
<!-- =================================================================== -->
<target name="package-all" depends="package-zip, package-tgz">
</target>
<!-- =================================================================== -->
<!-- Packages and FTPs the distribution with ZIP and TAG-GZIP -->
<!-- =================================================================== -->
<target name="ftp-all" depends="package-all">
<ftp server="piefke.helma.at"
userid="anonymous"
password="tobi@helma.at">
<fileset dir="${build.dir}">
<include name="${Name}-${version}.zip,${Name}-${version}.tar.gz"/>
</fileset>
</ftp>
</target>
<!-- =================================================================== -->
<!-- This is just a test -->
<!-- =================================================================== -->
<target name="ftp-test" depends="">
<ftp server="piefke.helma.at"
userid="anonymous"
password="tobi@helma.at">
<fileset dir="${build.dir}">
<include name="${Name}-${version}.zip,${Name}-${version}.tar.gz"/>
</fileset>
</ftp>
</target>
</project>