diff --git a/no-deps/pom.xml b/no-deps/pom.xml new file mode 100644 index 000000000..e25c57ec6 --- /dev/null +++ b/no-deps/pom.xml @@ -0,0 +1,145 @@ + + + 4.0.0 + + io.smallrye.reactive + mutiny-project + 999-SNAPSHOT + + + mutiny-no-deps + SmallRye Mutiny - Shaded library + Variant of Mutiny with shaded dependencies + + + true + + + + + io.smallrye.reactive + mutiny + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + + + + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + true + true + + + *:* + + module-info.class + META-INF/jandex.idx + META-INF/MANIFEST.MF + META-INF/maven/** + + + + org.jctools:jctools-core + + org/jctools/queues/atomic/unpadded/** + org/jctools/queues/MessagePassingQueue* + org/jctools/queues/IndexedQueueSizeUtil* + org/jctools/queues/QueueProgressIndicators* + org/jctools/queues/SupportsIterator* + org/jctools/queues/BaseLinkedQueue* + org/jctools/queues/LinkedQueueNode* + org/jctools/queues/atomic/AtomicQueueUtil* + org/jctools/queues/atomic/AtomicReferenceArrayQueue* + org/jctools/queues/atomic/SequencedAtomicReferenceArrayQueue* + org/jctools/queues/atomic/LinkedQueueAtomicNode* + org/jctools/util/SpscLookAheadUtil* + org/jctools/util/Pow2* + org/jctools/util/RangeUtil* + org/jctools/util/UnsafeAccess* + + + + + + + + + + + org.jctools + io.smallrye.mutiny.shaded.org.jctools + + + io.smallrye.common + io.smallrye.mutiny.shaded.io.smallrye.common + + + + + + package + + shade + + + + + + io.smallrye + jandex-maven-plugin + + ${project.build.directory}/${project.build.finalName}.jar + + io/smallrye/mutiny/**/*.class + + + io/smallrye/mutiny/shaded/**/*.class + + + + + package + + jandex-jar + + + + + + org.cyclonedx + cyclonedx-maven-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + + + integration-test + verify + + + + + + + + \ No newline at end of file diff --git a/no-deps/src/main/java/io/smallrye/mutiny/nodeps/Empty.java b/no-deps/src/main/java/io/smallrye/mutiny/nodeps/Empty.java new file mode 100644 index 000000000..0966c32e8 --- /dev/null +++ b/no-deps/src/main/java/io/smallrye/mutiny/nodeps/Empty.java @@ -0,0 +1,8 @@ +package io.smallrye.mutiny.nodeps; + +/** + * This is used as a placeholder to force the maven-javadoc-plugin to create a javadoc jar. + * Yes, you read it right :-) + */ +public interface Empty { +} diff --git a/no-deps/src/test/java/io/smallrye/mutiny/nodeps/ShadingIT.java b/no-deps/src/test/java/io/smallrye/mutiny/nodeps/ShadingIT.java new file mode 100644 index 000000000..b6eb890a1 --- /dev/null +++ b/no-deps/src/test/java/io/smallrye/mutiny/nodeps/ShadingIT.java @@ -0,0 +1,58 @@ +package io.smallrye.mutiny.nodeps; + +import static org.junit.jupiter.api.Assertions.*; + +import java.time.Duration; +import java.util.List; +import java.util.Queue; + +import org.junit.jupiter.api.Test; + +import io.smallrye.mutiny.Multi; +import io.smallrye.mutiny.helpers.queues.Queues; +import io.smallrye.mutiny.subscription.BackPressureStrategy; + +public class ShadingIT { + + @Test + public void check_class_relocation() throws ClassNotFoundException { + Class.forName("io.smallrye.mutiny.shaded.org.jctools.queues.BaseLinkedQueue"); + Class.forName("io.smallrye.mutiny.shaded.org.jctools.queues.atomic.unpadded.BaseLinkedAtomicUnpaddedQueue"); + Class.forName("io.smallrye.mutiny.shaded.io.smallrye.common.annotation.CheckReturnValue"); + } + + @Test + public void check_factories() { + List> queues = List.of( + Queues.createSpscArrayQueue(256), + Queues.createSpscUnboundedArrayQueue(256), + Queues.createSpscChunkedArrayQueue(256), + Queues.createMpscQueue(), + Queues.createSpscUnboundedQueue(256), + Queues.createMpscArrayQueue(256)); + + queues.forEach(queue -> { + queue.add("foo"); + queue.add("bar"); + assertEquals("foo", queue.poll()); + assertEquals("bar", queue.poll()); + assertNull(queue.poll()); + assertTrue(queue.getClass().getCanonicalName().contains("shaded")); + }); + } + + @Test + public void multi_emitter() { + Multi multi = Multi.createFrom().emitter(emitter -> { + for (int i = 0; i < 100; i++) { + emitter.emit(i); + } + emitter.complete(); + }, BackPressureStrategy.BUFFER); + + List suite = multi.collect().asList().await().atMost(Duration.ofSeconds(5)); + assertEquals(100, suite.size()); + assertEquals(0, suite.get(0)); + assertEquals(99, suite.get(99)); + } +} diff --git a/pom.xml b/pom.xml index 9c0933c91..24701196b 100644 --- a/pom.xml +++ b/pom.xml @@ -74,6 +74,7 @@ bom math workshop-examples + no-deps @@ -124,6 +125,8 @@ 1.1.0 1.14.0 2.8.1 + 3.5.3 + 3.2.5