Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Alignment of the capability detection logic #291

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import io.quarkus.deployment.Capability;
import io.quarkus.deployment.CodeGenContext;
import io.quarkus.deployment.CodeGenProvider;
import io.quarkus.maven.dependency.ResolvedDependency;
import io.smallrye.config.SmallRyeConfig;

/**
Expand Down Expand Up @@ -119,20 +118,18 @@ public boolean trigger(CodeGenContext context) throws CodeGenException {
return false;
}

private boolean isJacksonReactiveClientPresent(CodeGenContext context) {
return context.applicationModel().getDependencies().stream()
.anyMatch(this::isJacksonReactiveClient);
private static boolean isJacksonReactiveClientPresent(CodeGenContext context) {
return isExtensionCapabilityPresent(context, Capability.REST_CLIENT_REACTIVE_JACKSON);
}

private boolean isJacksonClassicClientPresent(CodeGenContext context) {
return context.applicationModel().getExtensionCapabilities().stream()
.flatMap(extensionCapability -> extensionCapability.getProvidesCapabilities().stream())
.anyMatch(Capability.RESTEASY_JSON_JACKSON_CLIENT::equals);
private static boolean isJacksonClassicClientPresent(CodeGenContext context) {
return isExtensionCapabilityPresent(context, Capability.RESTEASY_JSON_JACKSON_CLIENT);
}

private boolean isJacksonReactiveClient(ResolvedDependency resolvedDependency) {
return "quarkus-rest-client-reactive-jackson".equals(resolvedDependency.getArtifactId())
&& "io.quarkus".equals(resolvedDependency.getGroupId());
private static boolean isExtensionCapabilityPresent(CodeGenContext context, String capability) {
return context.applicationModel().getExtensionCapabilities().stream()
.flatMap(extensionCapability -> extensionCapability.getProvidesCapabilities().stream())
.anyMatch(capability::equals);
}

// TODO: do not generate if the output dir has generated files and the openapi file has the same checksum of the previous run
Expand Down