-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
gRPC - archive with a MutinyBean implementor is a bean archive #19902
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.quarkus.arc.deployment; | ||
|
||
import java.util.function.Predicate; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
import io.quarkus.deployment.ApplicationArchive; | ||
|
||
/** | ||
* | ||
* By default, only explict/implicit bean archives (as defined by the spec) are considered during the bean discovery. However, | ||
* extensions can register a logic to identify additional bean archives. | ||
*/ | ||
public final class BeanArchivePredicateBuildItem extends MultiBuildItem { | ||
|
||
private final Predicate<ApplicationArchive> predicate; | ||
|
||
public BeanArchivePredicateBuildItem(Predicate<ApplicationArchive> predicate) { | ||
this.predicate = predicate; | ||
} | ||
|
||
public Predicate<ApplicationArchive> getPredicate() { | ||
return predicate; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
import io.grpc.internal.ServerImpl; | ||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.arc.deployment.AnnotationsTransformerBuildItem; | ||
import io.quarkus.arc.deployment.BeanArchivePredicateBuildItem; | ||
import io.quarkus.arc.deployment.CustomScopeAnnotationsBuildItem; | ||
import io.quarkus.arc.deployment.GeneratedBeanBuildItem; | ||
import io.quarkus.arc.deployment.GeneratedBeanGizmoAdaptor; | ||
|
@@ -49,6 +50,7 @@ | |
import io.quarkus.arc.processor.AnnotationsTransformer; | ||
import io.quarkus.arc.processor.BeanInfo; | ||
import io.quarkus.arc.processor.BuiltinScope; | ||
import io.quarkus.deployment.ApplicationArchive; | ||
import io.quarkus.deployment.IsDevelopment; | ||
import io.quarkus.deployment.IsNormal; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
|
@@ -546,6 +548,18 @@ void configureMetrics(GrpcBuildTimeConfig configuration, Optional<MetricsCapabil | |
} | ||
} | ||
|
||
@BuildStep | ||
BeanArchivePredicateBuildItem additionalBeanArchives() { | ||
return new BeanArchivePredicateBuildItem(new Predicate<ApplicationArchive>() { | ||
|
||
@Override | ||
public boolean test(ApplicationArchive archive) { | ||
// Every archive that contains a generated implementor of MutinyBean is considered a bean archive | ||
return !archive.getIndex().getKnownDirectImplementors(GrpcDotNames.MUTINY_BEAN).isEmpty(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe so. But it's a good point that we could be more defensive here... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, we don't test the nullability in the |
||
} | ||
}); | ||
} | ||
|
||
private static class GrpcInterceptors { | ||
final Set<String> globalInterceptors; | ||
final Set<String> nonGlobalInterceptors; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the name of this build item. The other alternative was
AdditionalBeanArchiveBuildItem
but given the fact that the item does not represent a bean archive but a logic that identifies a bean archive I decided forBeanArchivePredicateBuildItem
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
BeanArchivePredicateBuildItem
makes sense.