blob: 07ea4e61d973b581b5ccebd926c3dce943f09258 [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-examples" default="help" basedir=".">
<!--
Project Properties
-->
<property file="../build/build.properties"/>
<property name="name" value="click-examples"/>
<property name="jar.spring-security" value="spring-security-core-${spring-security.version}.jar"/>
<property name="jar.annotation" value="geronimo-annotation_1.0_spec-${geronimo-common-annotations.version}.jar"/>
<property name="jar.ashwood" value="ashwood-${ashwood.version}.jar"/>
<property name="jar.cayenne" value="cayenne-server-${cayenne.version}.jar"/>
<property name="jar.click" value="click-${version}.jar"/>
<property name="jar.click-extras" value="click-extras-${version}.jar"/>
<property name="jar.hsqldb" value="hsqldb-${hsqldb.version}.jar"/>
<property name="jar.jstl" value="jstl-${jstl.version}.jar"/>
<property name="jar.log4j" value="log4j-${log4j.version}.jar"/>
<property name="jar.logging" value="commons-logging-${commons-logging.version}.jar"/>
<property name="jar.oscache" value="oscache-${oscache.version}.jar"/>
<property name="jar.poi" value="poi-${poi.version}.jar"/>
<property name="jar.quartz" value="quartz-all-${quartz.version}.jar"/>
<property name="jar.servlet" value="servlet-api-${servlet-api.version}.jar"/>
<property name="jar.spring" value="spring-${spring.version}.jar"/>
<property name="jar.standard" value="standard-${standard.version}.jar"/>
<property name="javac.source" value="1.5"/>
<property name="dir.deploy" value="../dist"/>
<property name="dir.webapp" value="webapp"/>
<property name="dir.weblib" value="${dir.webapp}/WEB-INF/lib"/>
<!--
Macro Definitions
-->
<macrodef name="webDownloadMacro">
<attribute name="name"/>
<attribute name="path"/>
<sequential>
<get src="${repository}/maven2/@{path}/@{name}"
dest="${dir.weblib}/@{name}"
verbose="true"
usetimestamp="true"/>
</sequential>
</macrodef>
<!--
Path Definitions
-->
<path id="classpath">
<pathelement location="../dist/${jar.click}"/>
<pathelement location="../dist/${jar.click-extras}"/>
<pathelement location="../lib/${jar.servlet}"/>
<fileset dir="${dir.weblib}">
<include name="*.jar"/>
</fileset>
</path>
<!--
Task Definitions
-->
<target name="build" description="build web application WAR file" depends="compile">
<delete quiet="true" failonerror="false">
<fileset dir="${dir.webapp}/javadoc" includes="**/*"/>
</delete>
<delete dir="${dir.webapp}/click"/>
<delete dir="${dir.webapp}/images"/>
<!-- Delete all deployed.html reports -->
<delete>
<fileset dir="${basedir}" includes="deployed*.html"/>
<fileset dir="../build" includes="deployed*.html"/>
</delete>
<javadoc sourcepath="src"
destdir="${dir.webapp}/javadoc"
author="true"
version="true"
verbose="false"
windowtitle="Click Examples"
doctitle="Click Example API">
<classpath refid="classpath"/>
<packageset dir="src"/>
<link href="http://java.sun.com/j2se/1.5.0/docs/api/"/>
<link href="http://click.apache.org/docs/click-api/"/>
<link href="http://static.springframework.org/spring/docs/2.5.x/api/"/>
</javadoc>
<copy file="../documentation/docs/javadoc-stylesheet.css"
overwrite="true"
tofile="${dir.webapp}/javadoc/stylesheet.css"/>
<delete file="${dir.deploy}/${name}.war"/>
<mkdir dir="${dir.deploy}"/>
<taskdef name="deploy"
classname="org.apache.click.tools.deploy.DeployTask"
classpath="../lib/click-dev-tasks-1.1.jar"/>
<deploy todir="${dir.webapp}">
<fileset dir="${dir.webapp}/WEB-INF">
<include name="**/classes"/>
<include name="**/*.jar"/>
</fileset>
<fileset dir="../dist">
<include name="${jar.click}"/>
<include name="${jar.click-extras}"/>
</fileset>
</deploy>
<war destfile="${dir.deploy}/${name}.war"
webxml="${dir.webapp}/WEB-INF/web.xml">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<lib file="../dist/${jar.click}"/>
<lib file="../dist/${jar.click-extras}"/>
<fileset dir="${dir.webapp}">
<exclude name="**/web.xml"/>
</fileset>
</war>
</target>
<target name="compile" description="compile Java source">
<available file="../dist/${jar.click-extras}" property="isExtrasAvail"/>
<fail message="Build extras first with 'build-extras'">
<condition>
<or><isfalse value="${isExtrasAvail}"/></or>
</condition>
</fail>
<delete dir="${dir.webapp}/WEB-INF/classes" quiet="false"/>
<mkdir dir="${dir.webapp}/WEB-INF/classes"/>
<copy todir="${dir.webapp}/WEB-INF/classes">
<fileset dir="src">
<exclude name="**/package.html"/>
</fileset>
</copy>
<javac srcdir="src"
destdir="${dir.webapp}/WEB-INF/classes"
debug="true"
encoding="ISO-8859-1"
source="${javac.source}">
<classpath refid="classpath"/>
</javac>
</target>
<target name="deploy" description="copy WAR files to application server">
<copy file="${dir.deploy}/${name}.war" todir="${dir.appserver}" overwrite="true"/>
</target>
<target name="get-deps" description="download JAR dependencies">
<mkdir dir="${dir.weblib}"/>
<property name="repository" value="http://repo1.maven.org"/>
<webDownloadMacro name="${jar.spring-security}" path="org/springframework/security/spring-security-core/${spring-security.version}"/>
<webDownloadMacro name="${jar.annotation}" path="org/apache/geronimo/specs/geronimo-annotation_1.0_spec/${geronimo-common-annotations.version}"/>
<webDownloadMacro name="${jar.ashwood}" path="org/objectstyle/ashwood/ashwood/${ashwood.version}"/>
<webDownloadMacro name="${jar.cayenne}" path="org/apache/cayenne/cayenne-server/${cayenne.version}"/>
<webDownloadMacro name="${jar.hsqldb}" path="hsqldb/hsqldb/${hsqldb.version}"/>
<webDownloadMacro name="${jar.jstl}" path="jstl/jstl/${jstl.version}"/>
<webDownloadMacro name="${jar.logging}" path="commons-logging/commons-logging/${commons-logging.version}"/>
<webDownloadMacro name="${jar.log4j}" path="log4j/log4j/${log4j.version}"/>
<webDownloadMacro name="${jar.oscache}" path="opensymphony/oscache/${oscache.version}"/>
<webDownloadMacro name="${jar.poi}" path="org/apache/poi/poi/${poi.version}"/>
<webDownloadMacro name="${jar.quartz}" path="opensymphony/quartz-all/${quartz.version}"/>
<webDownloadMacro name="${jar.spring}" path="org/springframework/spring/${spring.version}"/>
<webDownloadMacro name="${jar.standard}" path="taglibs/standard/${standard.version}"/>
</target>
<target name="get-deps-proxy" description="download JAR dependencies via proxy">
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>
<antcall target="get-deps"/>
</target>
<target name="help" description="display the Help message">
<echo message="Click Examples web application"/>
<echo message="=============================="/>
<echo/>
<echo message="Main targets:"/>
<echo/>
<echo message="build build web application WAR file"/>
<echo message="compile compile Java code"/>
<echo message="deploy copy WAR file to application server"/>
<echo message="get-deps download JAR dependencies"/>
<echo message="get-deps-proxy download JAR dependencies via proxy"/>
<echo message="help display the Help message"/>
<echo/>
<echo/>
<echo message="Please ensure you have configured build.properties"/>
<echo/>
</target>
</project>