|
1 | 1 | package io.quarkiverse.poi.deployment;
|
2 | 2 |
|
| 3 | +import java.util.List; |
| 4 | + |
3 | 5 | import org.apache.xmlbeans.StringEnumAbstractBase;
|
4 | 6 | import org.apache.xmlbeans.XmlObject;
|
5 | 7 | import org.jboss.jandex.ClassInfo;
|
6 | 8 | import org.jboss.jandex.IndexView;
|
7 | 9 |
|
8 | 10 | import io.quarkiverse.poi.runtime.graal.POIFeature;
|
| 11 | +import io.quarkus.deployment.IsNormal; |
9 | 12 | import io.quarkus.deployment.annotations.BuildProducer;
|
10 | 13 | import io.quarkus.deployment.annotations.BuildStep;
|
11 | 14 | import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
|
|
16 | 19 | import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
|
17 | 20 | import io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem;
|
18 | 21 | import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
|
| 22 | +import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem; |
19 | 23 |
|
20 | 24 | class POIProcessor {
|
21 | 25 |
|
@@ -75,4 +79,26 @@ public NativeImageResourcePatternsBuildItem registerResources() {
|
75 | 79 | "org/apache/poi/ss/formula/function/.*\\.txt",
|
76 | 80 | "org/apache/poi/schemas/ooxml/.*\\.xsb").build();
|
77 | 81 | }
|
| 82 | + |
| 83 | + /** |
| 84 | + * Produces `UberJarMergedResourceBuildItem`s for each specified service file to be included in the Uber JAR. |
| 85 | + * <p> |
| 86 | + * This build step is only executed in "normal" mode and registers each of the listed services in |
| 87 | + * the `META-INF/services` directory. |
| 88 | + * |
| 89 | + * @param producer The build item producer for creating `UberJarMergedResourceBuildItem` instances. |
| 90 | + */ |
| 91 | + @BuildStep(onlyIf = IsNormal.class) |
| 92 | + void uberJarServiceLoaders(BuildProducer<UberJarMergedResourceBuildItem> producer) { |
| 93 | + List<String> serviceFiles = List.of( |
| 94 | + "org.apache.poi.extractor.ExtractorProvider", |
| 95 | + "org.apache.poi.sl.draw.ImageRenderer", |
| 96 | + "org.apache.poi.sl.usermodel.MetroShapeProvider", |
| 97 | + "org.apache.poi.sl.usermodel.SlideShowProvider", |
| 98 | + "org.apache.poi.ss.usermodel.WorkbookProvider"); |
| 99 | + |
| 100 | + for (String serviceFile : serviceFiles) { |
| 101 | + producer.produce(new UberJarMergedResourceBuildItem("META-INF/services/" + serviceFile)); |
| 102 | + } |
| 103 | + } |
78 | 104 | }
|
0 commit comments