Skip to content

Commit

Permalink
Correctly include all modules during build
Browse files Browse the repository at this point in the history
Motivation:

To ensure the release plugin works correctly we need to ensure all modules are included during build.

Modification:

- Include all modules
- Skip compilation and tests for native code when not supported but still include the module and build the jar

Result:

Build and release works again
  • Loading branch information
normanmaurer committed May 11, 2017
1 parent a093b89 commit 9e62c79
Show file tree
Hide file tree
Showing 6 changed files with 896 additions and 421 deletions.
137 changes: 117 additions & 20 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,126 @@
</properties>

<profiles>
<!-- If the uber profile is used it will automatically fetch the missing native jar from maven and add it to the all jar as well. -->
<profile>
<id>full</id>
<id>uber</id>
<repositories>
<repository>
<id>staged-releases</id>
<name>Staged Releases</name>
<url>https://oss.sonatype.org/service/local/repositories/${stagingRepositoryId}/content/</url>
</repository>
</repositories>

<dependencies>
<!-- Depend on all our native jars -->
<!-- As this is executed on either macOS or Linux we directly need to specify the classifier -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${project.version}</version>
<classifier>linux-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>

<!-- The linux profile will only include the native jar for epol to the all jar.
If you want to also include the native jar for kqueue use -Puber.
-->
<profile>
<id>linux</id>
<activation>
<os>
<family>linux</family>
</os>
</activation>
<dependencies>
<!-- All release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
<!-- The mac, openbsd and freebsd profile will only include the native jar for epol to the all jar.
If you want to also include the native jar for kqueue use -Puber.
-->
<profile>
<id>mac</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<dependencies>
<!-- All release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
<profile>
<id>freebsd</id>
<activation>
<os>
<family>unix</family>
<name>freebsd</name>
</os>
</activation>
<dependencies>
<!-- All release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
<profile>
<id>openbsd</id>
<activation>
<property>
<name>uber</name>
</property>
<os>
<family>unix</family>
<name>openbsd</name>
</os>
</activation>
<dependencies>
<!-- All release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>

<profile>
<id>full</id>
<!-- Only include in full profile as this will not work on Java9 yet -->
<!-- https://issues.apache.org/jira/browse/JXR-133 -->
<build>
Expand Down Expand Up @@ -332,22 +445,6 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${project.version}</version>
<classifier>linux-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>

<!-- Add optional dependencies explicitly to avoid Javadoc warnings and errors. -->
<dependency>
Expand Down
86 changes: 10 additions & 76 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,81 +138,6 @@
<maven.javadoc.failOnError>false</maven.javadoc.failOnError>
</properties>
</profile>
<profile>
<id>linux</id>
<activation>
<os>
<family>linux</family>
</os>
</activation>
<modules>
<module>transport-native-unix-common-tests</module>
<module>transport-native-unix-common</module>
<module>transport-native-epoll</module>
</modules>
</profile>
<profile>
<id>mac</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<modules>
<module>transport-native-unix-common-tests</module>
<module>transport-native-unix-common</module>
<module>transport-native-kqueue</module>
</modules>
</profile>
<profile>
<id>freebsd</id>
<activation>
<os>
<family>unix</family>
<name>freebsd</name>
</os>
</activation>
<modules>
<module>transport-native-unix-common-tests</module>
<module>transport-native-unix-common</module>
<module>transport-native-kqueue</module>
</modules>
</profile>
<profile>
<id>openbsd</id>
<activation>
<os>
<family>unix</family>
<name>openbsd</name>
</os>
</activation>
<modules>
<module>transport-native-unix-common-tests</module>
<module>transport-native-unix-common</module>
<module>transport-native-kqueue</module>
</modules>
</profile>
<!-- The uber artifacts depend on artifacts built from different platforms and will fail if these artifacts are not
available. Typically we only build the uber jars as part of the release process so the build sequencing
is controlled and can be sequenced correctly. For example we may do the following:

<from a linux machine>
$ mvn release
<after this completes log onto a MacOS machine, note fail-at-end, and -D to activate multiple profiles>
$ mvn release -fae -Duber
-->
<profile>
<id>uber</id>
<activation>
<property>
<name>uber</name>
</property>
</activation>
<modules>
<module>all</module>
<module>tarball</module>
</modules>
</profile>
<profile>
<!--
This profile exists because either ALPN or NPN can exits on the class path at once, but not both.
Expand Down Expand Up @@ -280,6 +205,7 @@
</properties>

<modules>
<module>all</module>
<module>dev-tools</module>
<module>common</module>
<module>buffer</module>
Expand All @@ -297,7 +223,12 @@
<module>codec-xml</module>
<module>resolver</module>
<module>resolver-dns</module>
<module>tarball</module>
<module>transport</module>
<module>transport-native-unix-common-tests</module>
<module>transport-native-unix-common</module>
<module>transport-native-epoll</module>
<module>transport-native-kqueue</module>
<module>transport-rxtx</module>
<module>transport-sctp</module>
<module>transport-udt</module>
Expand Down Expand Up @@ -988,13 +919,16 @@
<retryFailedDeploymentCount>10</retryFailedDeploymentCount>
</configuration>
</plugin>
<!-- After artifacts were deployed from linux and macos we need to execute the following for this module:
mvn -Psonatype-oss-release,full,uber clean package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DstagingRepositoryId=${netty-id} -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging
-->
<plugin>
<artifactId>maven-release-plugin</artifactId>
<!-- Downgrade to 2.4.1 if release fails -->
<version>2.5.3</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<arguments>-P restricted-release,sonatype-oss-release</arguments>
<arguments>-P restricted-release,sonatype-oss-release,full</arguments>
<autoVersionSubmodules>true</autoVersionSubmodules>
<allowTimestampedSnapshots>false</allowTimestampedSnapshots>
<tagNameFormat>netty-@{project.version}</tagNameFormat>
Expand Down
37 changes: 32 additions & 5 deletions tarball/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,40 @@
</build>

<profiles>
<!-- If the uber profile is used it will automatically fetch the missing native jar from maven and add it to the all jar as well. -->
<profile>
<id>uber</id>
<repositories>
<repository>
<id>staged-releases</id>
<name>Staged Releases</name>
<url>https://oss.sonatype.org/service/local/repositories/${stagingRepositoryId}/content/</url>
</repository>
</repositories>

<dependencies>
<!-- Depend on all our native jars -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${project.version}</version>
<classifier>linux-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>

<profile>
<id>full</id>
<activation>
<property>
<name>uber</name>
</property>
</activation>
<build>
<plugins>
<plugin>
Expand Down
Loading

0 comments on commit 9e62c79

Please sign in to comment.