Adding stable JDK9 module names that follow reverse-DNS style

Automatic-Module-Name entry provides a stable JDK9 module name, when Netty is used in a modular JDK9 applications. More info: http://blog.joda.org/2017/05/java-se-9-jpms-automatic-modules.html

When Netty migrates to JDK9 in the future, the entry can be replaced by actual module-info descriptor.

Modification:

The POM-s are configured to put the correct module names to the manifest.

Result:

Fixes #7218.
This commit is contained in:
Tomasz Jędrzejewski 2017-09-23 08:52:39 +02:00 committed by Norman Maurer
parent 09a05b680d
commit e8540c2b7a
27 changed files with 124 additions and 1 deletions

View File

@ -24,3 +24,40 @@ Note that this is build-time requirement. JDK 5 (for 3.x) or 6 (for 4.0+) is en
## Branches to look ## Branches to look
Development of all versions takes place in each branch whose name is identical to `<majorVersion>.<minorVersion>`. For example, the development of 3.9 and 4.0 resides in [the branch '3.9'](https://github.com/netty/netty/tree/3.9) and [the branch '4.0'](https://github.com/netty/netty/tree/4.0) respectively. Development of all versions takes place in each branch whose name is identical to `<majorVersion>.<minorVersion>`. For example, the development of 3.9 and 4.0 resides in [the branch '3.9'](https://github.com/netty/netty/tree/3.9) and [the branch '4.0'](https://github.com/netty/netty/tree/4.0) respectively.
## Usage with JDK 9
Netty can be used in modular JDK9 applications as a collection of automatic modules. The module names follow the
reverse-DNS style, and are derived from subproject names rather than root packages due to historical reasons. They
are listed below:
* `io.netty.buffer`
* `io.netty.codec`
* `io.netty.codec.dns`
* `io.netty.codec.haproxy`
* `io.netty.codec.http`
* `io.netty.codec.http2`
* `io.netty.codec.memcache`
* `io.netty.codec.mqtt`
* `io.netty.codec.redis`
* `io.netty.codec.smtp`
* `io.netty.codec.socks`
* `io.netty.codec.stomp`
* `io.netty.codec.xml`
* `io.netty.common`
* `io.netty.handler`
* `io.netty.handler.proxy`
* `io.netty.resolver`
* `io.netty.resolver.dns`
* `io.netty.transport`
* `io.netty.transport.epoll` (`native` omitted - reserved keyword in Java)
* `io.netty.transport.kqueue` (`native` omitted - reserved keyword in Java)
* `io.netty.transport.unix.common` (`native` omitted - reserved keyword in Java)
* `io.netty.transport.rxtx`
* `io.netty.transport.sctp`
* `io.netty.transport.udt`
Automatic modules do not provide any means to declare dependencies, so you need to list each used module separately
in your `module-info` file.

View File

@ -28,6 +28,10 @@
<name>Netty/Buffer</name> <name>Netty/Buffer</name>
<properties>
<javaModuleName>io.netty.buffer</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/DNS</name> <name>Netty/Codec/DNS</name>
<properties>
<javaModuleName>io.netty.codec.dns</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/HAProxy</name> <name>Netty/Codec/HAProxy</name>
<properties>
<javaModuleName>io.netty.codec.haproxy</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/HTTP</name> <name>Netty/Codec/HTTP</name>
<properties>
<javaModuleName>io.netty.codec.http</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/HTTP2</name> <name>Netty/Codec/HTTP2</name>
<properties>
<javaModuleName>io.netty.codec.http2</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/Memcache</name> <name>Netty/Codec/Memcache</name>
<properties>
<javaModuleName>io.netty.codec.memcache</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/MQTT</name> <name>Netty/Codec/MQTT</name>
<properties>
<javaModuleName>io.netty.codec.mqtt</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/Redis</name> <name>Netty/Codec/Redis</name>
<properties>
<javaModuleName>io.netty.codec.redis</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/SMTP</name> <name>Netty/Codec/SMTP</name>
<properties>
<javaModuleName>io.netty.codec.smtp</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/Socks</name> <name>Netty/Codec/Socks</name>
<properties>
<javaModuleName>io.netty.codec.socks</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/Stomp</name> <name>Netty/Codec/Stomp</name>
<properties>
<javaModuleName>io.netty.codec.stomp</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec/XML</name> <name>Netty/Codec/XML</name>
<properties>
<javaModuleName>io.netty.codec.xml</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Codec</name> <name>Netty/Codec</name>
<properties>
<javaModuleName>io.netty.codec</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -30,6 +30,7 @@
<name>Netty/Common</name> <name>Netty/Common</name>
<properties> <properties>
<javaModuleName>io.netty.common</javaModuleName>
<collection.template.dir>${project.basedir}/src/main/templates</collection.template.dir> <collection.template.dir>${project.basedir}/src/main/templates</collection.template.dir>
<collection.template.test.dir>${project.basedir}/src/test/templates</collection.template.test.dir> <collection.template.test.dir>${project.basedir}/src/test/templates</collection.template.test.dir>
<collection.src.dir>${project.build.directory}/generated-sources/collections/java</collection.src.dir> <collection.src.dir>${project.build.directory}/generated-sources/collections/java</collection.src.dir>

View File

@ -27,6 +27,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<javaModuleName>io.netty.handler.proxy</javaModuleName>
<!-- Needed for SelfSignedCertificate --> <!-- Needed for SelfSignedCertificate -->
<argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED</argLine.java9.extras> <argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED</argLine.java9.extras>
</properties> </properties>

View File

@ -26,7 +26,8 @@
<artifactId>netty-handler</artifactId> <artifactId>netty-handler</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<javaModuleName>io.netty.handler</javaModuleName>
<!-- Needed for SelfSignedCertificate --> <!-- Needed for SelfSignedCertificate -->
<argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED</argLine.java9.extras> <argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED</argLine.java9.extras>
</properties> </properties>

View File

@ -1095,6 +1095,9 @@
<manifest> <manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest> </manifest>
<manifestEntries>
<Automatic-Module-Name>${javaModuleName}</Automatic-Module-Name>
</manifestEntries>
<index>true</index> <index>true</index>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive> </archive>

View File

@ -28,6 +28,10 @@
<name>Netty/Resolver/DNS</name> <name>Netty/Resolver/DNS</name>
<properties>
<javaModuleName>io.netty.resolver.dns</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Resolver</name> <name>Netty/Resolver</name>
<properties>
<javaModuleName>io.netty.resolver</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -27,6 +27,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<javaModuleName>io.netty.transport.epoll</javaModuleName>
<!-- Needed by the native transport as we need the memoryAddress of the ByteBuffer --> <!-- Needed by the native transport as we need the memoryAddress of the ByteBuffer -->
<argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED</argLine.java9.extras> <argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED</argLine.java9.extras>
<unix.common.lib.name>netty-unix-common</unix.common.lib.name> <unix.common.lib.name>netty-unix-common</unix.common.lib.name>

View File

@ -353,6 +353,7 @@
</profiles> </profiles>
<properties> <properties>
<javaModuleName>io.netty.transport.kqueue</javaModuleName>
<!-- Needed by the native transport as we need the memoryAddress of the ByteBuffer --> <!-- Needed by the native transport as we need the memoryAddress of the ByteBuffer -->
<argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED</argLine.java9.extras> <argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED</argLine.java9.extras>
<unix.common.lib.name>netty-unix-common</unix.common.lib.name> <unix.common.lib.name>netty-unix-common</unix.common.lib.name>

View File

@ -30,6 +30,8 @@
</description> </description>
<properties> <properties>
<javaModuleName>io.netty.transport.unix.common</javaModuleName>
<exe.make>make</exe.make> <exe.make>make</exe.make>
<exe.compiler>gcc</exe.compiler> <exe.compiler>gcc</exe.compiler>
<exe.archiver>ar</exe.archiver> <exe.archiver>ar</exe.archiver>

View File

@ -29,6 +29,10 @@
<name>Netty/Transport/RXTX</name> <name>Netty/Transport/RXTX</name>
<properties>
<javaModuleName>io.netty.transport.rxtx</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Transport/SCTP</name> <name>Netty/Transport/SCTP</name>
<properties>
<javaModuleName>io.netty.transport.sctp</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>

View File

@ -29,6 +29,10 @@
<name>Netty/Transport/UDT</name> <name>Netty/Transport/UDT</name>
<properties>
<javaModuleName>io.netty.transport.udt</javaModuleName>
</properties>
<dependencies> <dependencies>
<!-- MAIN --> <!-- MAIN -->

View File

@ -28,6 +28,10 @@
<name>Netty/Transport</name> <name>Netty/Transport</name>
<properties>
<javaModuleName>io.netty.transport</javaModuleName>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>