blob: 5b63a52e18d139d3c24326358ac14a0faa89301d [file] [log] [blame]
<project name="click" default="help" basedir="..">
<!--
Project Properties
-->
<property file="./build/build.properties"/>
<xmlproperty file="./build/javascript-syntax-highlighter.xml"/>
<property name="jar.cayenne" value="cayenne-nodeps-2.0.4.jar"/>
<property name="jar.checkstyle" value="checkstyle-all-4.1.jar"/>
<property name="jar.codec" value="commons-codec-1.3.jar"/>
<property name="jar.collections" value="commons-collections-3.1.jar"/>
<property name="jar.freemarker" value="freemarker-2.3.12.jar"/>
<property name="jar.hibernate" value="hibernate-3.2.6.ga.jar"/>
<property name="jar.io" value="commons-io-1.4.jar"/>
<property name="jar.junit" value="junit-3.8.1.jar"/>
<property name="jar.lang" value="commons-lang-2.4.jar"/>
<property name="jar.log4j" value="log4j-1.2.14.jar"/>
<property name="jar.ognl" value="ognl-2.6.9.jar"/>
<property name="jar.servlet" value="servlet-api-2.3.jar"/>
<property name="jar.spring-beans" value="spring-beans-2.5.4.jar"/>
<property name="jar.spring-context" value="spring-context-2.5.4.jar"/>
<property name="jar.spring-core" value="spring-core-2.5.4.jar"/>
<property name="jar.spring-web" value="spring-web-2.5.4.jar"/>
<property name="jar.upload" value="commons-fileupload-1.2.1.jar"/>
<property name="jar.velocity" value="velocity-1.5.jar"/>
<property name="javac.source" value="1.4"/>
<property name="repository" value="http://repo1.maven.org"/>
<property name="maven-bundle" value="../maven-upload"/>
<!--
Task Definitions
-->
<taskdef name="linetrim"
classname="dev.LineTrimTask"
classpath="lib/dev.jar"/>
<taskdef name="replacetabs"
classname="dev.ReplaceTabsTask"
classpath="lib/dev.jar"/>
<taskdef name="package"
classname="dev.PackageTask"
classpath="lib/dev.jar"/>
<taskdef resource="checkstyletask.properties"
classpath="lib/${jar.checkstyle}"/>
<!--
Macro Definitions
-->
<macrodef name="downloadMacro">
<attribute name="name"/>
<attribute name="path"/>
<sequential>
<get src="${repository}/maven/@{path}/jars/@{name}"
dest="lib/@{name}"
verbose="true"
usetimestamp="true"/>
</sequential>
</macrodef>
<macrodef name="buildBundleMacro">
<attribute name="name"/>
<sequential>
<mkdir dir="${maven-bundle}/@{name}"/>
<copy file="build/@{name}.pom" tofile="${maven-bundle}/@{name}/pom.xml"/>
<replace file="${maven-bundle}/@{name}/pom.xml"
token="VERSION"
value="${version}"/>
<!--
Replace the TEMPLATE token with the value of the template pom
-->
<loadfile property="pom-template" srcFile="build/template.pom"/>
<replace file="${maven-bundle}/@{name}/pom.xml"
value="${pom-template}">
<replacetoken>&lt;!--TEMPLATE--&gt;</replacetoken>
</replace>
<copy file="dist/@{name}-${version}.jar" todir="${maven-bundle}/@{name}/"/>
</sequential>
</macrodef>
<macrodef name="digestMacro">
<attribute name="file"/>
<sequential>
<checksum file="@{file}" forceOverwrite="true" />
<checksum file="@{file}" forceOverwrite="true" algorithm="SHA1" />
</sequential>
</macrodef>
<!--
Path Definitions
-->
<path id="classpath.framework">
<pathelement location="framework/classes"/>
<pathelement location="lib/${jar.codec}"/>
<pathelement location="lib/${jar.collections}"/>
<pathelement location="lib/${jar.io}"/>
<pathelement location="lib/${jar.lang}"/>
<pathelement location="lib/${jar.ognl}"/>
<pathelement location="lib/${jar.servlet}"/>
<pathelement location="lib/${jar.upload}"/>
<pathelement location="lib/${jar.velocity}"/>
</path>
<path id="classpath.extras">
<pathelement location="extras/classes"/>
<pathelement location="lib/${jar.cayenne}"/>
<pathelement location="lib/${jar.hibernate}"/>
<pathelement location="lib/${jar.log4j}"/>
<pathelement location="lib/${jar.servlet}"/>
<pathelement location="lib/${jar.spring-beans}"/>
<pathelement location="lib/${jar.spring-context}"/>
<pathelement location="lib/${jar.spring-core}"/>
<pathelement location="lib/${jar.spring-web}"/>
<pathelement location="lib/${jar.freemarker}"/>
<pathelement location="dist/click-${version}.jar"/>
</path>
<path id="classpath.mock">
<pathelement location="mock/classes"/>
<pathelement location="lib/${jar.codec}"/>
<pathelement location="lib/${jar.collections}"/>
<pathelement location="lib/${jar.io}"/>
<pathelement location="lib/${jar.lang}"/>
<pathelement location="lib/${jar.ognl}"/>
<pathelement location="lib/${jar.servlet}"/>
<pathelement location="lib/${jar.upload}"/>
<pathelement location="lib/${jar.velocity}"/>
<pathelement location="dist/click-${version}.jar"/>
</path>
<path id="classpath.extras.cayenne.1x">
<pathelement location="temp/classes"/>
<pathelement location="lib/${jar.hibernate}"/>
<pathelement location="lib/${jar.log4j}"/>
<pathelement location="lib/${jar.servlet}"/>
<pathelement location="lib/${jar.spring-beans}"/>
<pathelement location="lib/${jar.spring-context}"/>
<pathelement location="lib/${jar.spring-core}"/>
<pathelement location="lib/${jar.spring-web}"/>
<pathelement location="dist/click-${version}.jar"/>
</path>
<path id="classpath.examples">
<pathelement location="lib/${jar.servlet}"/>
<pathelement location="lib/${jar.spring-beans}"/>
<pathelement location="lib/${jar.spring-context}"/>
<pathelement location="lib/${jar.spring-core}"/>
<pathelement location="lib/${jar.spring-web}"/>
<pathelement location="dist/click-${version}.jar"/>
<pathelement location="dist/click-extras-${version}.jar"/>
</path>
<path id="classpath.test">
<pathelement location="lib/${jar.junit}"/>
</path>
<!--
Target Definitions
-->
<target name="build-all"
depends="build-framework, build-mock, build-extras, build-examples"
description="build Click framework, extras, mock, examples"/>
<target name="build-distribution"
depends="clean, build-framework, build-mock, build-extras, build-examples, javadoc"
description="build distribution ZIP file">
<!-- create distribution zip file -->
<delete dir="click-${version}" quiet="false"/>
<mkdir dir="click-${version}"/>
<copy todir="click-${version}">
<fileset dir="." casesensitive="yes">
<exclude name=".**"/>
<exclude name=".**/**"/>
<exclude name="click-${version}"/>
<exclude name="TODO.txt"/>
<exclude name="bin/**"/>
<exclude name="design/**"/>
<exclude name="dist/*-src.zip"/>
<exclude name="lib/${jar.cayenne}"/>
<exclude name="lib/${jar.codec}"/>
<exclude name="lib/${jar.collections}"/>
<exclude name="lib/${jar.hibernate}"/>
<exclude name="lib/${jar.freemarker}"/>
<exclude name="lib/${jar.io}"/>
<exclude name="lib/${jar.lang}"/>
<exclude name="lib/${jar.log4j}"/>
<exclude name="lib/${jar.junit}"/>
<exclude name="lib/${jar.ognl}"/>
<exclude name="lib/${jar.servlet}"/>
<exclude name="lib/${jar.velocity}"/>
<exclude name="lib/spring-*.jar"/>
<exclude name="lib/${jar.upload}"/>
<exclude name="**/Thumbs.db"/>
<exclude name="**/classes/**"/>
<exclude name="**/WEB-INF/lib/**"/>
<exclude name="examples/webapp/javadoc/**"/>
</fileset>
</copy>
<delete file="../click-${version}.zip"/>
<zip basedir="."
destfile="../click-${version}.zip"
includes="click-${version}/**"/>
<delete dir="click-${version}" quiet="false"/>
</target>
<target name="build-examples" description="build click-examples WAR file">
<ant antfile="build.xml"
dir="examples"
target="build"
inheritall="false"/>
</target>
<target name="build-mock" description="build mock JAR file">
<available file="dist/click-${version}.jar" property="isClickAvail"/>
<fail message="Build framework first with 'build-framework'">
<condition>
<or><isfalse value="${isClickAvail}"/></or>
</condition>
</fail>
<delete file="dist/click-mock-${version}.jar" quiet="false"/>
<delete dir="mock/classes" quiet="false"/>
<mkdir dir="mock/classes"/>
<copy todir="mock/classes">
<fileset dir="mock/src">
<exclude name="**/package.html"/>
</fileset>
</copy>
<javac srcdir="mock/src"
destdir="mock/classes"
debug="true"
excludes="**/Test*"
encoding="ISO-8859-1"
source="${javac.source}">
<classpath refid="classpath.mock"/>
</javac>
<jar destfile="dist/click-mock-${version}.jar">
<manifest>
<attribute name="Click-Version" value="${version}"/>
<attribute name="Package" value="net.sf.click"/>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<fileset dir="mock/classes"/>
</jar>
<digestMacro file="dist/click-mock-${version}.jar"/>
</target>
<target name="build-extras" description="build extras JAR file">
<available file="dist/click-${version}.jar" property="isClickAvail"/>
<fail message="Build framework first with 'build-framework'">
<condition>
<or><isfalse value="${isClickAvail}"/></or>
</condition>
</fail>
<delete file="dist/click-extras-${version}.jar" quiet="false"/>
<delete dir="extras/classes" quiet="false"/>
<mkdir dir="extras/classes"/>
<copy todir="extras/classes">
<fileset dir="extras/src">
<exclude name="**/package.html"/>
</fileset>
</copy>
<javac srcdir="extras/src"
destdir="extras/classes"
debug="true"
excludes="**/Test*"
encoding="ISO-8859-1"
source="${javac.source}">
<classpath refid="classpath.extras"/>
</javac>
<jar destfile="dist/click-extras-${version}.jar">
<manifest>
<attribute name="Click-Version" value="${version}"/>
<attribute name="Package" value="net.sf.click.extras"/>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<fileset dir="extras/classes"/>
</jar>
<digestMacro file="dist/click-extras-${version}.jar"/>
<delete dir="temp" quiet="false"/>
</target>
<target name="build-framework" description="build framework JAR file">
<mkdir dir="dist"/>
<available file="lib/${jar.codec}" property="isJarAvail"/>
<fail message="Download JAR dependencies first with 'get-deps'">
<condition>
<or><isfalse value="${isJarAvail}"/></or>
</condition>
</fail>
<delete file="dist/click-${version}.jar" quiet="false"/>
<delete file="dist/click-nodeps-${version}.jar" quiet="false"/>
<property name="dir.source" value="framework/src"/>
<property name="dir.classes" value="framework/classes"/>
<delete dir="${dir.classes}" quiet="false"/>
<mkdir dir="${dir.classes}"/>
<copy todir="${dir.classes}">
<fileset dir="${dir.source}">
<exclude name="**/package.html"/>
</fileset>
</copy>
<!-- No Dependencies -->
<javac srcdir="${dir.source}"
destdir="${dir.classes}"
debug="true"
encoding="ISO-8859-1"
source="${javac.source}">
<classpath refid="classpath.framework"/>
</javac>
<jar destfile="dist/click-nodeps-${version}.jar">
<manifest>
<attribute name="Click-Version" value="${version}"/>
<attribute name="Package" value="net.sf.click"/>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<fileset dir="${dir.classes}"/>
</jar>
<digestMacro file="dist/click-nodeps-${version}.jar"/>
<!-- With Dependencies -->
<unzip src="lib/${jar.codec}" dest="${dir.classes}">
<!-- Exclude .html pages -->
<patternset>
<include name="**/*.class"/>
<exclude name="**/*.html"/>
</patternset>
</unzip>
<unzip src="lib/${jar.collections}" dest="${dir.classes}"/>
<unzip src="lib/${jar.io}" dest="${dir.classes}"/>
<unzip src="lib/${jar.lang}" dest="${dir.classes}"/>
<unzip src="lib/${jar.ognl}" dest="${dir.classes}"/>
<unzip src="lib/${jar.upload}" dest="${dir.classes}"/>
<unzip src="lib/${jar.velocity}" dest="${dir.classes}"/>
<jar destfile="dist/click-${version}.jar">
<manifest>
<attribute name="Click-Version" value="${version}"/>
<attribute name="Package" value="net.sf.click"/>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<fileset dir="${dir.classes}">
<exclude name="org/apache/velocity/anakia/**"/>
<exclude name="org/apache/velocity/test/**"/>
<exclude name="org/apache/velocity/texen/**"/>
</fileset>
</jar>
<digestMacro file="dist/click-${version}.jar"/>
</target>
<target name="build-maven-bundles"
depends="build-framework, build-mock, build-extras"
description="build Maven repository upload bundles">
<!-- Start with a clean directory -->
<delete dir="${maven-bundle}" quiet="false"/>
<mkdir dir="${maven-bundle}"/>
<buildBundleMacro name="click"/>
<buildBundleMacro name="click-nodeps"/>
<buildBundleMacro name="click-extras"/>
<buildBundleMacro name="click-mock"/>
</target>
<target name="build-sources"
description="build source ZIP files for use with IDEs">
<property name="dir.source" value="framework/src"/>
<!-- zip the framework without dependencies-->
<zip destfile="dist/click-nodeps-${version}-src.zip">
<fileset dir="${dir.source}">
<exclude name="**/.html"/>
<exclude name="**/.css"/>
<exclude name="**/.js"/>
<exclude name="**/.gif"/>
</fileset>
</zip>
<!-- zip the framework with dependencies:-->
<!-- this is not ready since the sources for the used jars are not available -->
<zip destfile="dist/click-${version}-src.zip">
<fileset dir="${dir.source}">
<exclude name="**/package.html"/>
</fileset>
</zip>
<!-- zip extras -->
<zip destfile="dist/click-extras-${version}-src.zip" >
<fileset dir="extras/src">
<exclude name="**/*.html"/>
</fileset>
</zip>
<!-- zip mock -->
<zip destfile="dist/click-mock-${version}-src.zip" >
<fileset dir="mock/src">
<exclude name="**/*.html"/>
</fileset>
</zip>
</target>
<target name="checkstyle" description="run checkstyle report on Java soruce">
<checkstyle config="build/checkstyle-checks.xml">
<fileset dir="framework/src/net" includes="**/*.java"/>
<fileset dir="extras/src" includes="**/*.java"/>
</checkstyle>
</target>
<target name="clean">
<delete dir="dist" quiet="false"/>
<mkdir dir="dist"/>
<delete>
<fileset dir="framework/test" includes="TEST-*.txt"/>
</delete>
<delete>
<fileset dir="extras/test" includes="TEST-*.txt"/>
</delete>
<delete>
<fileset dir="mock/test" includes="TEST-*.txt"/>
</delete>
</target>
<target name="deploy-examples" description="copy example WAR files to app server">
<delete file="${dir.appserver}/click-examples.war" quiet="true"/>
<sleep seconds="5"/>
<copy file="dist/click-examples.war" todir="${dir.appserver}" overwrite="true"/>
</target>
<target name="format-java">
<linetrim srcdir="framework/src" includes="**/*.java"/>
<replacetabs srcdir="framework/src" includes="**/*.java"/>
<linetrim srcdir="extras/src" includes="**/*.java"/>
<replacetabs srcdir="extras/src" includes="**/*.java"/>
<linetrim srcdir="mock/src" includes="**/*.java"/>
<replacetabs srcdir="mock/src" includes="**/*.java"/>
<linetrim srcdir="examples/src" includes="**/*.java"/>
<replacetabs srcdir="examples/src" includes="**/*.java"/>
<linetrim srcdir="template/src" includes="**/*.java"/>
<replacetabs srcdir="template/src" includes="**/*.java"/>
</target>
<target name="get-deps" description="download JAR dependencies">
<downloadMacro name="${jar.codec}" path="commons-codec"/>
<downloadMacro name="${jar.collections}" path="commons-collections"/>
<downloadMacro name="${jar.io}" path="commons-io"/>
<downloadMacro name="${jar.lang}" path="commons-lang"/>
<downloadMacro name="${jar.log4j}" path="log4j"/>
<downloadMacro name="${jar.ognl}" path="ognl"/>
<downloadMacro name="${jar.upload}" path="commons-fileupload"/>
<downloadMacro name="${jar.hibernate}" path="org.hibernate"/>
<downloadMacro name="${jar.junit}" path="junit"/>
<downloadMacro name="${jar.servlet}" path="javax.servlet"/>
<downloadMacro name="${jar.spring-beans}" path="org.springframework"/>
<downloadMacro name="${jar.spring-context}" path="org.springframework"/>
<downloadMacro name="${jar.spring-core}" path="org.springframework"/>
<downloadMacro name="${jar.spring-web}" path="org.springframework"/>
<get src="${repository}/maven/velocity/jars/${jar.velocity}"
dest="lib/${jar.velocity}"
verbose="true"
usetimestamp="true"/>
<get src="${repository}/maven2/org/apache/cayenne/cayenne-nodeps/2.0.4/${jar.cayenne}"
dest="lib/${jar.cayenne}"
verbose="true"
usetimestamp="true"/>
<get src="${repository}/maven2/org/freemarker/freemarker/2.3.12/${jar.freemarker}"
dest="lib/${jar.freemarker}"
verbose="true"
usetimestamp="true"/>
<ant antfile="build.xml"
dir="examples"
target="get-deps"
inheritall="false"/>
</target>
<target name="get-deps-proxy" description="download JAR dependencies">
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>
<antcall target="get-deps"/>
</target>
<target name="help" description="display the Help message">
<echo>Click ${version} web application framework
===================================
Main targets:
build-all build framework, extras, mock, examples
build-distribution build distribution ZIP file
build-examples build click-examples WAR file
build-extras build click-extras JAR file
build-mock build click-mock JAR file
build-framework build click framework JAR file
build-maven-bundles build Maven repository upload bundles
build-sources build source ZIP files for use with IDEs
checkstyle run checkstyle report on Java source
deploy-examples copy click-examples WAR file to app server
get-deps download JAR dependencies
get-deps-proxy download JAR dependencies via proxy
help display the Help message
javadoc create Javadoc HTML files
project-quick-start build application template
Environment:
java.home = ${java.home}
ant.home = ${ant.home}
Please ensure you have configured build.properties</echo>
</target>
<target name="javadoc" description="create Javadoc HTML files">
<!-- Framework -->
<delete quiet="false" failonerror="false">
<fileset dir="documentation/docs/click-api" includes="**/*"/>
</delete>
<javadocMacro src="framework/src"
destdir="documentation/docs/click-api"
windowtitle="Click Framework API"
doctitle="Click API"
classpath="classpath.framework"
overview=""/>
<copy file="framework/src/net/sf/click/control/image-submit.gif"
todir="documentation/docs/click-api/net/sf/click/control"/>
<!-- Extras -->
<delete quiet="false" failonerror="false">
<fileset dir="documentation/docs/extras-api" includes="**/*"/>
</delete>
<javadocMacro src="extras/src"
destdir="documentation/docs/extras-api"
windowtitle="Click Extras API"
doctitle="Click Extras API"
classpath="classpath.extras"
overview="documentation/docs/extras-overview.html"/>
<!-- Mock -->
<delete quiet="false" failonerror="false">
<fileset dir="documentation/docs/mock-api" includes="**/*"/>
</delete>
<javadocMacro src="mock/src"
destdir="documentation/docs/mock-api"
windowtitle="Click Mock API"
doctitle="Click Mock API"
classpath="classpath.mock"
overview="documentation/docs/mock-overview.html"/>
<copy file="documentation/images/post-sequence-diagram.png"
todir="documentation/docs/click-api/net/sf/click/"/>
<copy file="documentation/images/control-post-sequence-diagram.png"
todir="documentation/docs/click-api/net/sf/click/"/>
<copy file="documentation/images/service-package.png"
todir="documentation/docs/click-api/net/sf/click/service/"/>
<copy file="documentation/images/service-package.png"
todir="documentation/docs/extras-api/net/sf/click/extras/service/"/>
<copy file="extras/src/net/sf/click/extras/control/calendar/calendar.gif"
todir="documentation/docs/extras-api/net/sf/click/extras/control"/>
<copy file="documentation/images/form-table.png"
todir="documentation/docs/extras-api/net/sf/click/extras/control"/>
<copy file="documentation/images/menu.png"
todir="documentation/docs/extras-api/net/sf/click/extras/control"/>
<copy file="documentation/images/link-decorator.png"
todir="documentation/docs/extras-api/net/sf/click/extras/control"/>
<copy file="documentation/images/tabbed-form.png"
todir="documentation/docs/extras-api/net/sf/click/extras/control"/>
<copy file="documentation/images/virtual-keyboard.gif"
todir="documentation/docs/extras-api/net/sf/click/extras/control"/>
<copy file="documentation/images/table.png"
todir="documentation/docs/click-api/net/sf/click/control"/>
<copy file="documentation/images/tree.png"
todir="documentation/docs/extras-api/net/sf/click/extras/tree"/>
<copy file="documentation/images/checkbox-tree.png"
todir="documentation/docs/extras-api/net/sf/click/extras/tree"/>
<copy file="documentation/images/line-chart.png"
todir="documentation/docs/extras-api/net/sf/click/extras/graph"/>
<copy file="documentation/images/bar-chart.png"
todir="documentation/docs/extras-api/net/sf/click/extras/graph"/>
<copy file="documentation/images/pie-chart.png"
todir="documentation/docs/extras-api/net/sf/click/extras/graph"/>
<copy file="documentation/docs/javadoc-stylesheet.css"
overwrite="true"
tofile="documentation/docs/click-api/stylesheet.css"/>
<copy file="documentation/docs/javadoc-stylesheet.css"
overwrite="true"
tofile="documentation/docs/extras-api/stylesheet.css"/>
<copy file="documentation/docs/javadoc-stylesheet.css"
overwrite="true"
tofile="documentation/docs/mock-api/stylesheet.css"/>
<copy file="documentation/docs/javadoc-stylesheet.css"
overwrite="true"
tofile="documentation/docs/servlet-api/stylesheet.css"/>
</target>
<target name="test-framework">
<copy todir="framework/classes">
<fileset dir="framework/src">
<exclude name="**/package.html"/>
</fileset>
</copy>
<copy todir="framework/classes">
<fileset dir="framework/test">
<exclude name="**/package.html"/>
</fileset>
</copy>
<javac srcdir="framework/src;framework/test;extras/src;mock/src"
destdir="framework/classes"
debug="true"
encoding="ISO-8859-1"
source="${javac.source}">
<classpath refid="classpath.framework"/>
<classpath refid="classpath.extras"/>
<classpath refid="classpath.test"/>
</javac>
<junit haltonfailure="yes" showoutput="true">
<classpath refid="classpath.framework"/>
<classpath refid="classpath.extras"/>
<classpath refid="classpath.test"/>
<formatter type="plain"/>
<batchtest fork="yes" todir="framework/test">
<fileset dir="framework/test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<delete>
<fileset dir="framework/test" includes="TEST-*.txt"/>
</delete>
</target>
<target name="test-extras">
<copy todir="extras/classes">
<fileset dir="framework/src">
<exclude name="**/package.html"/>
</fileset>
</copy>
<copy todir="extras/classes">
<fileset dir="extras/test">
<exclude name="**/package.html"/>
</fileset>
</copy>
<javac srcdir="framework/src;extras/src;extras/test;mock/src"
destdir="extras/classes"
debug="true"
encoding="ISO-8859-1"
source="${javac.source}">
<classpath refid="classpath.framework"/>
<classpath refid="classpath.extras"/>
<classpath refid="classpath.test"/>
</javac>
<junit haltonfailure="yes" showoutput="true">
<classpath refid="classpath.framework"/>
<classpath refid="classpath.extras"/>
<classpath refid="classpath.test"/>
<formatter type="plain"/>
<batchtest fork="yes" todir="extras/test">
<fileset dir="extras/test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<delete>
<fileset dir="extras/test" includes="TEST-*.txt"/>
</delete>
</target>
<target name="test-mock">
<copy todir="mock/classes">
<fileset dir="mock/src">
<exclude name="**/package.html"/>
</fileset>
</copy>
<copy todir="mock/classes">
<fileset dir="mock/test">
<exclude name="**/package.html"/>
</fileset>
</copy>
<javac srcdir="framework/src;mock/src;mock/test"
destdir="mock/classes"
debug="true"
encoding="ISO-8859-1"
source="${javac.source}">
<classpath refid="classpath.framework"/>
<classpath refid="classpath.mock"/>
<classpath refid="classpath.test"/>
</javac>
<junit haltonfailure="yes" showoutput="true">
<classpath refid="classpath.framework"/>
<classpath refid="classpath.mock"/>
<classpath refid="classpath.test"/>
<formatter type="plain"/>
<batchtest fork="yes" todir="mock/test">
<fileset dir="mock/test">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
<delete>
<fileset dir="mock/test" includes="TEST-*.txt"/>
</delete>
</target>
<target name="test-all" depends="test-framework, test-extras, test-mock"/>
<target name="project-quick-start" description="build application template">
<downloadMacro name="${jar.servlet}" path="javax.servlet"/>
<available file="lib/${jar.servlet}" property="isServletJarAvail"/>
<fail message="Failed to download the file ${jar.servlet}. Please download it separately and place it in the 'lib' directory">
<condition>
<or><isfalse value="${isServletJarAvail}"/></or>
</condition>
</fail>
<downloadMacro name="${jar.log4j}" path="log4j"/>
<available file="lib/${jar.log4j}" property="isLog4JJarAvail"/>
<fail message="Failed to download the file ${jar.log4j}. Please download it separately and place it in the 'lib' directory">
<condition>
<or><isfalse value="${isLog4JJarAvail}"/></or>
</condition>
</fail>
<input
message="Please enter the project name (e.g. quickstart):"
addproperty="project-name"/>
<input
message="Please enter the root package name (e.g. com.${project-name}):"
addproperty="package-name"/>
<input
message="Please enter the web app context path:"
defaultvalue="${project-name}"
addproperty="context-path"/>
<delete
dir="../${project-name}"
quiet="false"/>
<package
projectName="${project-name}"
packageName="${package-name}"/>
<copy todir="../${project-name}/WebContent">
<fileset dir="template/WebContent"/>
</copy>
<copy
todir="../${project-name}/WebContent/WEB-INF/lib"
file="dist/click-${version}.jar"/>
<copy
todir="../${project-name}/WebContent/WEB-INF/lib"
file="dist/click-extras-${version}.jar"/>
<copy
todir="../${project-name}/WebContent/WEB-INF/lib"
file="lib/${jar.log4j}"/>
<copy
todir="../${project-name}/lib"
file="lib/servlet-api-2.3.jar"/>
<copy
todir="../${project-name}"
file="template/build.xml"/>
<copy
todir="../${project-name}"
file="template/README.txt"/>
<copy todir="${package.path}">
<fileset dir="template/src/template"/>
</copy>
<replace
token="package template"
value="package ${package-name}"
dir="../${project-name}/src"/>
<replace
token="import template"
value="import ${package-name}"
dir="../${project-name}/src"/>
<replace
token="template"
value="${package-name}"
file="../${project-name}/WebContent/WEB-INF/click.xml"/>
<replace
token="project-name"
value="${project-name}"
file="../${project-name}/WebContent/border-template.htm"/>
<replace
token="project-name"
value="${project-name}"
file="../${project-name}/WebContent/click/error.htm"/>
<replace
token="template-context"
value="${context-path}"
dir="../${project-name}"/>
</target>
<macrodef name="javadocMacro">
<attribute name="src"/>
<attribute name="destdir"/>
<attribute name="windowtitle"/>
<attribute name="doctitle"/>
<attribute name="classpath"/>
<attribute name="overview"/>
<sequential>
<javadoc sourcepath="@{src}"
destdir="@{destdir}"
author="true"
version="true"
verbose="false"
windowtitle="@{windowtitle}"
packagenames="net.*"
overview="@{overview}"
doctitle="@{doctitle}">
<classpath refid="@{classpath}"/>
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
<link href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/"/>
<link href="http://jakarta.apache.org/commons/fileupload/apidocs/"/>
<link href="http://click.sourceforge.net/docs/click-api/"/>
<link href="http://www.hibernate.org/hib_docs/v3/api/"/>
<link href="http://static.springframework.org/spring/docs/1.2.x/api/"/>
<bottom>${root.properties.highlighter}</bottom>
</javadoc>
<!-- Add IE Mark of the Web to each javadoc page -->
<replace dir="@{destdir}" value="&lt;!-- saved from url=(0014)about:internet --&gt;">
<include name="**/*.html"/>
<replacetoken>&lt;!--NewPage--&gt;</replacetoken>
</replace>
<!--
IE throws exception when trying to access parent frame and Mark of the Web is active.
Disable setting of window title, which needs to access the parent frame.
-->
<replace dir="@{destdir}" value="">
<include name="**/*.html"/>
<replacetoken> onload="windowTitle();"</replacetoken>
</replace>
</sequential>
</macrodef>
</project>