Skip to content

Commit

Permalink
Move the build to require JDK 11
Browse files Browse the repository at this point in the history
-update build plugins (allows building on Java SE 15),
-resurrect building temporarily excluded parts (#473),
-fix content of provider implementation files (#493)
-define missing JPMS descriptors and fix existing ones,
  move away from Automatic-Module-Name in manifests
-include JPMS descriptors in final jar filess

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Jan 14, 2021
1 parent 7b11d2f commit b497ec0
Show file tree
Hide file tree
Showing 22 changed files with 477 additions and 514 deletions.
2 changes: 2 additions & 0 deletions doc/release/CHANGES.txt
Expand Up @@ -25,6 +25,8 @@ longer available.
The following bugs have been fixed in the 2.0.1 release.

E 456 MimeMessage.setFrom(null) fails instead of removing the header
E 473 Several modules are not included in build when JDK11 is used
E 493 javamail.providers file missing from provider jars after 1.6.5


CHANGES IN THE 2.0.0 RELEASE
Expand Down
2 changes: 0 additions & 2 deletions dsn/pom.xml
Expand Up @@ -70,9 +70,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
<optional>true</optional>
</dependency>
</dependencies>

Expand Down
21 changes: 21 additions & 0 deletions dsn/src/main/java/module-info.java
@@ -0,0 +1,21 @@
/*
* Copyright (c) 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
*/

module com.sun.mail.dsn {
exports com.sun.mail.dsn;

requires transitive jakarta.mail;
}
6 changes: 2 additions & 4 deletions gimap/pom.xml
Expand Up @@ -64,9 +64,8 @@
<dependencies>
<!--
Even though gimap.jar works with either the full jakarta.mail.jar
or th mailapi.jar, we need to get the API definitions from
mailapi.jar because it includes a module-info.class, which
allows this to compile under JDK 11+.
or th mailapi.jar, we want to get the API definitions from
mailapi.jar.
-->
<dependency>
<groupId>com.sun.mail</groupId>
Expand All @@ -75,7 +74,6 @@
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>imap</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

Expand Down
16 changes: 11 additions & 5 deletions gimap/src/main/java/module-info.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
Expand All @@ -21,8 +21,14 @@
com.sun.mail.gimap.GmailProvider, com.sun.mail.gimap.GmailSSLProvider;

requires jakarta.mail;
requires jakarta.activation;
requires java.logging;
requires java.security.sasl;
requires com.sun.mail.imap;
/*
following is intentionally optional/static for gimap module to work
with com.sun.mail:jakarta.mail (all-in-one bundle jar)
as well as with com.sun.mail:mailapi + com.sun.mail:imap
the latter deps come through maven dependency tree, therefore
they must be explicitely excluded if the former is being used
to avoid having two jars having same 'jakarta.mail' module name
in the environement
*/
requires static com.sun.mail.imap;
}
15 changes: 0 additions & 15 deletions imap/pom.xml
Expand Up @@ -42,19 +42,4 @@
</mail.packages.export>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<skipMain>false</skipMain>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
7 changes: 2 additions & 5 deletions imap/src/main/java/module-info.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
Expand All @@ -21,8 +21,5 @@
provides jakarta.mail.Provider with
com.sun.mail.imap.IMAPProvider, com.sun.mail.imap.IMAPSSLProvider;

requires jakarta.mail;
requires jakarta.activation;
requires java.logging;
requires java.security.sasl;
requires transitive jakarta.mail;
}
178 changes: 92 additions & 86 deletions javadoc/pom.xml
Expand Up @@ -37,28 +37,105 @@
<build>
<plugins>
<!--
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. This ant task does the copy.
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>
<inherited>false</inherited>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<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.*"/>

<copy todir="target/javadoc">
<fileset dir="../mail/src/main/java">
<include name="**/*.html"/>
<fileset dir="${project.build.directory}/javadoc-sources/jakarta.mail">
<include name="jakarta/mail/**"/>
</fileset>
<fileset dir="../mail/src/main/java"
<fileset dir="${project.build.directory}/javadoc-sources/jakarta.mail"
includes="
com/sun/mail/imap/package.html,
com/sun/mail/imap/IMAPFolder.java,
com/sun/mail/imap/IMAPMessage.java,
com/sun/mail/imap/IMAPStore.java,
Expand Down Expand Up @@ -90,91 +167,20 @@
com/sun/mail/util/ReadableMime.java,
com/sun/mail/util/logging/*.java
"/>
<fileset dir="../dsn/src/main/java"
<fileset dir="${project.build.directory}/javadoc-sources/com.sun.mail.dsn"
includes="
com/sun/mail/dsn/package.html,
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="../gimap/src/main/java"
<fileset dir="${project.build.directory}/javadoc-sources/com.sun.mail.gimap"
includes="
com/sun/mail/gimap/package.html,
com/sun/mail/gimap/*.java
"/>
</copy>

</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>javadoc</goal>
</goals>
<configuration>
<additionalJOption>-J-Xmx256m</additionalJOption>
<author>false</author>
<description>
Jakarta Mail API documentation
</description>
<doctitle>
Jakarta Mail API documentation
</doctitle>
<windowtitle>
Jakarta Mail API documentation
</windowtitle>
<splitindex>true</splitindex>
<use>true</use>
<notimestamp>true</notimestamp>
<serialwarn>true</serialwarn>
<quiet>true</quiet>
<overview>
${basedir}/target/javadoc/overview.html
</overview>
<bottom>
<![CDATA[Copyright &#169; 2019, 2020 Eclipse Foundation.
Use is subject to
<a href="{@docRoot}/doc-files/speclicense.html" target="_top">license terms</a>.
]]>
</bottom>
<groups>
<group>
<title>Jakarta Mail API Packages</title>
<packages>jakarta.*</packages>
</group>
<group>
<title>Implementation-specific Packages</title>
<packages>com.sun.*</packages>
</group>
</groups>
<!--
Force javadoc to produce non-module docs
since the module definition isn't part of
the API specification.
-->
<source>8</source>
<sourceFileExcludes>
<sourceFileExclude>module-info.java</sourceFileExclude>
<sourceFileExclude>com/sun/mail/imap/protocol/**</sourceFileExclude>
<sourceFileExclude>com/sun/mail/gimap/protocol/**</sourceFileExclude>
</sourceFileExcludes>
<!-- force the doc-files directory to be copied -->
<docfilessubdirs>true</docfilessubdirs>
<detectJavaApiLink>false</detectJavaApiLink>
<sourcepath>${basedir}/target/javadoc</sourcepath>
</javadoc>
</target>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit b497ec0

Please sign in to comment.