Allow to build on powerpc

Motivation:

At the moment it is not possible to build netty on a power 8 systems.

Modifications:

- Improve detection of the possibility of using Conscrypt
- Skip testsuite-shading when not on x86_64 as this is the only platform for which we build tcnative atm
- Only include classifier if on x86_64 for tcnative as dependency as this is the only platform for which we build tcnative atm
- Better detect if UDT test can be run

Result:

Fixes https://github.com/netty/netty/issues/9479
This commit is contained in:
Norman Maurer 2019-09-07 22:32:15 +02:00
parent 19a12fba4c
commit 027aec23b8
3 changed files with 46 additions and 3 deletions

View File

@ -26,6 +26,7 @@ final class Conscrypt {
// This class exists to avoid loading other conscrypt related classes using features only available in JDK8+, // This class exists to avoid loading other conscrypt related classes using features only available in JDK8+,
// because we need to maintain JDK6+ runtime compatibility. // because we need to maintain JDK6+ runtime compatibility.
private static final Method IS_CONSCRYPT_SSLENGINE = loadIsConscryptEngine(); private static final Method IS_CONSCRYPT_SSLENGINE = loadIsConscryptEngine();
private static final boolean CAN_INSTANCE_PROVIDER = canInstanceProvider();
private static Method loadIsConscryptEngine() { private static Method loadIsConscryptEngine() {
try { try {
@ -38,11 +39,22 @@ final class Conscrypt {
} }
} }
private static boolean canInstanceProvider() {
try {
Class<?> providerClass = Class.forName("org.conscrypt.OpenSSLProvider", true,
ConscryptAlpnSslEngine.class.getClassLoader());
providerClass.newInstance();
return true;
} catch (Throwable ignore) {
return false;
}
}
/** /**
* Indicates whether or not conscrypt is available on the current system. * Indicates whether or not conscrypt is available on the current system.
*/ */
static boolean isAvailable() { static boolean isAvailable() {
return IS_CONSCRYPT_SSLENGINE != null; return CAN_INSTANCE_PROVIDER && IS_CONSCRYPT_SSLENGINE != null;
} }
static boolean isEngineSupported(SSLEngine engine) { static boolean isEngineSupported(SSLEngine engine) {

20
pom.xml
View File

@ -68,6 +68,21 @@
</developers> </developers>
<profiles> <profiles>
<profile>
<id>not_x86_64</id>
<activation>
<property>
<name>os.detected.arch</name>
<value>!x86_64</value>
</property>
</activation>
<properties>
<!-- Use no classifier as we only support x86_64 atm-->
<tcnative.classifier />
<skipShadingTestsuite>true</skipShadingTestsuite>
</properties>
</profile>
<!-- Detect if we use GraalVM and if so enable the native image testsuite --> <!-- Detect if we use GraalVM and if so enable the native image testsuite -->
<profile> <profile>
<id>graal</id> <id>graal</id>
@ -315,6 +330,7 @@
<graalvm.version>19.0.0</graalvm.version> <graalvm.version>19.0.0</graalvm.version>
<!-- By default skip native testsuite as it requires a custom environment with graalvm installed --> <!-- By default skip native testsuite as it requires a custom environment with graalvm installed -->
<skipNativeImageTestsuite>true</skipNativeImageTestsuite> <skipNativeImageTestsuite>true</skipNativeImageTestsuite>
<skipShadingTestsuite>false</skipShadingTestsuite>
</properties> </properties>
<modules> <modules>
@ -733,10 +749,10 @@
</requireMavenVersion> </requireMavenVersion>
<requireProperty> <requireProperty>
<regexMessage> <regexMessage>
x86_64/AARCH64 JDK must be used. x86_64/AARCH64/PPCLE64 JDK must be used.
</regexMessage> </regexMessage>
<property>os.detected.arch</property> <property>os.detected.arch</property>
<regex>^(x86_64|aarch_64)$</regex> <regex>^(x86_64|aarch_64|ppcle_64)$</regex>
</requireProperty> </requireProperty>
</rules> </rules>
</configuration> </configuration>

View File

@ -66,6 +66,17 @@
</dependency> </dependency>
</dependencies> </dependencies>
<profiles> <profiles>
<profile>
<id>skipTests</id>
<activation>
<property>
<name>skipTests</name>
</property>
</activation>
<properties>
<skipShadingTestsuite>true</skipShadingTestsuite>
</properties>
</profile>
<profile> <profile>
<id>windows</id> <id>windows</id>
<activation> <activation>
@ -193,6 +204,7 @@
<goal>run</goal> <goal>run</goal>
</goals> </goals>
<configuration> <configuration>
<skip>${skipShadingTestsuite}</skip>
<target> <target>
<unzip dest="${classesShadedDir}/"> <unzip dest="${classesShadedDir}/">
<fileset dir="${project.build.directory}/"> <fileset dir="${project.build.directory}/">
@ -222,6 +234,7 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<configuration> <configuration>
<skip>${skipShadingTestsuite}</skip>
<systemPropertyVariables> <systemPropertyVariables>
<shadingPrefix>${shadingPrefix}</shadingPrefix> <shadingPrefix>${shadingPrefix}</shadingPrefix>
<shadingPrefix2>${shadingPrefix2}</shadingPrefix2> <shadingPrefix2>${shadingPrefix2}</shadingPrefix2>
@ -337,6 +350,7 @@
<goal>run</goal> <goal>run</goal>
</goals> </goals>
<configuration> <configuration>
<skip>${skipShadingTestsuite}</skip>
<target> <target>
<unzip dest="${classesShadedDir}/"> <unzip dest="${classesShadedDir}/">
<fileset dir="${project.build.directory}/"> <fileset dir="${project.build.directory}/">
@ -366,6 +380,7 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId> <artifactId>maven-failsafe-plugin</artifactId>
<configuration> <configuration>
<skip>${skipShadingTestsuite}</skip>
<systemPropertyVariables> <systemPropertyVariables>
<shadingPrefix>${shadingPrefix}</shadingPrefix> <shadingPrefix>${shadingPrefix}</shadingPrefix>
<shadingPrefix2>${shadingPrefix2}</shadingPrefix2> <shadingPrefix2>${shadingPrefix2}</shadingPrefix2>