Skip to content

Commit

Permalink
Workaround for quarkiverse#1078 Wrong service file loaded in native m…
Browse files Browse the repository at this point in the history
…ode after upgrading Mandrel from 23.0.1.2 JDK 17.8 to 23.1.0.0 JDK 21.0
  • Loading branch information
ppalaga committed Oct 25, 2023
1 parent 219c817 commit 0c4529a
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,19 @@
import io.quarkus.deployment.builditem.GeneratedResourceBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageProxyDefinitionBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
import io.quarkus.deployment.pkg.PackageConfig;
import io.quarkus.deployment.pkg.PackageConfig.BuiltInType;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem;
import io.quarkus.deployment.pkg.builditem.UberJarRequiredBuildItem;
import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
import io.quarkus.gizmo.ClassOutput;

class QuarkusCxfProcessor {
Expand Down Expand Up @@ -180,6 +181,13 @@ BuildTimeBusBuildItem bus() {
return new BuildTimeBusBuildItem(bus);
}

@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
void systemProperty(BuildProducer<SystemPropertyBuildItem> systemProperty) {
/* Workaround for https://github.com/quarkiverse/quarkus-cxf/issues/1078 */
systemProperty
.produce(new SystemPropertyBuildItem(BusFactory.BUS_FACTORY_PROPERTY_NAME, QuarkusBusFactory.class.getName()));
}

@BuildStep
void generateRuntimeBusServiceFile(BuildProducer<GeneratedResourceBuildItem> generatedResources) {
/*
Expand Down Expand Up @@ -511,16 +519,6 @@ void reflectiveClasses(

}

@BuildStep
void serviceProviders(BuildProducer<ServiceProviderBuildItem> serviceProvider) {

serviceProvider.produce(
new ServiceProviderBuildItem(
"org.apache.cxf.bus.factory",
"org.apache.cxf.bus.CXFBusFactory"));

}

void produceRecursiveProxies(IndexView index,
DotName interfaceDN,
BuildProducer<NativeImageProxyDefinitionBuildItem> proxies, Set<String> proxiesCreated) {
Expand Down Expand Up @@ -569,10 +567,11 @@ NativeImageResourceBundleBuildItem nativeImageResourceBundleBuildItem() {
@BuildStep
NativeImageResourceBuildItem nativeImageResourceBuildItem() {
// TODO add @HandlerChain (file) and parse it to add class loading
return new NativeImageResourceBuildItem("com/sun/xml/fastinfoset/resources/ResourceBundle.properties",
return new NativeImageResourceBuildItem(
"META-INF/services/" + BusFactory.BUS_FACTORY_PROPERTY_NAME,
"com/sun/xml/fastinfoset/resources/ResourceBundle.properties",
"META-INF/cxf/bus-extensions.txt",
"META-INF/cxf/cxf.xml",
"META-INF/cxf/org.apache.cxf.bus.factory",
"META-INF/blueprint.handlers",
"META-INF/spring.handlers",
"META-INF/spring.schemas",
Expand Down

0 comments on commit 0c4529a

Please sign in to comment.