From ab27272c9edf02e779a4169801c3f35464a43b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 2 Mar 2022 09:59:05 +0100 Subject: [PATCH] Separate resource generation from bean container init in Arc This is necessary to avoid build item cycles in steps that consume TransformedClassesBuildItem but also produce BeanContainerListenerBuildItem. --- .../java/io/quarkus/arc/deployment/ArcProcessor.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcProcessor.java index 5cea61f68c1f2..6a05e3cfce018 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcProcessor.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcProcessor.java @@ -466,13 +466,12 @@ public ValidationPhaseBuildItem validate(ObserverRegistrationPhaseBuildItem obse return new ValidationPhaseBuildItem(validationContext, beanProcessor); } - // PHASE 5 - generate resources and initialize the container + // PHASE 5 - generate resources @BuildStep @Record(STATIC_INIT) - public BeanContainerBuildItem generateResources(ArcConfig config, ArcRecorder recorder, ShutdownContextBuildItem shutdown, + public void generateResources(ArcConfig config, ArcRecorder recorder, ShutdownContextBuildItem shutdown, ValidationPhaseBuildItem validationPhase, List validationErrors, - List beanContainerListenerBuildItems, BuildProducer reflectiveClasses, BuildProducer reflectiveMethods, BuildProducer reflectiveFields, @@ -560,6 +559,13 @@ public void registerSubclass(DotName beanClassName, String subclassName) { for (ClassInfo binding : beanProcessor.getBeanDeployment().getInterceptorBindings()) { reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, binding.name().toString())); } + } + + // PHASE 6 - initialize the container + @BuildStep + @Record(STATIC_INIT) + public BeanContainerBuildItem initializeContainer(ArcRecorder recorder, ShutdownContextBuildItem shutdown, + List beanContainerListenerBuildItems) throws Exception { ArcContainer container = recorder.getContainer(shutdown); BeanContainer beanContainer = recorder.initBeanContainer(container,