diff --git a/reactor-netty-core/build.gradle b/reactor-netty-core/build.gradle index 6b866ea5f..b690388ad 100644 --- a/reactor-netty-core/build.gradle +++ b/reactor-netty-core/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2025 VMware, Inc. or its affiliates, All Rights Reserved. + * Copyright (c) 2020-2026 VMware, Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,28 +84,28 @@ dependencies { //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 + compileOnly "io.netty:netty-transport-native-kqueue:$nettyVersion" + compileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion" + compileOnly "io.netty:netty-transport-native-io_uring:$nettyVersion" + testCompileOnly "io.netty:netty-transport-native-kqueue:$nettyVersion" + testCompileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion" + java11TestCompileOnly "io.netty:netty-transport-native-io_uring:$nettyVersion" if (project.hasProperty("forceTransport")) { //so that the main code compiles compileOnly "io.netty:netty-transport-native-epoll:$nettyVersion" - compileOnly "io.netty:netty-transport-native-kqueue:$nettyVersion" - compileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion" - compileOnly "io.netty:netty-transport-native-io_uring:$nettyVersion" - testImplementation "io.netty:netty-transport-native-epoll:$nettyVersion" - testImplementation "io.netty:netty-transport-native-kqueue:$nettyVersion" - testImplementation "io.netty:netty-transport-native-io_uring:$nettyVersion" - testImplementation "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion" + testCompileOnly "io.netty:netty-transport-native-epoll:$nettyVersion" //now we explicitly add correctly qualified native, or do nothing if we want to test NIO if (forceTransport == "native") { if (osdetector.os == "osx") { - testImplementation "io.netty:netty-transport-native-kqueue:$nettyVersion$os_suffix" + testRuntimeOnly "io.netty:netty-transport-native-kqueue:$nettyVersion$os_suffix" } else if (osdetector.os == "linux") { - testImplementation "io.netty:netty-transport-native-epoll:$nettyVersion$os_suffix" + testRuntimeOnly "io.netty:netty-transport-native-epoll:$nettyVersion$os_suffix" } } else if (forceTransport == "io_uring" && osdetector.os == "linux") { - testImplementation "io.netty:netty-transport-native-io_uring:$nettyVersion$os_suffix" - testImplementation "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion$os_suffix" + testRuntimeOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion$os_suffix" + java11TestRuntimeOnly "io.netty:netty-transport-native-io_uring:$nettyVersion$os_suffix" } else if (forceTransport != "nio") { throw new InvalidUserDataException("invalid -PforceTransport option " + forceTransport + ", should be native|nio|io_uring") @@ -114,12 +114,6 @@ dependencies { else { //classic build to be distributed api "io.netty:netty-transport-native-epoll:$nettyVersion:linux-x86_64" - compileOnly "io.netty:netty-transport-native-kqueue:$nettyVersion" - compileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion" - compileOnly "io.netty:netty-transport-native-io_uring:$nettyVersion" - testImplementation "io.netty:netty-transport-native-kqueue:$nettyVersion" - testImplementation "io.netty:netty-transport-native-io_uring:$nettyVersion" - testImplementation "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion" } //Metrics @@ -207,7 +201,11 @@ java17Test { jvmArgs = ["-XX:+AllowRedefinitionToAddDeleteMethods"] } java11Test { - classpath = sourceSets.main.output + sourceSets.test.runtimeClasspath + exclude '**/*NativeConfigTest*.*' + // Filter out incubator io_uring as java11 uses the new non-incubator version + classpath = classpath.filter { file -> + !(file.name.contains('io_uring') && file.name.contains('incubator')) + } + sourceSets.java11Test.runtimeClasspath } components.java.withVariantsFromConfiguration(configurations.testFixturesApiElements) { skip() } diff --git a/reactor-netty-core/src/test/java/reactor/netty/resources/DefaultLoopResourcesTest.java b/reactor-netty-core/src/test/java/reactor/netty/resources/DefaultLoopResourcesTest.java index 40cd13e2f..72b2f2f55 100644 --- a/reactor-netty-core/src/test/java/reactor/netty/resources/DefaultLoopResourcesTest.java +++ b/reactor-netty-core/src/test/java/reactor/netty/resources/DefaultLoopResourcesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2025 VMware, Inc. or its affiliates, All Rights Reserved. + * Copyright (c) 2017-2026 VMware, Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,9 +24,8 @@ import io.netty.channel.epoll.Epoll; import io.netty.channel.kqueue.KQueue; import io.netty.channel.nio.NioIoHandler; -import io.netty.channel.uring.IoUring; +import io.netty.incubator.channel.uring.IOUring; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.EnabledForJreRange; import org.junit.jupiter.api.condition.EnabledOnJre; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.JRE; @@ -210,22 +209,12 @@ void testEpollIsAvailable() { assertThat(Epoll.isAvailable()).isTrue(); } - @Test - @EnabledOnOs(OS.LINUX) - @EnabledForJreRange(min = JRE.JAVA_11) - void testIoUringIsAvailable() { - boolean isTransportIoUring = "io_uring".equals(System.getProperty("forceTransport")); - assumeThat(isTransportIoUring).isTrue(); - assertThat(IoUring.isAvailable()).isTrue(); - } - @Test @EnabledOnOs(OS.LINUX) @EnabledOnJre(JRE.JAVA_8) void testIoUringIncubatorIsAvailableOnJava8() { - boolean isTransportIoUring = "io_uring".equals(System.getProperty("forceTransport")); - assumeThat(isTransportIoUring).isTrue(); - assertThat(io.netty.incubator.channel.uring.IOUring.isAvailable()).isTrue(); + assumeThat(System.getProperty("forceTransport")).isEqualTo("io_uring"); + assertThat(IOUring.isAvailable()).isTrue(); } @Test diff --git a/reactor-netty-core/src/test/java11/reactor/netty/resources/LoopResourcesTest.java b/reactor-netty-core/src/test/java11/reactor/netty/resources/LoopResourcesTest.java new file mode 100644 index 000000000..4a09fb769 --- /dev/null +++ b/reactor-netty-core/src/test/java11/reactor/netty/resources/LoopResourcesTest.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2026 VMware, Inc. or its affiliates, All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package reactor.netty.resources; + +import io.netty.channel.uring.IoUring; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledOnOs; +import org.junit.jupiter.api.condition.OS; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assumptions.assumeThat; + +class LoopResourcesTest { + + @Test + @EnabledOnOs(OS.LINUX) + void testIoUringIsAvailable() { + assumeThat(System.getProperty("forceTransport")).isEqualTo("io_uring"); + assertThat(IoUring.isAvailable()).isTrue(); + } +} diff --git a/reactor-netty-http/build.gradle b/reactor-netty-http/build.gradle index 556f90c0a..519f55cb1 100644 --- a/reactor-netty-http/build.gradle +++ b/reactor-netty-http/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2025 VMware, Inc. or its affiliates, All Rights Reserved. + * Copyright (c) 2020-2026 VMware, Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,11 +89,6 @@ dependencies { //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 - compileOnly "io.netty:netty-transport-native-epoll:$nettyVersion" - compileOnly "io.netty:netty-transport-native-kqueue:$nettyVersion" - compileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion" - compileOnly "io.netty:netty-transport-native-io_uring:$nettyVersion" //now we explicitly add correctly qualified native, or do nothing if we want to test NIO if (forceTransport == "native") { if (osdetector.os == "osx") { @@ -113,9 +108,6 @@ dependencies { else { //classic build to be distributed api "io.netty:netty-transport-native-epoll:$nettyVersion:linux-x86_64" - compileOnly "io.netty:netty-transport-native-kqueue:$nettyVersion" - compileOnly "io.netty.incubator:netty-incubator-transport-native-io_uring:$nettyIoUringVersion" - compileOnly "io.netty:netty-transport-native-io_uring:$nettyVersion" } //Metrics