Skip to content

Commit

Permalink
UberJar support and updated README.MD (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Oct 25, 2024
1 parent 38e3c4a commit 221db16
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 8 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-poi/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));
}
}
}
2 changes: 1 addition & 1 deletion deployment/src/main/resources/dev-ui/qwc-poi-card.js

Large diffs are not rendered by default.

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.
1 change: 1 addition & 0 deletions docs/modules/ROOT/assets/images/poi.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/modules/ROOT/assets/images/quarkus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions runtime/src/main/resources/META-INF/quarkus-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
- document
- writer
guide: "https://quarkiverse.github.io/quarkiverse-docs/quarkus-poi/dev/"
icon-url: "https://poi.apache.org/images/poweredby-poi-logo.png"
icon-url: "https://raw.githubusercontent.com/quarkiverse/quarkus-poi/main/docs/modules/ROOT/assets/images/poi.svg"
categories:
- "miscellaneous"
status: "stable"
status: "stable"

0 comments on commit 221db16

Please sign in to comment.