Use maven plugin to prevent API/ABI breakage as part of build process (#8904)

Motivation:

Netty is very widely used which can lead to a lot of pain when we break API / ABI. We should make use japicmp-maven-plugin during the build to verify we do not introduce breakage by mistake.

Modifications:

- Add japicmp-maven-plugin to the build process
- Fix a method signature change in HttpProxyHandler that was flagged as a possible problem.

Result:

Ensure no API/ABI breakage accour between releases.
This commit is contained in:
Norman Maurer 2019-03-01 19:48:29 +01:00
parent 71d8d057e6
commit c6b372f517
11 changed files with 48 additions and 3 deletions

View File

@ -31,6 +31,7 @@
<properties>
<generatedSourceDir>${project.build.directory}/src</generatedSourceDir>
<dependencyVersionsDir>${project.build.directory}/versions</dependencyVersionsDir>
<skipJapicmp>true</skipJapicmp>
</properties>
<profiles>

View File

@ -57,7 +57,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>netty-handler</artifactId>
<version>${project.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>

View File

@ -29,6 +29,9 @@
<name>Netty/Example</name>
<properties>
<skipJapicmp>true</skipJapicmp>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>

View File

@ -171,7 +171,7 @@ public final class HttpProxyHandler extends ProxyHandler {
}
@Override
protected boolean handleResponse(ChannelHandlerContext ctx, Object response) throws HttpProxyConnectException {
protected boolean handleResponse(ChannelHandlerContext ctx, Object response) throws Exception {
if (response instanceof HttpResponse) {
if (status != null) {
throw new HttpProxyConnectException(exceptionMessage("too many responses"), /*headers=*/ null);

View File

@ -38,8 +38,8 @@
<!-- This only be set when run on mac as on other platforms we just want to include the jar without native
code -->
<kqueue.classifier />
<skipJapicmp>true</skipJapicmp>
</properties>
<profiles>
<profile>
<id>linux</id>

31
pom.xml
View File

@ -283,6 +283,8 @@
<skipOsgiTestsuite>false</skipOsgiTestsuite>
<skipAutobahnTestsuite>false</skipAutobahnTestsuite>
<skipHttp2Testsuite>false</skipHttp2Testsuite>
<!-- Skip for now as we have no version released yet of netty 5 -->
<skipJapicmp>true</skipJapicmp>
</properties>
<modules>
@ -650,6 +652,35 @@
</extensions>
<plugins>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<version>0.13.1</version>
<configuration>
<parameter>
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
<breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
<oldVersionPattern>\d+\.\d+\.\d+\.Final</oldVersionPattern>
<ignoreMissingClassesByRegularExpressions>
<!-- ignore everything which is not part of netty itself as the plugin can not handle optional dependencies -->
<ignoreMissingClassesByRegularExpression>^(?!io\.netty\.).*</ignoreMissingClassesByRegularExpression>
<ignoreMissingClassesByRegularExpression>^io\.netty\.internal\.tcnative\..*</ignoreMissingClassesByRegularExpression>
</ignoreMissingClassesByRegularExpressions>
<excludes>
<exclude>@io.netty.util.internal.UnstableApi</exclude>
</excludes>
</parameter>
<skip>${skipJapicmp}</skip>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>cmp</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${enforcer.plugin.version}</version>

View File

@ -28,6 +28,10 @@
<name>Netty/Testsuite/Autobahn</name>
<properties>
<skipJapicmp>true</skipJapicmp>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>

View File

@ -28,6 +28,10 @@
<name>Netty/Testsuite/Http2</name>
<properties>
<skipJapicmp>true</skipJapicmp>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>

View File

@ -31,6 +31,7 @@
<properties>
<exam.version>4.13.0</exam.version>
<argLine.java9.extras>--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED</argLine.java9.extras>
<skipJapicmp>true</skipJapicmp>
</properties>
<profiles>

View File

@ -38,6 +38,7 @@
<jarName>${project.artifactId}-${project.version}.jar</jarName>
<shadedPackagePrefix>io.netty.</shadedPackagePrefix>
<skipJapicmp>true</skipJapicmp>
</properties>
<build>

View File

@ -99,6 +99,7 @@
<properties>
<!-- Needed for SSL tests as these use the SelfSignedCertificate -->
<argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED</argLine.java9.extras>
<skipJapicmp>true</skipJapicmp>
</properties>
<build>