-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace CommandLineArgumentsProducer with a synthetic bean
- eliminates the need for a bean that declares the producer
- Loading branch information
Showing
3 changed files
with
15 additions
and
47 deletions.
There are no files selected for viewing
29 changes: 15 additions & 14 deletions
29
...arc/deployment/src/main/java/io/quarkus/arc/deployment/CommandLineArgumentsProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
package io.quarkus.arc.deployment; | ||
|
||
import io.quarkus.arc.runtime.ArcRecorder; | ||
import io.quarkus.arc.runtime.CommandLineArgumentsProducer; | ||
import org.jboss.jandex.DotName; | ||
import org.jboss.jandex.Type; | ||
import org.jboss.jandex.Type.Kind; | ||
|
||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.annotations.ExecutionTime; | ||
import io.quarkus.deployment.annotations.Record; | ||
import io.quarkus.deployment.builditem.RawCommandLineArgumentsBuildItem; | ||
import io.quarkus.runtime.annotations.CommandLineArguments; | ||
|
||
public class CommandLineArgumentsProcessor { | ||
|
||
@BuildStep | ||
@Record(ExecutionTime.STATIC_INIT) | ||
BeanContainerListenerBuildItem commandLineArgs(RawCommandLineArgumentsBuildItem rawCommandLineArgumentsBuildItem, | ||
ArcRecorder arcRecorder) { | ||
//todo: this should be filtered | ||
return new BeanContainerListenerBuildItem(arcRecorder.initCommandLineArgs(rawCommandLineArgumentsBuildItem)); | ||
} | ||
SyntheticBeanBuildItem commandLineArgs(RawCommandLineArgumentsBuildItem rawCommandLineArgumentsBuildItem, | ||
BuildProducer<AdditionalBeanBuildItem> additionalBeans) { | ||
additionalBeans.produce(new AdditionalBeanBuildItem(CommandLineArguments.class)); | ||
|
||
@BuildStep | ||
AdditionalBeanBuildItem qualifier() { | ||
return AdditionalBeanBuildItem.builder().setUnremovable() | ||
.addBeanClasses(CommandLineArguments.class, CommandLineArgumentsProducer.class).build(); | ||
Type stringArray = Type.create(DotName.createSimple(String[].class.getName()), Kind.ARRAY); | ||
// implClazz is ignored because a provider type is set | ||
return SyntheticBeanBuildItem.configure(Object.class).providerType(stringArray).addType(stringArray) | ||
.addQualifier(CommandLineArguments.class) | ||
.setRuntimeInit().supplier(rawCommandLineArgumentsBuildItem) | ||
.unremovable().done(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
...nsions/arc/runtime/src/main/java/io/quarkus/arc/runtime/CommandLineArgumentsProducer.java
This file was deleted.
Oops, something went wrong.