<?xml version="1.0" encoding="iso-8859-1"?>
<!--

    Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Public License v. 2.0, which is available at
    http://www.eclipse.org/legal/epl-2.0.

    This Source Code may also be made available under the following Secondary
    Licenses when the conditions for such availability set forth in the
    Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
    version 2 with the GNU Classpath Exception, which is available at
    https://www.gnu.org/software/classpath/license.html.

    SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0

-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
			    http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
	<groupId>com.sun.mail</groupId>
	<artifactId>all</artifactId>
	<version>1.6.7</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sun.mail</groupId>
    <artifactId>javadoc</artifactId>
    <packaging>pom</packaging>
    <version>1.6.7</version>
    <name>Jakarta Mail API javadocs</name>
    <description>${project.name}</description>

    <build>
        <plugins>
	    <!--
		To allow us to generate aggregated javadocs that only include some
		classes in certain packages from certain modules, we need to copy the sources
		to another location and run javadoc against that set
		of the sources. This gets sources.
	    -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <!-- download the sources -->
                        <id>get-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.sun.mail</groupId>
                                    <artifactId>jakarta.mail</artifactId>
                                    <version>${mail.version}</version>
                                    <classifier>sources</classifier>
                                    <outputDirectory>
                                        ${project.build.directory}/javadoc-sources/jakarta.mail
                                    </outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.mail</groupId>
                                    <artifactId>dsn</artifactId>
                                    <version>${mail.version}</version>
                                    <classifier>sources</classifier>
                                    <outputDirectory>
                                        ${project.build.directory}/javadoc-sources/com.sun.mail.dsn
                                    </outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.sun.mail</groupId>
                                    <artifactId>gimap</artifactId>
                                    <version>${mail.version}</version>
                                    <classifier>sources</classifier>
                                    <outputDirectory>
                                        ${project.build.directory}/javadoc-sources/com.sun.mail.gimap
                                    </outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--
                We want to produce aggregated javadoc for multiple JPMS modules. To do that
                we have to pass 'module-source-path' to javadoc tool to make it module aware.
                While we can pass that option to javadoc through maven-javadoc-plugin
                using 'additionalOptions', the plugin also sets 'sourcepath' option,
                which is in conflict with 'module-source-path' (as of maven-javadoc-plugin:3.2.0).
                Ant task is used here to get around that limitation for the time being.
            -->
	    <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
		    <execution>
			<phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
			<configuration>
                            <target>
                                <replace file="${project.build.directory}/javadoc-sources/com.sun.mail.gimap/module-info.java"
                                         token="requires static com.sun.mail.imap;"
                                         value=""/>
                                <mkdir dir="${project.build.directory}/javadoc-ant"/>
                                <javadoc destdir="${project.build.directory}/site/apidocs"
                                         modulesourcepath="${project.build.directory}/javadoc-sources/"
                                         modulepath="${com.sun.activation:jakarta.activation:jar}"
                                         author="false"
                                         docfilessubdirs="true"
                                         failonerror="true"
                                         overview="${project.build.directory}/javadoc-sources/jakarta.mail/overview.html"
                                         serialwarn="true"
                                         source="11"
                                         splitindex="true"
                                         use="true"
                                         >
                                    <arg value="-J-Xmx256m" />
                                    <arg value="-Xdoclint:none" />
                                    <arg value="-notimestamp" />
                                    <arg value="-quiet" />
                                    <arg line="-windowtitle '${mail.javadoc.title}'" />
                                    <doctitle>${mail.javadoc.title}</doctitle>
                                    <bottom>${mail.javadoc.bottom}</bottom>
                                    <header>${mail.javadoc.impl.header}</header>
                                    <group title="Jakarta Mail API Packages" packages="jakarta.mail.*"/>
                                    <group title="Implementation-specific Packages" packages="com.sun.mail.*"/>

                                    <fileset dir="${project.build.directory}/javadoc-sources/jakarta.mail">
					<include name="javax/mail/**/*.java"/>
				    </fileset>
                                    <fileset dir="${project.build.directory}/javadoc-sources/jakarta.mail"
					includes="
			com/sun/mail/imap/IMAPFolder.java,
			com/sun/mail/imap/IMAPMessage.java,
			com/sun/mail/imap/IMAPStore.java,
			com/sun/mail/imap/IMAPSSLStore.java
			com/sun/mail/imap/ACL.java,
			com/sun/mail/imap/Rights.java,
			com/sun/mail/imap/Quota.java,
			com/sun/mail/imap/SortTerm.java,
			com/sun/mail/imap/ResyncData.java,
			com/sun/mail/imap/OlderTerm.java,
			com/sun/mail/imap/YoungerTerm.java,
			com/sun/mail/imap/MessageVanishedEvent.java,
			com/sun/mail/imap/ModifiedSinceTerm.java,
			com/sun/mail/imap/IdleManager.java,
			com/sun/mail/imap/ReferralException.java,
			com/sun/mail/pop3/POP3Store.java,
			com/sun/mail/pop3/POP3SSLStore.java,
			com/sun/mail/pop3/POP3Folder.java,
			com/sun/mail/pop3/POP3Message.java,
			com/sun/mail/smtp/SMTPMessage.java,
			com/sun/mail/smtp/SMTPAddressFailedException.java,
			com/sun/mail/smtp/SMTPAddressSucceededException.java,
			com/sun/mail/smtp/SMTPSendFailedException.java,
			com/sun/mail/smtp/SMTPSenderFailedException.java,
			com/sun/mail/smtp/SMTPTransport.java,
			com/sun/mail/smtp/SMTPSSLTransport.java,
			com/sun/mail/util/MailConnectException.java,
			com/sun/mail/util/MailSSLSocketFactory.java,
			com/sun/mail/util/ReadableMime.java,
			com/sun/mail/util/logging/*.java
					"/>
                                    <fileset dir="${project.build.directory}/javadoc-sources/com.sun.mail.dsn"
					includes="
			com/sun/mail/dsn/DeliveryStatus.java,
			com/sun/mail/dsn/DispositionNotification.java,
			com/sun/mail/dsn/MessageHeaders.java,
			com/sun/mail/dsn/MultipartReport.java,
			com/sun/mail/dsn/Report.java
					"/>
                                    <fileset dir="${project.build.directory}/javadoc-sources/com.sun.mail.gimap"
					includes="
			com/sun/mail/gimap/*.java
					"/>
                                </javadoc>
                            </target>
			</configuration>
		    </execution>
                </executions>
	    </plugin>
	</plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>jakarta.mail</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>dsn</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>gimap</artifactId>
        </dependency>
    </dependencies>
</project>
