blob: acbb09a3b52548ef539c3d6e27d448c6e590fc8a [file] [log] [blame]
<?xml version="1.0"?>
<!--
==========================================================================
jSieve build file
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='jsieve-master' default="main" basedir=".">
<macrodef name='Usage'>
<sequential>
<echo message="" />
<echo message="" />
<echo message="Apache JSieve" />
<exec executable="ant" dir="${basedir}">
<arg value="-projecthelp"/>
</exec>
</sequential>
</macrodef>
<macrodef name='CheckMailConditions'>
<sequential>
<available classname="javax.mail.Message" property="is.available.javamail" classpathref="project.test.class.path" />
<available classname="javax.activation.MimeType" property="is.available.activation" classpathref="project.test.class.path" />
<condition property="is.available.libs.test">
<and>
<isset property='is.available.javamail' />
<isset property='is.available.activation' />
</and>
</condition>
</sequential>
</macrodef>
<macrodef name='RunTests'>
<sequential>
<echo message="Running tests" />
<mkdir dir="${build.dir}/reports" />
<junit printsummary="yes" haltonfailure="yes" filtertrace="on">
<!-- Uncomment this to remotely debug the tests
<jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"/>
-->
<classpath id="junit.class.path">
<pathelement path="${java.class.path}" />
<pathelement path='${build.classes.test}'/>
<path refid='project.test.class.path' />
</classpath>
<formatter type="plain" />
<batchtest fork="yes" todir="${build.dir}/reports">
<fileset dir="${build.classes.test}">
<include name="**/*Test.class" />
</fileset>
</batchtest>
</junit>
</sequential>
</macrodef>
<macrodef name='Clean'>
<sequential>
<echo message="deleting working directories ready for a clean build" />
<delete dir='${build.dir}' />
<mkdir dir='${build.dir}' />
</sequential>
</macrodef>
<macrodef name='Jar'>
<attribute name='name'/>
<attribute name='prefix' default='-'/>
<sequential>
<mkdir dir="${build.lib}" />
<echo message="Making jSieve Jar (${name}@{prefix}@{name}-${version}.jar)" />
<jar jarfile="${build.lib}/${name}@{prefix}@{name}-${version}.jar" basedir="${build.classes}">
<include name="org/apache/jsieve/**" />
<include name="META-INF/**" />
<manifest>
<attribute name="Extension-Name" value='${extension.name}' />
<attribute name="Specification-Title" value='${title.spec}' />
<attribute name="Specification-Vendor" value='${vendor}' />
<attribute name="Specification-Version" value='${version.spec}' />
<attribute name="Implementation-Vendor-Id" value='${vendor.id}' />
<attribute name="Implementation-Title" value='${title.impl}' />
<attribute name="Implementation-Vendor" value='${vendor}' />
<attribute name="Implementation-Version" value='${version}' />
<attribute name="X-Compile-Source-JDK" value='${jdk.source}' />
<attribute name="X-Compile-Target-JDK" value='${jdk.target}' />
</manifest>
</jar>
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpath="${bnd.jar.relative}" />
<bndwrap jars='${build.lib}/${name}@{prefix}@{name}-${version}.jar' output='${build.lib}/${name}@{prefix}@{name}-${version}.jar' definitions="." />
<copy todir='${lib.jsieve.dir}' file='${build.lib}/${name}@{prefix}@{name}-${version}.jar' />
</sequential>
</macrodef>
<macrodef name='CompileTests'>
<sequential>
<fail unless="is.available.libs.test">JavaMail is required for testing</fail>
<echo message="Compiling jSieve test sources" />
<mkdir dir="${build.classes.test}" />
<javac destdir="${build.classes.test}" debug="${debug}" optimize="${optimize}" deprecation="${deprecation}" source="${jdk.source}" target="${jdk.target}">
<classpath refid="project.test.class.path" />
<src path="${test.dir}" />
<include name="org/apache/jsieve/**" />
</javac>
<copy todir="${build.classes}">
<fileset dir="${java.dir}">
<include name="**/*.properties" />
</fileset>
</copy>
<copy todir="${build.classes.test}">
<fileset dir="${testconf.dir}">
<include name="**/*.properties" />
</fileset>
</copy>
<copy file='LICENSE.apache' tofile="${build.classes}/META-INF/LICENSE.txt" />
<copy tofile="${build.classes}/META-INF/NOTICE.txt" file='NOTICE.base' />
</sequential>
</macrodef>
<macrodef name='CompileMain'>
<element name="src" implicit='true'/>
<sequential>
<echo message="Compiling JSieve sources" />
<mkdir dir="${build.classes}" />
<javac
destdir="${build.classes}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
source="${jdk.source}"
target="${jdk.target}">
<classpath refid="project.class.path" />
<src/>
<include name="org/apache/jsieve/**" />
</javac>
<copy todir="${build.classes}">
<fileset dir="${conf.dir}">
<include name="**/*.properties" />
</fileset>
</copy>
<copy file='LICENSE.apache' tofile="${build.classes}/META-INF/LICENSE.txt" />
<copy tofile="${build.classes}/META-INF/NOTICE.txt" file='NOTICE.base' />
</sequential>
</macrodef>
<macrodef name='forall' description='Executes a target for all modules'>
<attribute name='do' />
<attribute name='dir' default='.' />
<sequential>
<subant target='@{do}'>
<fileset dir='@{dir}' includes='main/build.xml' />
<fileset dir='@{dir}' includes='util/build.xml' />
<fileset dir='@{dir}' includes='mailet/build.xml' />
</subant>
</sequential>
</macrodef>
<target name='clean' description=' - cleans modules [multimodule]'>
<forall do='clean' />
</target>
<target name='main' description=' - builds modules [multimodule]'>
<echo>Note that Maven is used for the releases</echo>
<forall do='main' />
</target>
</project>