blob: 551d0eeca758959e2aa243b371cdd5e7ff6c78fa [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-cayenne" default="help" basedir=".">
<!-- Project Properties -->
<property file="build.properties"/>
<property name="name" value="click-cayenne"/>
<property name="jar.ashwood" value="ashwood-${ashwood.version}.jar"/>
<property name="jar.cayenne" value="cayenne-nodeps-${cayenne.version}.jar"/>
<property name="jar.click" value="click-${click.version}-incubating.jar"/>
<property name="jar.click-extras" value="click-extras-${click.version}-incubating.jar"/>
<property name="jar.hsqldb" value="hsqldb-${hsqldb.version}.jar"/>
<property name="jar.log4j" value="log4j-${log4j.version}.jar"/>
<property name="jar.oro" value="oro-${oro.version}.jar"/>
<property name="jar.servlet" value="servlet-api-${servlet.api.version}.jar"/>
<property name="repository" value="http://repo1.maven.org"/>
<property name="dir.webapp" value="webapp"/>
<property name="dir.weblib" value="${dir.webapp}/WEB-INF/lib"/>
<path id="classpath">
<pathelement location="lib/${jar.servlet}"/>
<pathelement location="${dir.weblib}/${jar.cayenne}"/>
<pathelement location="${dir.weblib}/${jar.click}"/>
<pathelement location="${dir.weblib}/${jar.click-extras}"/>
<pathelement location="${dir.weblib}/${jar.log4j}"/>
</path>
<!-- Macro Definitions -->
<macrodef name="downloadMacro">
<attribute name="name"/>
<attribute name="path"/>
<sequential>
<get src="${repository}/maven2/@{path}/@{name}"
dest="${dir.weblib}/@{name}"
verbose="true"
usetimestamp="true"/>
</sequential>
</macrodef>
<!-- Tasks -->
<target name="build" description="build web application WAR file" depends="compile">
<delete quiet="true" failonerror="false">
<fileset dir="${dir.webapp}/javadoc" includes="**/*"/>
</delete>
<javadoc sourcepath="webapp/WEF-INF/src"
destdir="${dir.webapp}/javadoc"
author="true"
version="true"
verbose="false"
windowtitle="Click Examples"
doctitle="Click Cayenne Example API">
<classpath refid="classpath"/>
<packageset dir="${dir.webapp}/WEB-INF/src"/>
<link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
<link href="http://click.sourceforge.net/docs/click-api/"/>
<link href="http://click.sourceforge.net/docs/extras-api/"/>
<link href="http://www.objectstyle.org/cayenne/api/cayenne/"/>
</javadoc>
<delete dir="deploy" quiet="false"/>
<mkdir dir="deploy"/>
<war destfile="deploy/${name}.war"
webxml="${dir.webapp}/WEB-INF/web.xml">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<lib file="${jar.ashwood}"/>
<lib file="${jar.cayenne}"/>
<lib file="${jar.click}"/>
<lib file="${jar.click-extras}"/>
<lib file="${jar.log4j}"/>
<lib file="${jar.oro}"/>
<fileset dir="${dir.webapp}">
<exclude name="**/web.xml"/>
</fileset>
</war>
</target>
<target name="compile" description="compile Java source">
<delete dir="${dir.webapp}/WEB-INF/classes" quiet="false"/>
<mkdir dir="${dir.webapp}/WEB-INF/classes"/>
<javac srcdir="${dir.webapp}/WEB-INF/src"
destdir="${dir.webapp}/WEB-INF/classes"
debug="true">
<classpath refid="classpath"/>
</javac>
</target>
<target name="deploy" description="copy WAR files to application server">
<copy file="deploy/click-cayenne.war" todir="${dir.appserver}" overwrite="true"/>
</target>
<target name="get-deps" description="download JAR dependencies">
<mkdir dir="${dir.weblib}"/>
<downloadMacro name="${jar.ashwood}" path="org/objectstyle/ashwood/ashwood/${ashwood.version}"/>
<downloadMacro name="${jar.cayenne}" path="org/apache/cayenne/cayenne-nodeps/${cayenne.version}"/>
<downloadMacro name="${jar.log4j}" path="log4j/log4j/${log4j.version}"/>
<downloadMacro name="${jar.hsqldb}" path="hsqldb/hsqldb/${hsqldb.version}"/>
<downloadMacro name="${jar.oro}" path="oro/oro/${oro.version}"/>
<get src="${repository}/maven2/javax/servlet/servlet-api/${servlet.api.version}/${jar.servlet}" verbose="true"
dest="lib/${jar.servlet}"
usetimestamp="true"/>
</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 Cayenne demo 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>