blob: 53b2c9ebfdca8d148a8068b10505dd9ca0ceeda8 [file] [log] [blame]
<?xml version="1.0"?>
<!--
~ 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.
-->
<!-- Apache Ki root build file. If you want to understand how the Apache Ki build environment
works (useful if you want to build from scratch or join the project as a developer),
Read this article:
An Ant Modular Build Environment for Enterprise Applications:
http://www.onjava.com/pub/a/onjava/2005/06/22/modularant.html
Reading this will instantly make you familiar with our build.
-->
<project name="ki" default="all" xmlns:ivy="antlib:org.apache.ivy.ant">
<import file="./common.ant.xml"/>
<property name="ivy.install.version" value="2.0.0"/>
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME"/>
</condition>
<property name="ivy.home" value="${user.home}/.ant"/>
<property name="ivy.jar.dir" value="${ivy.home}/lib"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="src.ref.dir" value="${root.base.dir}/docs/reference"/>
<property name="dist.ref.dir" value="${docs.dir}/reference"/>
<!-- default to single sided: -->
<property name="double.sided" value="0"/>
<path id="javadoc.src">
<pathelement location="${root.base.dir}/core/src"/>
<pathelement location="${root.base.dir}/web/src"/>
<pathelement location="${root.base.dir}/support/ehcache/src"/>
<pathelement location="${root.base.dir}/support/quartz/src"/>
<pathelement location="${root.base.dir}/support/spring/src"/>
</path>
<path id="all.src">
<path refid="javadoc.src"/>
<pathelement location="${root.base.dir}/samples/spring/src"/>
<pathelement location="${root.base.dir}/samples/spring-hibernate/src"/>
</path>
<property name="ivy.repository.url" value="http://repo1.maven.org/maven2"/>
<!-- To disable this task (maybe behind a firewall?), use the -Doffline=true command-line switch -->
<target name="download-ivy" unless="offline" description="Ensures Ivy exists for automatic dependency mgt">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<echo message="Installing Ivy for automated dependecy management..."/>
<get src="${ivy.repository.url}/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<!-- =================================
target: load-ivy
This target is not necessary if you put ivy.jar in your ant lib directory.
If you already have ivy in your ant lib, you can simply remove this target.
================================= -->
<target name="load-ivy" depends="download-ivy" description="Ensures Ivy ant tasks are loaded">
<!-- try to load ivy here from local ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="retrieve-dependencies" depends="load-ivy"
description="Ensures all build dependencies have been downloaded">
<mkdir dir="${lib.dir}"/>
<ivy:retrieve pattern="${lib.dir}/[conf]/[artifact]-[revision].[ext]" sync="true"/>
</target>
<target name="init">
<mkdir dir="${dist.dir}/modules"/>
<mkdir dir="${dist.dir}/samples"/>
</target>
<!-- ==================================================================
Template target. Never called explicitly, only used to pass target
calls to the underlying modules.
================================================================== -->
<target name="template">
<!-- This section defines the modules and the order in which they are
executed for any given target. This means ORDER MATTERS.
Any dependencies that are to be satisified by one module for
another must be declared in the order the dependencies occur. -->
<echo message="Executing '${target}' for the core module..."/>
<ant dir="core" target="${target}"/>
<echo message="Executing '${target}' for the web module..."/>
<ant dir="web" target="${target}"/>
<echo message="Executing '${target}' for the ehcache module..."/>
<ant dir="support/ehcache" target="${target}"/>
<echo message="Executing '${target}' for the spring module..."/>
<ant dir="support/spring" target="${target}"/>
<echo message="Executing '${target}' for the quartz module..."/>
<ant dir="support/quartz" target="${target}"/>
<echo message="Executing '${target}' for the samples/quickstart module..."/>
<ant dir="samples/quickstart" target="${target}"/>
<echo message="Executing '${target}' for the samples/standalone module..."/>
<ant dir="samples/standalone" target="${target}"/>
<echo message="Executing '${target}' for the samples/spring module..."/>
<ant dir="samples/spring" target="${target}"/>
<echo message="Executing '${target}' for the samples/spring-hibernate module..."/>
<ant dir="samples/spring-hibernate" target="${target}"/>
<echo message="Executing '${target}' for the samples/web module..."/>
<ant dir="samples/web" target="${target}"/>
</target>
<!-- ===================================================================
Clean all local and children build files
=================================================================== -->
<target name="clean" description="Cleans the entire project">
<echo message="Cleaning all modules..."/>
<antcall target="template">
<param name="target" value="clean"/>
</antcall>
<echo message="Cleaning root build directory."/>
<delete dir="${build.dir}"/>
</target>
<target name="compile" depends="retrieve-dependencies,init" description="Compiles the project">
<echo message="Compiling all modules..."/>
<antcall target="template">
<param name="target" value="compile"/>
</antcall>
</target>
<macrodef name="jarjar">
<attribute name="srcdir" default="${dist.dir}/modules"/>
<attribute name="todir" default="${dist.dir}"/>
<attribute name="jdksuffix" default=""/>
<sequential>
<jar destfile="@{todir}/${project.name}@{jdksuffix}-${version}.jar" duplicate="fail">
<zipfileset src="@{srcdir}/${project.name}-core@{jdksuffix}-${version}.jar"/>
<zipfileset src="@{srcdir}/${project.name}-web@{jdksuffix}-${version}.jar"/>
<zipfileset src="@{srcdir}/${project.name}-ehcache@{jdksuffix}-${version}.jar"/>
<zipfileset src="@{srcdir}/${project.name}-quartz@{jdksuffix}-${version}.jar"/>
<zipfileset src="@{srcdir}/${project.name}-spring@{jdksuffix}-${version}.jar"/>
</jar>
</sequential>
</macrodef>
<target name="package" depends="retrieve-dependencies,init" description="Creates project artifacts">
<echo message="Packaging all modules..."/>
<antcall target="template">
<param name="target" value="package"/>
</antcall>
<!-- Now that each module has been packaged, make a 'master' .jar that includes everything. This allows
end-users to choose to use a single jar or multiple jars depending on their preference: -->
<jarjar/>
<jarjar srcdir="${dist.dir}/jdk14" todir="${dist.dir}/jdk14" jdksuffix="-jdk14"/>
<jarjar srcdir="${dist.dir}/jdk13" todir="${dist.dir}/jdk13" jdksuffix="-jdk13"/>
</target>
<target name="samples.web.deploy" depends="package"
description="Deploys the Apache Ki quickstart .war">
<ant dir="samples/web" target="deploy"/>
</target>
<target name="samples.spring.deploy" depends="package"
description="Deploys the sample Apache Ki/Spring .war">
<ant dir="samples/spring" target="deploy"/>
</target>
<target name="samples.spring-hibernate.deploy" depends="package"
description="Deploys the sample Apache Ki Spring/Hibernate .war">
<ant dir="samples/spring-hibernate" target="deploy"/>
</target>
<!-- =================================================================== -->
<!-- Javadoc all main sources -->
<!-- =================================================================== -->
<target name="javadoc" description="Generate Javadocs">
<echo message="Generating JavaDoc API..."/>
<delete dir="${api.dir}" failonerror="false"/>
<mkdir dir="${api.dir}"/>
<javadoc destdir="${api.dir}" windowtitle="Apache Ki API ${version}"
source="1.5" access="package" author="true" version="true" use="true"
defaultexcludes="true"
header='&lt;a href=\"http://ki.apache.org/\" target=\"_top\"&gt;Apache Ki&lt;/a&gt;'>
<sourcepath refid="javadoc.src"/>
<arg value="-breakiterator"/>
<arg value="-J-Xmx128m"/>
<arg value="-J-XX:MaxPermSize=128m"/>
<!-- <arg value="-J-Dhttp.proxyHost=${javadoc.proxyhost}"/>
<arg value="-J-Dhttp.proxyPort=${javadoc.proxyport}"/> -->
<doctitle><![CDATA[<h1>Apache Ki API ${version}</h1>]]></doctitle>
<!-- The following <bottom> block is to enable UA tracking via Google Analytics, but it fails the
JavaDoc task on a Windows Sun JDK. It works fine on Mac OS X JavaDoc. Since we want this UA
tracking, we use a Mac to build the release that end-users will download, so we leave this block
enabled. If you want to run JavaDoc in a Windows environment, remove this block, and it will
run successfully. -->
<bottom>
<![CDATA[
<i>Copyright &copy; 2004-2008 <a href="http://ki.apache.org/" target="_top">Apache Ki</a>.</i>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=%22" + gaJsHost + "google-analytics.com/ga.js%22 type=%22text/javascript%22%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3614410-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
]]>
</bottom>
<classpath refid="all.libs"/>
<!-- <packageset dir="${base.dir}/core/src">
<include name="org/ki/**"/>
</packageset>
<packageset dir="${root.base.dir}/support/ehcache/src">
<include name="org/ki/**"/>
</packageset>
<packageset dir="${root.base.dir}/support/spring/src">
<include name="org/ki/**"/>
</packageset>
<packageset dir="${root.base.dir}/support/quartz/src">
<include name="org/ki/**"/>
</packageset> -->
<link href="http://java.sun.com/j2se/1.5/docs/api"/>
<link href="http://java.sun.com/j2ee/1.4/docs/api"/>
<!-- Jakarta Commons -->
<link href="http://jakarta.apache.org/commons/collections/apidocs/"/>
<link href="http://commons.apache.org/beanutils/commons-beanutils-1.7.0/docs/api/"/>
<link href="http://jakarta.apache.org/commons/logging/apidocs/"/>
<link href="http://jakarta.apache.org/commons/codec/apidocs/"/>
<link href="http://quartz.sourceforge.net/javadoc/"/>
<link href="http://static.springframework.org/spring/docs/2.5.x/api/"/>
<link href="http://ehcache.sourceforge.net/javadoc/"/>
</javadoc>
</target>
<!-- ===================================================================
- Reference documentation
- =================================================================== -->
<target name="doc.prepare" depends="retrieve-dependencies" description="Extra preparation for the documentation">
<!-- unzip the docbook-libs.zip file containing the necessary jars: -->
<unzip src="${lib.dir}/docbook/docbook-libs-1.0.0.zip" dest="${lib.dir}/docbook"/>
<!-- <antcall target="tld.to.docbook"/> -->
</target>
<target name="doc.pdf" depends="doc.prepare" description="Compile reference documentation to pdf">
<mkdir dir="${dist.ref.dir}/pdf/images"/>
<copy todir="${dist.ref.dir}/pdf/images">
<fileset dir="${src.ref.dir}/images">
<include name="**/*"/>
</fileset>
</copy>
<java classname="com.icl.saxon.StyleSheet" fork="true" dir="${dist.ref.dir}">
<classpath>
<fileset dir="${lib.dir}/docbook">
<include name="**/*.jar"/>
</fileset>
</classpath>
<jvmarg value="-Xmx256M"/>
<jvmarg value="-XX:MaxPermSize=128m"/>
<arg value="-o"/>
<arg value="${dist.ref.dir}/pdf/docbook_fop.tmp"/>
<arg value="${src.ref.dir}/src/index.xml"/>
<arg value="${src.ref.dir}/styles/fopdf.xsl"/>
<!-- controls the double sided pagination style -->
<arg value="double.sided=${double.sided}"/>
</java>
<java classname="org.apache.fop.apps.Fop" fork="true" maxmemory="256m" dir="${dist.ref.dir}">
<classpath>
<fileset dir="${lib.dir}/docbook">
<include name="**/*.jar"/>
</fileset>
</classpath>
<arg value="${dist.ref.dir}/pdf/docbook_fop.tmp"/>
<arg value="${dist.ref.dir}/pdf/ki-reference.pdf"/>
</java>
<delete file="${dist.ref.dir}/pdf/docbook_fop.tmp"/>
</target>
<!-- Start of TLD => DocBook targets -->
<!-- <target name="tld.to.docbook" depends="original.tld.to.docbook,forms.tld.to.docbook"/>
<target name="original.tld.to.docbook">
<antcall target="hack.DOCTYPE">
<param name="doctype.input.file" value="src/org/springframework/web/servlet/tags/spring.tld"/>
<param name="doctype.scrubbed.file" value="${doc.ref.dir}/src/spring.tld"/>
</antcall>
<antcall target="private.tld.to.docbook">
<param name="input.tld" value="spring.tld"/>
<param name="input.tld.file" value="${doc.ref.dir}/src/spring.tld"/>
</antcall>
</target>
<target name="forms.tld.to.docbook">
<antcall target="hack.DOCTYPE">
<param name="doctype.input.file" value="src/org/springframework/web/servlet/tags/form/spring-form.tld"/>
<param name="doctype.scrubbed.file" value="${doc.ref.dir}/src/spring-form.tld"/>
</antcall>
<antcall target="private.tld.to.docbook">
<param name="input.tld" value="spring-form.tld"/>
<param name="input.tld.file" value="${doc.ref.dir}/src/spring-form.tld"/>
</antcall>
</target>
<target name="private.tld.to.docbook" if="input.tld">
<property name="out.file" value="${doc.ref.dir}/src/${input.tld}.xml"/>
<xslt processor="trax" in="${input.tld.file}" out="${out.file}"
style="${doc.ref.dir}/styles/tld.to.docbook.xsl">
<param name="title" expression="${input.tld}"/>
</xslt>
<antcall target="hack.CDATA">
<param name="target.file" value="${out.file}"/>
</antcall>
<delete file="${input.tld.file}"/>
</target>
<target name="hack.CDATA" if="target.file">
<replace file="${target.file}">
<replacetoken><![CDATA[&lt;]]></replacetoken>
<replacevalue><![CDATA[<]]></replacevalue>
</replace>
<replace file="${target.file}">
<replacetoken><![CDATA[&gt;]]></replacetoken>
<replacevalue><![CDATA[>]]></replacevalue>
</replace>
</target>
<target name="hack.DOCTYPE" if="doctype.input.file">
<!- -
Removes the TLD DTD decl. from the TLD files as this messes
up the transform (feel free to fix this more elegantly)
- ->
<copy file="${doctype.input.file}" tofile="${doctype.scrubbed.file}" overwrite="true"/>
<replace file="${doctype.scrubbed.file}" value="">
<replacetoken><![CDATA[<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">]]></replacetoken>
</replace>
</target>
<!- - End of TLD => DocBook targets -->
<target name="doc.html" depends="doc.prepare"
description="Compile reference documentation to chunked html">
<mkdir dir="${dist.ref.dir}/html/images"/>
<copy todir="${dist.ref.dir}/html/images">
<fileset dir="${src.ref.dir}/images">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${dist.ref.dir}/html/" failonerror="false">
<fileset dir="${src.ref.dir}/styles/">
<include name="*.css"/>
<include name="*.js"/>
</fileset>
</copy>
<java classname="com.icl.saxon.StyleSheet" fork="true" dir="${dist.ref.dir}/html/">
<classpath>
<fileset dir="${lib.dir}/docbook">
<include name="**/*.jar"/>
</fileset>
</classpath>
<jvmarg value="-Xmx256M"/>
<jvmarg value="-XX:MaxPermSize=128m"/>
<arg value="${src.ref.dir}/src/index.xml"/>
<arg value="${src.ref.dir}/styles/html_chunk.xsl"/>
</java>
</target>
<target name="doc.htmlsingle" depends="doc.prepare" description="Compile reference documentation to single html">
<mkdir dir="${dist.ref.dir}/html_single/images"/>
<copy todir="${dist.ref.dir}/html_single/images">
<fileset dir="${src.ref.dir}/images">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${dist.ref.dir}/html_single/" file="${src.ref.dir}/styles/html.css" failonerror="false"/>
<java classname="com.icl.saxon.StyleSheet" fork="true" dir="${dist.ref.dir}">
<classpath>
<fileset dir="${lib.dir}/docbook">
<include name="**/*.jar"/>
</fileset>
</classpath>
<jvmarg value="-Xmx256M"/>
<jvmarg value="-XX:MaxPermSize=128m"/>
<arg value="-o"/>
<arg value="${dist.ref.dir}/html_single/index.html"/>
<arg value="${src.ref.dir}/src/index.xml"/>
<arg value="${src.ref.dir}/styles/html.xsl"/>
</java>
</target>
<target name="doc.all" depends="doc.html,doc.htmlsingle,doc.pdf" description="Generate reference documentation"/>
<!-- <name name="junit.check.warning" if="tests.failed">
<echo>
***********************************************************
* One or more unit tests failed!
* Check the reports located in ${test.docs.dir}
* for details...
***********************************************************
</echo>
</name>
<!- - ===================================================================
- quick-test-report - quickly generates test report documentation based
- on the xml test reports previously created during a junit task
- execution. (this does not run the task).
- =================================================================== - ->
<name name="test.report">
<echo message="Generating test reports..."/>
<junitreport todir="${test.docs.dir}">
<fileset dir=".">
<include name="**/TEST-*"/>
</fileset>
<report todir="${test.docs.dir}"/>
</junitreport>
</name>
<name name="unit.tests" depends="compile">
<echo message="Executing unit tests..."/>
<!- - Any properties files needed by test cases and/or Spring test case
configuration must be under the base root dir hierarchy so relative
file references may work properly. - ->
<copy toDir="${classes.dir}" preservelastmodified="true" file="${root.base.dir}/etc/log4j.properties"/>
<copy toDir="${classes.dir}" preservelastmodified="true" file="${root.base.dir}/db/build/gen/jdbc.properties"/>
<junit printsummary="withOutAndErr"
showoutput="true"
haltonfailure="no"
failureproperty="tests.failed"
errorproperty="tests.failed"
timeout="60000"
fork="yes">
<classpath refid="test.path"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<!- - allows us to generate web reports - ->
<batchtest fork="true" todir="${gen.dir}">
<fileset dir="${test.classes.dir}">
<include name="**/*Test.class"/>
<exclude name="**/*IntegrationTest.class"/>
<exclude name="**/*SystemTest.class"/>
<exclude name="**/*StressTest.class"/>
</fileset>
</batchtest>
</junit>
</name>
<name name="test" depends="dist">
<antcall name="template">
<param name="name" value="test"/>
</antcall>
</name> -->
<target name="src.zip" description="Create source ZIP (containing Java sources)">
<mkdir dir="${root.dist.dir}"/>
<delete file="${root.dist.dir}/${project.name}.src.zip"/>
<zip destfile="${root.dist.dir}/${project.name}.src.zip">
<path refid="all.src"/>
</zip>
</target>
<target name="makepom" depends="load-ivy" description="Use Ivy to generate a Maven 2 pom.xml file">
<ivy:makepom ivyfile="${root.base.dir}/ivy.xml" pomfile="${build.dir}/${project.name}.pom">
<mapping conf="runtime" scope="compile"/>
<mapping conf="runtime-web" scope="compile"/>
<mapping conf="test" scope="test"/>
</ivy:makepom>
</target>
<target name="release" depends="package,src.zip,makepom,javadoc,doc.all"
description="Create all artifacts for a Apache Ki release">
<property name="release.dir.name" value="${project.name}-${version}"/>
<property name="release.zip.name" value="${release.dir.name}.zip"/>
<property name="release.depzip.name" value="${release.dir.name}-with-dependencies.zip"/>
<copy todir="${root.dist.dir}">
<fileset dir="${root.base.dir}">
<type type="file"/>
<exclude name="**/build/**"/>
<exclude name="**/.svn/**"/>
<exclude name="**/out/**"/>
<exclude name="**/lib/**"/>
<exclude name="jsecurity.iml"/>
<exclude name="jsecurity.ipr"/>
<exclude name="jsecurity.iws"/>
<exclude name="changes.txt"/>
<exclude name="${release.dir.name}"/>
</fileset>
</copy>
<zip destfile="${build.dir}/${release.zip.name}"
basedir="${build.dir}"
includes="${release.dir.name}/**"
excludes="**/${release.zip.name},**/lib/**"/>
<!-- Our ivy config puts copies of jars under lib directory according to the multiple build
configuration targets. We don't want multiple copies in the dependency lib, because it would
make the download size larger. Instead, just include one copy of each: -->
<mkdir dir="${root.dist.dir}/lib"/>
<copy todir="${root.dist.dir}/lib" overwrite="true" flatten="true">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<exclude name="**/docbook/*.jar"/>
</fileset>
</copy>
<zip destfile="${build.dir}/${release.depzip.name}"
basedir="${build.dir}"
includes="${release.dir.name}/**"
excludes="**/${release.zip.name}, **/lib/docbook/docbook-dtd/**, **/lib/docbook/docbook-xsl/**, **/lib/docbook/*.jar"/>
<delete dir="${root.dist.dir}/lib"/>
</target>
<!-- ===================================================================
all - everything
=================================================================== -->
<target name="all" depends="release" description="Do everything"/>
</project>