Skip to content

Commit

Permalink
Duplicating EndpointValidationPredicatesBuildItem for avoiding restea…
Browse files Browse the repository at this point in the history
…sy spi common module
  • Loading branch information
aureamunoz committed Dec 12, 2024
1 parent e870511 commit b54a4f2
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 68 deletions.
5 changes: 0 additions & 5 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3785,11 +3785,6 @@
<artifactId>quarkus-resteasy-common-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-common-deployment-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.reactivex.rxjava2</groupId>
<artifactId>rxjava</artifactId>
Expand Down
1 change: 0 additions & 1 deletion extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@

<!-- REST services -->
<module>resteasy-classic</module>
<module>resteasy-common</module>
<module>smallrye-openapi-common</module>
<module>smallrye-openapi</module>
<module>swagger-ui</module>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkus.resteasy.common.deployment;
package io.quarkus.resteasy.common.spi;

import java.util.function.Predicate;

Expand Down
27 changes: 0 additions & 27 deletions extensions/resteasy-common/deployment-spi/pom.xml

This file was deleted.

21 changes: 0 additions & 21 deletions extensions/resteasy-common/pom.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-spi-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-common-deployment-spi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-jaxrs</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
import io.quarkus.jaxrs.client.reactive.runtime.RestClientBase;
import io.quarkus.jaxrs.client.reactive.runtime.ToObjectArray;
import io.quarkus.jaxrs.client.reactive.runtime.impl.MultipartResponseDataBase;
import io.quarkus.resteasy.common.deployment.EndpointValidationPredicatesBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.ApplicationResultBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.EndpointValidationPredicatesBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.ParameterContainersBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.QuarkusFactoryCreator;
import io.quarkus.resteasy.reactive.common.deployment.QuarkusResteasyReactiveDotNames;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.quarkus.resteasy.reactive.common.deployment;

import java.util.function.Predicate;

import org.jboss.jandex.ClassInfo;

import io.quarkus.builder.item.MultiBuildItem;

/**
* A build item that provides a {@link Predicate} to detect and validate classes defining REST endpoints.
* <p>
* This can include resources in RESTEasy or controllers in the Spring ecosystem.
* It acts as a Service Provider Interface (SPI) to allow customization of the validation logic for endpoint detection,
* enabling integration with various frameworks or specific application needs.
* </p>
*
* <p>
* The {@link Predicate} evaluates {@link ClassInfo} instances to determine whether a class defines a REST endpoint
* according to the provided logic.
* </p>
*/
public final class EndpointValidationPredicatesBuildItem extends MultiBuildItem {

private final Predicate<ClassInfo> predicate;

public EndpointValidationPredicatesBuildItem(Predicate<ClassInfo> predicate) {
this.predicate = predicate;
}

public Predicate<ClassInfo> getPredicate() {
return predicate;
}
}
4 changes: 0 additions & 4 deletions extensions/resteasy-reactive/rest/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security-spi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-common-deployment-spi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jsonp-deployment</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@
import io.quarkus.gizmo.MethodCreator;
import io.quarkus.gizmo.MethodDescriptor;
import io.quarkus.netty.deployment.MinNettyAllocatorMaxOrderBuildItem;
import io.quarkus.resteasy.common.deployment.EndpointValidationPredicatesBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.AggregatedParameterContainersBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.ApplicationResultBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.EndpointValidationPredicatesBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.FactoryUtils;
import io.quarkus.resteasy.reactive.common.deployment.ParameterContainersBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.QuarkusFactoryCreator;
Expand Down
2 changes: 1 addition & 1 deletion extensions/spring-web/core/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-common-deployment-spi</artifactId>
<artifactId>quarkus-rest-common-deployment</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyIgnoreWarningBuildItem;
import io.quarkus.gizmo.ClassOutput;
import io.quarkus.jaxrs.spi.deployment.AdditionalJaxRsResourceMethodAnnotationsBuildItem;
import io.quarkus.resteasy.common.deployment.EndpointValidationPredicatesBuildItem;
import io.quarkus.resteasy.common.spi.EndpointValidationPredicatesBuildItem;
import io.quarkus.resteasy.common.spi.ResteasyJaxrsProviderBuildItem;
import io.quarkus.resteasy.reactive.spi.ExceptionMapperBuildItem;

Expand Down Expand Up @@ -89,7 +89,7 @@ public AdditionalJaxRsResourceMethodAnnotationsBuildItem additionalJaxRsResource
}

@BuildStep
EndpointValidationPredicatesBuildItem createSpringRestControllerPredicate() {
EndpointValidationPredicatesBuildItem createSpringRestControllerPredicateForClassic() {
Predicate<ClassInfo> predicate = new Predicate<>() {
@Override
public boolean test(ClassInfo classInfo) {
Expand All @@ -100,6 +100,18 @@ public boolean test(ClassInfo classInfo) {
return new EndpointValidationPredicatesBuildItem(predicate);
}

@BuildStep
io.quarkus.resteasy.reactive.common.deployment.EndpointValidationPredicatesBuildItem createSpringRestControllerPredicateForReactive() {
Predicate<ClassInfo> predicate = new Predicate<>() {
@Override
public boolean test(ClassInfo classInfo) {
return classInfo
.declaredAnnotation(REST_CONTROLLER_ANNOTATION) == null;
}
};
return new io.quarkus.resteasy.reactive.common.deployment.EndpointValidationPredicatesBuildItem(predicate);
}

@BuildStep
public void ignoreReflectionHierarchy(BuildProducer<ReflectiveHierarchyIgnoreWarningBuildItem> ignore) {
ignore.produce(new ReflectiveHierarchyIgnoreWarningBuildItem(
Expand Down

0 comments on commit b54a4f2

Please sign in to comment.