From 027aec23b839f00639f30641e08c95700cc9b9a5 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Sat, 7 Sep 2019 22:32:15 +0200 Subject: [PATCH] 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 --- .../java/io/netty/handler/ssl/Conscrypt.java | 14 ++++++++++++- pom.xml | 20 +++++++++++++++++-- testsuite-shading/pom.xml | 15 ++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/handler/src/main/java/io/netty/handler/ssl/Conscrypt.java b/handler/src/main/java/io/netty/handler/ssl/Conscrypt.java index 77786737c4..2ab51a9dcf 100644 --- a/handler/src/main/java/io/netty/handler/ssl/Conscrypt.java +++ b/handler/src/main/java/io/netty/handler/ssl/Conscrypt.java @@ -26,6 +26,7 @@ final class Conscrypt { // This class exists to avoid loading other conscrypt related classes using features only available in JDK8+, // because we need to maintain JDK6+ runtime compatibility. private static final Method IS_CONSCRYPT_SSLENGINE = loadIsConscryptEngine(); + private static final boolean CAN_INSTANCE_PROVIDER = canInstanceProvider(); private static Method loadIsConscryptEngine() { 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. */ static boolean isAvailable() { - return IS_CONSCRYPT_SSLENGINE != null; + return CAN_INSTANCE_PROVIDER && IS_CONSCRYPT_SSLENGINE != null; } static boolean isEngineSupported(SSLEngine engine) { diff --git a/pom.xml b/pom.xml index 7c51aa36dc..44e5560f28 100644 --- a/pom.xml +++ b/pom.xml @@ -68,6 +68,21 @@ + + not_x86_64 + + + os.detected.arch + !x86_64 + + + + + + true + + + graal @@ -315,6 +330,7 @@ 19.0.0 true + false @@ -733,10 +749,10 @@ - x86_64/AARCH64 JDK must be used. + x86_64/AARCH64/PPCLE64 JDK must be used. os.detected.arch - ^(x86_64|aarch_64)$ + ^(x86_64|aarch_64|ppcle_64)$ diff --git a/testsuite-shading/pom.xml b/testsuite-shading/pom.xml index 1912e4de1a..5a862fffcb 100644 --- a/testsuite-shading/pom.xml +++ b/testsuite-shading/pom.xml @@ -66,6 +66,17 @@ + + skipTests + + + skipTests + + + + true + + windows @@ -193,6 +204,7 @@ run + ${skipShadingTestsuite} @@ -222,6 +234,7 @@ org.apache.maven.plugins maven-failsafe-plugin + ${skipShadingTestsuite} ${shadingPrefix} ${shadingPrefix2} @@ -337,6 +350,7 @@ run + ${skipShadingTestsuite} @@ -366,6 +380,7 @@ org.apache.maven.plugins maven-failsafe-plugin + ${skipShadingTestsuite} ${shadingPrefix} ${shadingPrefix2}