diff --git a/build.gradle b/build.gradle index 83270f4c5b..cd53ab32f3 100644 --- a/build.gradle +++ b/build.gradle @@ -252,8 +252,32 @@ configure(rootProject) { project -> compile "io.netty:netty-handler:${nettyVersion}" compile "io.netty:netty-codec-http:${nettyVersion}" - compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64" - optional "io.netty:netty-transport-native-kqueue:${nettyVersion}" + + //transport resolution: typical build forces epoll but not kqueue transitively + //on the other hand, if we want to make transport-specific tests, we'll make all + // native optional at compile time and add correct native/nio to testRuntime + if (project.hasProperty("forceTransport")) { + //so that the main code compiles + optional "io.netty:netty-transport-native-epoll:${nettyVersion}" + optional "io.netty:netty-transport-native-kqueue:${nettyVersion}" + //now we explicitly add correctly qualified native, or do nothing if we want to test NIO + if (forceTransport == "native") { + if (osdetector.os == "osx") { + testRuntime "io.netty:netty-transport-native-kqueue:${nettyVersion}${os_suffix}" + } + else if (osdetector.os == "linux") { + testRuntime "io.netty:netty-transport-native-epoll:${nettyVersion}${os_suffix}" + } + } + else if (forceTransport != "nio") { + throw new InvalidUserDataException("invalid -PforceTranport option " + forceTransport + ", should be native|nio") + } + } + else { + //classic build to be distributed + compile "io.netty:netty-transport-native-epoll:${nettyVersion}:linux-x86_64" + optional "io.netty:netty-transport-native-kqueue:${nettyVersion}" + } // Testing testCompile "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"