blob: a90675fee1b7324c0ac95ed38caea4f786c077f1 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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 name="click" default="help" basedir="..">
<!--
Project Properties
-->
<property file="./build/build.properties"/>
<xmlproperty file="./build/javascript-syntax-highlighter.xml"/>
<property name="click" value="click-${version}"/>
<property name="click-extras" value="click-extras-${version}"/>
<property name="click-nodeps" value="click-nodeps-${version}"/>
<property name="click-mock" value="click-mock-${version}"/>
<property name="jar.cayenne" value="cayenne-server-${cayenne.version}.jar"/>
<property name="jar.checkstyle" value="checkstyle-all-${checkstyle.version}.jar"/>
<property name="jar.codec" value="commons-codec-${commons-codec.version}.jar"/>
<property name="jar.collections" value="commons-collections-${commons-collections.version}.jar"/>
<property name="jar.freemarker" value="freemarker-${freemarker.version}.jar"/>
<property name="jar.hibernate" value="hibernate-${hibernate.version}.jar"/>
<property name="jar.io" value="commons-io-${commons-io.version}.jar"/>
<property name="jar.junit" value="junit-${junit.version}.jar"/>
<property name="jar.lang" value="commons-lang-${commons-lang.version}.jar"/>
<property name="jar.log4j" value="log4j-${log4j.version}.jar"/>
<property name="jar.ognl" value="ognl-${ognl.version}.jar"/>
<property name="jar.servlet" value="servlet-api-${servlet-api.version}.jar"/>
<property name="jar.slf4j" value="slf4j-api-${slf4j.version}.jar"/>
<property name="jar.spring" value="spring-${spring.version}.jar"/>
<property name="jar.upload" value="commons-fileupload-${commons-fileupload.version}.jar"/>
<property name="jar.velocity" value="velocity-${velocity.version}.jar"/>
<property name="javac.source" value="1.5"/>
<property name="repository" value="http://repo1.maven.org"/>
<property name="maven-bundle" value="../maven-upload"/>
<!--
Macro Definitions
-->
<macrodef name="downloadMacro">
<attribute name="name"/>
<attribute name="path"/>
<sequential>
<get src="${repository}/maven2/@{path}/@{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}/@{name}-${version}.pom"/>
<replace file="${maven-bundle}/@{name}/@{name}-${version}.pom"
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}/@{name}-${version}.pom"
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>
<!--
Calculating checksum currently not very useful
-->
<checksum file="@{file}" forceOverwrite="true" fileext=".md5"/>
<checksum file="@{file}" forceOverwrite="true" algorithm="SHA1" fileext=".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.slf4j}"/>
<pathelement location="lib/${jar.spring}"/>
<pathelement location="lib/${jar.freemarker}"/>
<pathelement location="dist/${click}.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}.jar"/>
</path>
<path id="classpath.examples">
<pathelement location="lib/${jar.servlet}"/>
<pathelement location="lib/${jar.spring}"/>
<pathelement location="dist/${click}.jar"/>
<pathelement location="dist/${click-extras}.jar"/>
</path>
<path id="classpath.test">
<pathelement location="lib/${jar.junit}"/>
</path>
<path id="classpath.checkstyle">
<pathelement location="framework/classes"/>
<pathelement location="extras/classes"/>
<pathelement location="mock/classes"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</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}" quiet="false"/>
<mkdir dir="${click}"/>
<copy todir="${click}">
<fileset dir="." casesensitive="yes">
<exclude name=".**"/>
<exclude name=".**/**"/>
<exclude name="${click}"/>
<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.slf4j}"/>
<exclude name="lib/${jar.velocity}"/>
<exclude name="lib/spring-*.jar"/>
<exclude name="lib/${jar.upload}"/>
<exclude name="lib/${jar.checkstyle}"/>
<exclude name="**/Thumbs.db"/>
<exclude name="**/classes/**"/>
<exclude name="**/WEB-INF/lib/**"/>
<exclude name="examples/webapp/javadoc/**"/>
<exclude name="documentation/xdocs/lib/**"/>
<exclude name="documentation/xdocs/target/**"/>
<exclude name="documentation/xdocs/click-docbook/**"/>
</fileset>
</copy>
<delete file="../${click}.zip"/>
<zip basedir="."
destfile="../${click}.zip"
includes="${click}/**"/>
<delete dir="${click}" quiet="false"/>
<digestMacro file="../${click}.zip"/>
</target>
<target name="build-examples" description="build click-examples WAR file" depends="check-deps">
<ant antfile="build.xml"
dir="examples"
target="build"
inheritall="false"/>
</target>
<target name="build-extras" description="build extras JAR file" depends="check-deps, prepare-hibernate">
<available file="dist/${click}.jar" property="isClickAvail"/>
<fail message="Build framework first with 'build-framework'">
<condition>
<or><isfalse value="${isClickAvail}"/></or>
</condition>
</fail>
<delete file="dist/${click-extras}.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"/>
<exclude name="${exclude-hibernate}"/>
</fileset>
</copy>
<copy file="LICENSE.txt" todir="extras/classes/META-INF"/>
<copy file="NOTICE.txt" todir="extras/classes/META-INF"/>
<javac srcdir="extras/src"
destdir="extras/classes"
debug="true"
excludes="**/Test*, ${exclude-hibernate}"
encoding="UTF-8"
source="${javac.source}">
<classpath refid="classpath.extras"/>
</javac>
<jar destfile="dist/${click-extras}.jar">
<manifest>
<attribute name="Click-Version" value="${version}"/>
<attribute name="Package" value="org.apache.click.extras"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Build-Jdk" value="${java.version}"/>
<attribute name="Extension-Name" value="org.apache.click.extras"/>
<attribute name="Specification-Title" value="Click is a Java-based web application framework" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.click.extras"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
<fileset dir="extras/classes"/>
</jar>
<delete dir="temp" quiet="false"/>
</target>
<target name="build-framework" description="build framework JAR file" depends="check-deps">
<mkdir dir="dist"/>
<delete file="dist/${click}.jar" quiet="false"/>
<delete file="dist/${click-nodeps}.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>
<copy file="LICENSE.txt" todir="${dir.classes}/META-INF"/>
<copy file="NOTICE.txt" todir="${dir.classes}/META-INF"/>
<!-- No Dependencies -->
<javac srcdir="${dir.source}"
destdir="${dir.classes}"
debug="true"
encoding="UTF-8"
source="${javac.source}">
<classpath refid="classpath.framework"/>
</javac>
<jar destfile="dist/${click-nodeps}.jar">
<manifest>
<attribute name="Click-Version" value="${version}"/>
<attribute name="Package" value="org.apache.click"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Build-Jdk" value="${java.version}"/>
<attribute name="Extension-Name" value="org.apache.click"/>
<attribute name="Specification-Title" value="Click is a Java-based web application framework" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.click"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
<fileset dir="${dir.classes}"/>
</jar>
<!-- With Dependencies -->
<unzip src="lib/${jar.codec}" dest="${dir.classes}">
<!-- Exclude .html pages -->
<patternset>
<include name="**/*.class"/>
<exclude name="**/*.html"/>
</patternset>
</unzip>
<delete dir="temp" quiet="false"/>
<unzip src="lib/${jar.collections}" dest="temp"/>
<unzip src="lib/${jar.io}" dest="temp"/>
<unzip src="lib/${jar.lang}" dest="temp"/>
<unzip src="lib/${jar.ognl}" dest="temp"/>
<unzip src="lib/${jar.upload}" dest="temp"/>
<unzip src="lib/${jar.velocity}" dest="temp"/>
<copy todir="${dir.classes}">
<fileset dir="temp">
<exclude name="META-INF/**"/>
</fileset>
</copy>
<delete dir="temp" quiet="false"/>
<jar destfile="dist/${click}.jar">
<manifest>
<attribute name="Click-Version" value="${version}"/>
<attribute name="Package" value="org.apache.click"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Build-Jdk" value="${java.version}"/>
<attribute name="Extension-Name" value="org.apache.click"/>
<attribute name="Specification-Title" value="Click is a Java-based web application framework" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.click"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${version}"/>
</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>
</target>
<target name="build-mock" description="build mock JAR file" depends="check-deps">
<available file="dist/${click}.jar" property="isClickAvail"/>
<fail message="Build framework first with 'build-framework'">
<condition>
<or><isfalse value="${isClickAvail}"/></or>
</condition>
</fail>
<delete file="dist/${click-mock}.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>
<copy file="LICENSE.txt" todir="mock/classes/META-INF"/>
<copy file="NOTICE.txt" todir="mock/classes/META-INF"/>
<javac srcdir="mock/src"
destdir="mock/classes"
debug="true"
excludes="**/Test*"
encoding="UTF-8"
source="${javac.source}">
<classpath refid="classpath.mock"/>
</javac>
<jar destfile="dist/${click-mock}.jar">
<manifest>
<attribute name="Click-Version" value="${version}"/>
<attribute name="Package" value="org.apache.click.mock"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Created-By" value="Apache Ant"/>
<attribute name="Build-Jdk" value="${java.version}"/>
<attribute name="Extension-Name" value="org.apache.click.mock"/>
<attribute name="Specification-Title" value="Click is a Java-based web application framework" />
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="org.apache.click.mock"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
<fileset dir="mock/classes"/>
</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}-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}-src.zip">
<fileset dir="${dir.source}">
<exclude name="**/package.html"/>
</fileset>
</zip>
<!-- zip extras -->
<zip destfile="dist/${click-extras}-src.zip" >
<fileset dir="extras/src">
<exclude name="**/*.html"/>
</fileset>
</zip>
<!-- zip mock -->
<zip destfile="dist/${click-mock}-src.zip" >
<fileset dir="mock/src">
<exclude name="**/*.html"/>
</fileset>
</zip>
</target>
<target name="checkstyle" description="run checkstyle report on Java source">
<available file="lib/${jar.checkstyle}" property="isJarAvail"/>
<fail message="The Checkstyle JAR is not on the classpath. To resolve this download the JAR dependencies with 'ant get-deps'.">
<condition>
<or><isfalse value="${isJarAvail}"/></or>
</condition>
</fail>
<taskdef resource="checkstyletask.properties"
classpath="lib/${jar.checkstyle}"/>
<checkstyle config="build/checkstyle-checks.xml">
<fileset dir="framework/src/org/apache/click/" includes="**/*.java"/>
<fileset dir="extras/src" includes="**/*.java"/>
<fileset dir="mock/src" includes="**/*.java"/>
<classpath refid="classpath.checkstyle"/>
</checkstyle>
</target>
<target name="check-deps">
<available file="lib/${jar.codec}" property="isCodecAvail"/>
<fail message="Download JAR dependencies first with 'ant get-deps'">
<condition>
<or><isfalse value="${isCodecAvail}"/></or>
</condition>
</fail>
<available file="lib/${jar.junit}" property="isJUnitAvail"/>
<fail message="Download JAR dependencies first with 'ant get-deps'">
<condition>
<or><isfalse value="${isJUnitAvail}"/></or>
</condition>
</fail>
</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">
<!--
Task Definitions
-->
<taskdef name="linetrim"
classname="org.apache.click.tools.devtasks.LineTrimTask"
classpath="lib/click-dev-tasks-1.1.jar"/>
<taskdef name="replacetabs"
classname="org.apache.click.tools.devtasks.ReplaceTabsTask"
classpath="lib/click-dev-tasks-1.1.jar"/>
<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/commons-codec/${commons-codec.version}"/>
<downloadMacro name="${jar.collections}" path="commons-collections/commons-collections/${commons-collections.version}"/>
<downloadMacro name="${jar.io}" path="commons-io/commons-io/${commons-io.version}"/>
<downloadMacro name="${jar.lang}" path="commons-lang/commons-lang/${commons-lang.version}"/>
<downloadMacro name="${jar.log4j}" path="log4j/log4j/${log4j.version}"/>
<downloadMacro name="${jar.ognl}" path="ognl/ognl/${ognl.version}"/>
<downloadMacro name="${jar.upload}" path="commons-fileupload/commons-fileupload/${commons-fileupload.version}"/>
<downloadMacro name="${jar.junit}" path="junit/junit/${junit.version}"/>
<downloadMacro name="${jar.servlet}" path="javax/servlet/servlet-api/${servlet-api.version}"/>
<downloadMacro name="${jar.slf4j}" path="org/slf4j/slf4j-api/${slf4j.version}"/>
<downloadMacro name="${jar.spring}" path="org/springframework/spring/${spring.version}"/>
<downloadMacro name="${jar.velocity}" path="org/apache/velocity/velocity/${velocity.version}"/>
<downloadMacro name="${jar.cayenne}" path="org/apache/cayenne/cayenne-server/${cayenne.version}"/>
<downloadMacro name="${jar.freemarker}" path="org/freemarker/freemarker/${freemarker.version}"/>
<ant antfile="build.xml"
dir="examples"
target="get-deps"
inheritall="false"/>
<!-- Check if hibernate download is enabled -->
<condition property="hibernate.true">
<istrue value="${download.hibernate}" />
</condition>
<!-- Check if checkstyle download is enabled -->
<condition property="checkstyle.true">
<istrue value="${download.checkstyle}" />
</condition>
<!-- Download optional dependencies -->
<antcall target="download-hibernate"/>
<antcall target="download-checkstyle"/>
</target>
<target name="get-deps-proxy" description="download JAR dependencies">
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>
<antcall target="get-deps"/>
</target>
<target name="download-hibernate" if="hibernate.true">
<downloadMacro name="${jar.hibernate}" path="org/hibernate/hibernate/${hibernate.version}"/>
</target>
<target name="download-checkstyle" if="checkstyle.true">
<get src="http://clickclick.googlecode.com/svn/trunk/checkstyle/${jar.checkstyle}"
dest="lib/${jar.checkstyle}"
verbose="true"
usetimestamp="true"/>
</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
test-all run all unit tests
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" depends="prepare-hibernate">
<!-- 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 - v${version}"
doctitle="Click API - v${version}"
classpath="classpath.framework"
overview="documentation/docs/core-overview.html"
excludes=""/>
<!-- 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 - v${version}"
doctitle="Click Extras API - v${version}"
classpath="classpath.extras"
overview="documentation/docs/extras-overview.html"
excludes="${exclude-hibernate-package}"/>
<!-- 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 - v${version}"
doctitle="Click Mock API - v${version}"
classpath="classpath.mock"
overview="documentation/docs/mock-overview.html"
excludes=""/>
<copy file="documentation/images/image-submit.gif"
todir="documentation/docs/click-api/org/apache/click/control"/>
<copy file="documentation/images/post-sequence-diagram.png"
todir="documentation/docs/click-api/org/apache/click/"/>
<copy file="documentation/xdocs/src/images/controls/control-post-sequence-diagram.png"
todir="documentation/docs/click-api/org/apache/click/"/>
<copy file="documentation/images/service-package.png"
todir="documentation/docs/click-api/org/apache/click/service/"/>
<copy file="documentation/images/service-package.png"
todir="documentation/docs/extras-api/org/apache/click/extras/service/"/>
<copy file="documentation/images/calendar.gif"
todir="documentation/docs/extras-api/org/apache/click/extras/control"/>
<copy file="documentation/images/form-table.png"
todir="documentation/docs/extras-api/org/apache/click/extras/control"/>
<copy file="documentation/images/menu.png"
todir="documentation/docs/extras-api/org/apache/click/extras/control"/>
<copy file="documentation/images/link-decorator.png"
todir="documentation/docs/extras-api/org/apache/click/extras/control"/>
<copy file="documentation/images/tabbed-form.png"
todir="documentation/docs/extras-api/org/apache/click/extras/control"/>
<copy file="documentation/images/virtual-keyboard.gif"
todir="documentation/docs/extras-api/org/apache/click/extras/control"/>
<copy file="documentation/images/table.png"
todir="documentation/docs/click-api/org/apache/click/control"/>
<copy file="documentation/images/default-paginator.png"
todir="documentation/docs/click-api/org/apache/click/control"/>
<copy file="documentation/images/inline-paginator.png"
todir="documentation/docs/extras-api/org/apache/click/extras/control"/>
<copy file="extras/src/META-INF/resources/click/colorpicker/images/color-picker.png"
todir="documentation/docs/extras-api/org/apache/click/extras/control/colorpicker"/>
<copy file="documentation/images/tree.png"
todir="documentation/docs/extras-api/org/apache/click/extras/tree"/>
<copy file="documentation/images/checkbox-tree.png"
todir="documentation/docs/extras-api/org/apache/click/extras/tree"/>
<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"/>
</target>
<!--
Testing tasks
-->
<target name="test-framework" depends="check-deps">
<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;mock/src"
destdir="framework/classes"
debug="true"
encoding="UTF-8"
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" depends="check-deps">
<copy todir="extras/classes">
<fileset dir="extras/src">
<exclude name="**/package.html"/>
</fileset>
</copy>
<copy todir="extras/classes">
<fileset dir="extras/test">
<exclude name="**/package.html"/>
</fileset>
</copy>
<javac srcdir="extras/src;extras/test;mock/src"
destdir="extras/classes"
debug="true"
encoding="UTF-8"
source="${javac.source}">
<classpath refid="classpath.framework"/>
<classpath refid="classpath.extras"/>
<classpath refid="classpath.test"/>
</javac>
<junit haltonfailure="yes" showoutput="true">
<classpath refid="classpath.extras"/>
<classpath refid="classpath.framework"/>
<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" depends="check-deps">
<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="mock/src;mock/test"
destdir="mock/classes"
debug="true"
encoding="UTF-8"
source="${javac.source}">
<classpath refid="classpath.mock"/>
<classpath refid="classpath.framework"/>
<classpath refid="classpath.test"/>
</javac>
<junit haltonfailure="yes" showoutput="true">
<classpath refid="classpath.mock"/>
<classpath refid="classpath.framework"/>
<classpath refid="classpath.test"/>
<formatter type="plain"/>
<batchtest fork="yes" todir="mock/test">
<fileset dir="mock/test">
<include name="**/*Test.java"/>
<include name="**/*Tests.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"
description="run all unit tests"/>
<!--
Javadoc macro
-->
<macrodef name="javadocMacro">
<attribute name="src"/>
<attribute name="destdir"/>
<attribute name="windowtitle"/>
<attribute name="doctitle"/>
<attribute name="classpath"/>
<attribute name="overview"/>
<attribute name="excludes"/>
<sequential>
<javadoc sourcepath="@{src}"
destdir="@{destdir}"
author="true"
version="true"
verbose="false"
windowtitle="@{windowtitle}"
packagenames="org.apache.click.*"
overview="@{overview}"
doctitle="@{doctitle}"
encoding="UTF-8"
charset="UTF-8"
excludepackagenames="@{excludes}">
<classpath refid="@{classpath}"/>
<link href="http://java.sun.com/j2se/1.5.0/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.apache.org/docs/click-api/"/>
<link href="http://docs.jboss.org/hibernate/stable/core/api/"/>
<link href="http://static.springframework.org/spring/docs/2.5.x/api/"/>
</javadoc>
<!-- Add syntax highlighter to each javadoc page -->
<replace dir="@{destdir}" value="${root.properties.highlighter}&lt;/BODY&gt;">
<include name="**/*.html"/>
<replacetoken>&lt;/BODY&gt;</replacetoken>
</replace>
<!-- 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>
<!--
Quickstart project task
-->
<target name="project-quick-start" description="build application template">
<!--
Task Definitions
-->
<taskdef name="package"
classname="org.apache.click.tools.devtasks.PackageTask"
classpath="lib/click-dev-tasks-1.1.jar"/>
<available file="lib/${jar.servlet}" property="isServletJarAvail"/>
<fail message="The lib/${jar.servlet} JAR is not available. To resolve this download the JAR dependencies with 'ant get-deps'.">
<condition>
<or><isfalse value="${isServletJarAvail}"/></or>
</condition>
</fail>
<available file="lib/${jar.log4j}" property="isLog4JJarAvail"/>
<fail message="The lib/${jar.log4j} JAR is not available. To resolve this download the JAR dependencies with 'ant get-deps'.">
<condition>
<or><isfalse value="${isLog4JJarAvail}"/></or>
</condition>
</fail>
<available file="dist/${click}.jar" property="isClickAvail"/>
<fail message="The dist/${click} JAR is not available. To resolve this build the project with 'ant build-distribution'.">
<condition>
<or><isfalse value="${isClickAvail}"/></or>
</condition>
</fail>
<input
message="Please enter the project name (e.g. quickstart):"
defaultvalue="quickstart"
addproperty="project-name"/>
<input
message="Please enter the root package name (e.g. com.${project-name}):"
defaultvalue="com.${project-name}"
addproperty="package-name"/>
<input
message="Please enter the web app context path:"
defaultvalue="${project-name}"
addproperty="context-path"/>
<dirname property="project-path" file="../${project-name}"/>
<input
message="The directory '${project-path}/${project-name}' will be deleted. Continue (y/n)?"
validargs="y,n"
addproperty="do.delete"/>
<condition property="do.abort">
<equals arg1="n" arg2="${do.delete}"/>
</condition>
<fail if="do.abort">Quickstart aborted.</fail>
<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}.jar"/>
<copy
todir="../${project-name}/WebContent/WEB-INF/lib"
file="dist/${click-extras}.jar"/>
<copy
todir="../${project-name}/WebContent/WEB-INF/lib"
file="lib/${jar.log4j}"/>
<copy
todir="../${project-name}/lib"
file="lib/servlet-api-2.4.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>
<target name="prepare-hibernate" depends="check-hibernate,check-hibernate-false"/>
<target name="check-hibernate">
<!-- note: check to see if hibernate.jar is available. -->
<available classname="org.hibernate.Hibernate" property="hibernate.present">
<classpath refid="classpath.extras"/>
</available>
</target>
<target name="check-hibernate-false" unless="hibernate.present">
<property name="exclude-hibernate" value="**/hibernate/**"/>
<property name="exclude-hibernate-package" value="org.apache.click.extras.hibernate.*"/>
<echo level="warning">
********************************************************
**
** The Hibernate library has not been found on your
** classpath. The newly built Click Extras jar will
** exclude the Hibernate package.
**
********************************************************
</echo>
</target>
</project>