<?xml version="1.0" encoding="iso-8859-1"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
GPL Classpath Exception:
Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the GPL Version 2 section of the License
file that accompanied this code.
Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"
Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
-->
<!DOCTYPE project [
<!ENTITY commonBuild SYSTEM "ant-common.xml">
]>
<!--
NOTE: JavaMail is now built using Maven:
This ant build file is obsolete and may not work.
-->
<project name="JavaMail" default="all" basedir=".">
<!-- ========== Initialize Properties =================================== -->
<!--
component.name: required property. the value should be the
name of the component directory
-->
<property file="/build.properties"/>
&commonBuild;
<!-- all -->
<target name="all" depends="compile, assemble"
description="Build entire component">
</target>
<!-- build -->
<target name="build" depends="compile, assemble"
description="Build entire component">
</target>
<!-- init. Initialization involves creating publishing directories and
OS specific targets. -->
<tstamp>
</tstamp>
<echo message="Building component ${component.name}"/>
<mkdir dir="${component.classes.dir}"/>
</target>
<!-- compile -->
<target name="compile" depends="init"
description="Compile JavaMail sources">
<copy file="${resources.dir}/javax/mail/Version.java"
toFile="${src.dir}/javax/mail/Version.java">
<filterset begintoken="$${" endtoken="}">
</filterset>
</copy>
<javac srcdir="${src.dir}"
destdir="${component.classes.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${activation.jar}"/>
</classpath>
</javac>
</target>
<!-- prepare manifest files for jars -->
<target name="cook-manifest" depends="init"
description="Generate MANIFEST.MF files">
<!--
Could make this simpler with ant-contrib foreach task...
<foreach list=",imap.,pop3.,smtp.,dsn." target="cook-manifest-file"
param="mf"/>
-->
<mkdir dir="${component.classes.dir}/manifest"/>
<copy file="${resources.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.imap.dir}/manifest"/>
<copy file="${resources.imap.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.imap.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.pop3.dir}/manifest"/>
<copy file="${resources.pop3.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.pop3.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.smtp.dir}/manifest"/>
<copy file="${resources.smtp.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.smtp.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.dsn.dir}/manifest"/>
<copy file="${resources.dsn.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.dsn.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
</filterset>
</copy>
<mkdir dir="${component.classes.gimap.dir}/manifest"/>
<copy file="${resources.gimap.dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.gimap.dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
</filterset>
</copy>
</target>
<!--
This could be used with foreach, above.
XXX - do nested variable references work?
<target name="cook-manifest-file">
<mkdir dir="${component.classes.${mf}dir}/manifest"/>
<copy file="${resources.${mf}dir}/META-INF/MANIFEST.MF"
tofile="${component.classes.${mf}dir}/manifest/MANIFEST.MF">
<filterset begintoken="{" endtoken="}">
<filter token="mail.spec.version"
value="${release.specversion}"/>
<filter token="mail.version" value="${release.version}"/>
</filterset>
</copy>
</target>
-->
<!-- gimap compile -->
<target name="gimapcompile" depends="init"
<mkdir dir="${component.classes.gimap.dir}"/>
<javac srcdir="${src.gimap.dir}"
destdir="${component.classes.gimap.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
</javac>
</target>
<!-- dsn compile -->
<target name="dsncompile" depends="init"
<mkdir dir="${component.classes.dsn.dir}"/>
<javac srcdir="${src.dsn.dir}"
destdir="${component.classes.dsn.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
</javac>
</target>
<!-- demo compile -->
<target name="democompile" depends="init"
description="Compile demo sources">
<mkdir dir="${component.classes.demo.dir}"/>
<javac srcdir="${src.demo.dir}"
destdir="${component.classes.demo.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="*"/>
</javac>
<mkdir dir="${component.classes.client.dir}"/>
<javac srcdir="${src.client.dir}"
destdir="${component.classes.client.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="*"/>
</javac>
<mkdir dir="${component.classes.servlet.dir}"/>
<javac srcdir="${src.servlet.dir}"
destdir="${component.classes.servlet.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${activation.jar}"/>
<pathelement location="${javaee.jar}"/>
</classpath>
<include name="*"/>
</javac>
<mkdir dir="${component.classes.logging.dir}"/>
<javac srcdir="${src.logging.dir}"
destdir="${component.classes.logging.dir}"
debug="${javac.debug}"
optimize="${javac.optimize}"
source="${javac.source}"
deprecation="${javac.deprecation}"
failonerror="true"
target="${javac.target}"
includeantruntime="false">
<classpath>
<pathelement location="${component.classes.dir}"/>
<pathelement location="${component.classes.demo.dir}"/>
<pathelement location="${activation.jar}"/>
</classpath>
<include name="*"/>
</javac>
<!-- XXX - still need to add rules to build webapp -->
</target>
<!-- assemble -->
<target name="assemble" depends="jar"/>
<target name="clean" description="Clean the build">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${component.classes.dir}"/>
<fileset dir="${component.classes.dsn.dir}"/>
<fileset dir="${component.classes.gimap.dir}"/>
<fileset dir="${component.classes.demo.dir}"/>
<fileset dir="${component.classes.client.dir}"/>
<fileset dir="${component.classes.servlet.dir}"/>
<fileset dir="${component.classes.logging.dir}"/>
</delete>
</target>
<target name="clobber" description="Clobber all derived files">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="target"/>
</delete>
</target>
<!-- JavaMail bundle build targets -->
<target name="release" depends="init, jars, democompile, docs">
<!-- XXX - need to replace "." with "_" in release.version -->
<property name="zipname" value="${rel}.zip"/>
<delete file="${basedir}/target/${zipname}"/>
<echo message="Creating JavaMail bundle ${basedir}/target/${zipname}"/>
<zip destfile="${basedir}/target/${zipname}">
excludes="**/internal/**"/>
<zipfileset dir="${src.servlet.dir}"
excludes="src/**,pom.xml"/>
<zipfileset dir="${src.webapp.dir}"
<zipfileset dir="${docroot.webapp.dir}"
<zipfileset dir="${src.taglib.dir}"
<zipfileset dir="${resources.taglib.dir}"
<zipfileset dir="${src.logging.dir}"
</zip>
</target>
<!-- Build all jars needed for release -->
<target name="jars"
depends="jar, mailapijar, pop3jar, imapjar, smtpjar, gimapjar, dsnjar"/>
<!-- Assemble mail.jar -->
<target name="jar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}"/>
<jar jarfile="${release.mail.jar}"
manifest="${component.classes.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.dir}/META-INF"
includes="javamail.charset.map,javamail.default.*,mailcap"/>
<fileset dir="${component.classes.dir}">
</fileset>
</jar>
</target>
<!-- Create zip file of source code to publish to maven repo -->
<target name="src">
<zip file="target/mail.src.zip">
<fileset dir="${src.dir}">
</fileset>
</zip>
</target>
<target name="imapjar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.imap.jar}"
manifest="${component.classes.imap.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.imap.dir}/META-INF"
includes="javamail.providers"/>
<fileset dir="${component.classes.dir}">
</fileset>
</jar>
</target>
<target name="pop3jar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.pop3.jar}"
manifest="${component.classes.pop3.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.pop3.dir}/META-INF"
includes="javamail.providers"/>
<fileset dir="${component.classes.dir}">
</fileset>
</jar>
</target>
<target name="smtpjar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.smtp.jar}"
manifest="${component.classes.smtp.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.smtp.dir}/META-INF"
includes="javamail.providers,javamail.address.map"/>
<fileset dir="${component.classes.dir}">
</fileset>
</jar>
</target>
<target name="gimapjar" depends="init, gimapcompile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.gimap.jar}"
manifest="${component.classes.gimap.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.gimap.dir}/META-INF"
includes="mailcap"/>
<fileset dir="${component.classes.gimap.dir}">
</fileset>
</jar>
</target>
<target name="dsnjar" depends="init, dsncompile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.dsn.jar}"
manifest="${component.classes.dsn.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.dsn.dir}/META-INF"
includes="mailcap"/>
<fileset dir="${component.classes.dsn.dir}">
</fileset>
</jar>
</target>
<target name="mailapijar" depends="init, compile, cook-manifest">
<mkdir dir="${release.dir}/lib"/>
<jar jarfile="${release.mailapi.jar}"
manifest="${component.classes.dir}/manifest/MANIFEST.MF">
<metainf dir="${resources.legal.dir}/META-INF"
includes="LICENSE.txt"/>
<metainf dir="${resources.dir}/META-INF"
includes="javamail.charset.map, mailcap"/>
<fileset dir="${component.classes.dir}">
</fileset>
</jar>
</target>
<!-- javadocs -->
<target name="docs" depends="init, jar, jar">
<copy todir="${release.dir}">
</copy>
<mkdir dir="${release.docs.dir}"/>
<copy todir="${release.docs.dir}">
</copy>
<!--
To allow us to generate javadocs that only include some
classes in certain packages, we need to copy the sources
to another location and run javadoc against that subset
of the sources.
-->
<copy todir="${release.dir}/javadoc">
<fileset dir="${src.dir}">
<include name="**/*.html"/>
</fileset>
<fileset dir="${src.dir}"
includes="
"/>
<fileset dir="${src.dsn.dir}"
includes="
"/>
<fileset dir="${src.dsn.dir}"
includes="
"/>
</copy>
<mkdir dir="${release.javadocs.dir}"/>
<javadoc packagenames="javax.mail, javax.mail.internet,
destdir="${release.javadocs.dir}"
sourcepath="${release.dir}/javadoc"
classpath="${activation.jar}:${release.mail.jar}:${release.dsn.jar}:${release.gimap.jar}"
author="false"
version="false"
use="true"
overview="${release.dir}/javadoc/overview.html"
windowtitle="JavaMail API documentation"
doctitle="JavaMail API documentation">
<group title="JavaMail API Packages" packages="javax.*"/>
<bottom>
<![CDATA[Copyright © 1996-2013,
<a href="http://www.oracle.com">Oracle</a>
Use is subject to
<a href="{@docRoot}/doc-files/speclicense.html" target="_top">license terms<
/a>.
]]>
</bottom>
<!-- following can really slow down javadoc generation
<link href="${javase.url}"/>
<link href="${jaf.url}"/>
-->
</javadoc>
</target>
<target name="push-to-maven-prepare" depends="-push-to-maven-init, jar, src"
description="creates an image for the 'push-to-maven' goal">
<maven-repository-importer
destdir="target/maven-repo" version="${release.version}">
srczip="target/mail.src.zip" />
</maven-repository-importer>
</target>
<target name="push-to-maven" depends="push-to-maven-prepare"
description="pushes jars to the java.net maven repository">
</target>
</project>