Skip to content

Commit

Permalink
UberJar support and updated README.MD
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 25, 2024
1 parent 38e3c4a commit da07e9e
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Quarkus extension for Apache POI
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<div align="center">
<img src="https://github.com/quarkiverse/.github/blob/main/assets/images/quarkus.svg" width="67" height="70" ><img src="https://github.com/quarkiverse/.github/blob/main/assets/images/plus-sign.svg" height="70" ><img src="https://github.com/quarkiverse/quarkus-jgit/blob/main/docs/modules/ROOT/assets/images/poi.svg" height="70" >

# Quarkus POI
</div>
<br>

[![Version](https://img.shields.io/maven-central/v/io.quarkiverse.poi/quarkus-poi?logo=apache-maven&style=flat-square)](https://search.maven.org/artifact/io.quarkiverse.poi/quarkus-poi)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0)
[![Build](https://github.com/quarkiverse/quarkus-poi/actions/workflows/build.yml/badge.svg)](https://github.com/quarkiverse/quarkus-poi/actions/workflows/build.yml)

This is a Quarkus extension for Apache POI.

Expand Down Expand Up @@ -92,4 +96,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package io.quarkiverse.poi.deployment;

import java.util.List;

import org.apache.xmlbeans.StringEnumAbstractBase;
import org.apache.xmlbeans.XmlObject;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.IndexView;

import io.quarkiverse.poi.runtime.graal.POIFeature;
import io.quarkus.deployment.IsNormal;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
Expand All @@ -16,6 +19,7 @@
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourcePatternsBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;

class POIProcessor {

Expand Down Expand Up @@ -75,4 +79,26 @@ public NativeImageResourcePatternsBuildItem registerResources() {
"org/apache/poi/ss/formula/function/.*\\.txt",
"org/apache/poi/schemas/ooxml/.*\\.xsb").build();
}

/**
* Produces `UberJarMergedResourceBuildItem`s for each specified service file to be included in the Uber JAR.
* <p>
* This build step is only executed in "normal" mode and registers each of the listed services in
* the `META-INF/services` directory.
*
* @param producer The build item producer for creating `UberJarMergedResourceBuildItem` instances.
*/
@BuildStep(onlyIf = IsNormal.class)
void uberJarServiceLoaders(BuildProducer<UberJarMergedResourceBuildItem> producer) {
List<String> serviceFiles = List.of(
"org.apache.poi.extractor.ExtractorProvider",
"org.apache.poi.sl.draw.ImageRenderer",
"org.apache.poi.sl.usermodel.MetroShapeProvider",
"org.apache.poi.sl.usermodel.SlideShowProvider",
"org.apache.poi.ss.usermodel.WorkbookProvider");

for (String serviceFile : serviceFiles) {
producer.produce(new UberJarMergedResourceBuildItem("META-INF/services/" + serviceFile));
}
}
}
66 changes: 66 additions & 0 deletions docs/modules/ROOT/assets/images/plus-sign.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit da07e9e

Please sign in to comment.