generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Native build fails when using quarkus-cxf-integration-tracing-opentel…
…emetry and quarkus-jdbc-oracle, fix #1697
- Loading branch information
Showing
14 changed files
with
265 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkiverse.cxf</groupId> | ||
<artifactId>quarkus-cxf-rt-management-parent</artifactId> | ||
<version>3.18.2-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>quarkus-cxf-rt-management-deployment</artifactId> | ||
<name>Quarkus CXF - Runtime Management - Deployment</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkiverse.cxf</groupId> | ||
<artifactId>quarkus-cxf-rt-management</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
98 changes: 98 additions & 0 deletions
98
...ain/java/io/quarkiverse/cxf/rt/management/deployment/QuarkusCxfRtManagementProcessor.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 |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package io.quarkiverse.cxf.rt.management.deployment; | ||
|
||
import java.util.function.BiFunction; | ||
import java.util.stream.Stream; | ||
|
||
import org.apache.cxf.management.jmx.InstrumentationManagerImpl; | ||
import org.jboss.logging.Logger; | ||
import org.objectweb.asm.ClassVisitor; | ||
import org.objectweb.asm.MethodVisitor; | ||
import org.objectweb.asm.Opcodes; | ||
|
||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem; | ||
import io.quarkus.deployment.builditem.CombinedIndexBuildItem; | ||
import io.quarkus.deployment.builditem.IndexDependencyBuildItem; | ||
import io.quarkus.deployment.pkg.steps.NativeBuild; | ||
import io.quarkus.gizmo.Gizmo; | ||
|
||
public class QuarkusCxfRtManagementProcessor { | ||
|
||
private static final Logger log = Logger.getLogger(QuarkusCxfRtManagementProcessor.class); | ||
|
||
@BuildStep | ||
void indexDependencies(BuildProducer<IndexDependencyBuildItem> indexDependencies) { | ||
Stream.of( | ||
"org.apache.cxf:cxf-rt-management") | ||
.forEach(ga -> { | ||
String[] coords = ga.split(":"); | ||
indexDependencies.produce(new IndexDependencyBuildItem(coords[0], coords[1])); | ||
}); | ||
} | ||
|
||
@BuildStep(onlyIf = NativeBuild.class) | ||
void transfromByteCode( | ||
CombinedIndexBuildItem combinedIndex, | ||
Check notice Code scanning / CodeQL Useless parameter Note
The parameter 'combinedIndex' is never used.
|
||
BuildProducer<BytecodeTransformerBuildItem> bytecodeTransformers) { | ||
|
||
/* | ||
* Make InstrumentationManagerImpl.init() a no-op in native mode | ||
* to avoid getting an MBean Server instance in the native image heap | ||
* See https://github.com/quarkiverse/quarkus-cxf/issues/1697 | ||
*/ | ||
final BytecodeTransformerBuildItem transformation = new BytecodeTransformerBuildItem.Builder() | ||
.setClassToTransform(InstrumentationManagerImpl.class.getName()) | ||
.setCacheable(true) | ||
.setVisitorFunction(new NoInitTransformer()) | ||
.build(); | ||
bytecodeTransformers.produce(transformation); | ||
} | ||
|
||
static class NoInitTransformer implements BiFunction<String, ClassVisitor, ClassVisitor> { | ||
|
||
@Override | ||
public ClassVisitor apply(String t, ClassVisitor classVisitor) { | ||
return new ClassVisitor(Gizmo.ASM_API_VERSION, classVisitor) { | ||
private boolean initTransformed = false; | ||
|
||
@Override | ||
public MethodVisitor visitMethod(int access, | ||
String name, | ||
String descriptor, | ||
String signature, | ||
String[] exceptions) { | ||
if (name.equals("init") | ||
&& descriptor.equals("()V") | ||
&& (access & Opcodes.ACC_PUBLIC) != 0) { | ||
initTransformed = true; | ||
final MethodVisitor mv = super.visitMethod(access, name, descriptor, signature, exceptions); | ||
|
||
return new MethodVisitor(api, mv) { | ||
|
||
@Override | ||
public void visitCode() { | ||
/* Replace method body with a single RETURN to make it do nothing */ | ||
visitInsn(Opcodes.RETURN); | ||
visitMaxs(0, 0); | ||
visitEnd(); | ||
Check warning Code scanning / CodeQL Subtle call to inherited method Warning
A
method declared in a superclass Error loading related location Loading method with the same signature in an enclosing class Error loading related location Loading |
||
} | ||
}; | ||
} | ||
return super.visitMethod(access, name, descriptor, signature, exceptions); | ||
} | ||
|
||
@Override | ||
public void visitEnd() { | ||
if (!initTransformed) { | ||
throw new IllegalStateException( | ||
InstrumentationManagerImpl.class.getName() + ".init() method not found"); | ||
} | ||
super.visitEnd(); | ||
} | ||
|
||
}; | ||
} | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkiverse.cxf</groupId> | ||
<artifactId>quarkus-cxf-extensions</artifactId> | ||
<version>3.18.2-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>quarkus-cxf-rt-management-parent</artifactId> | ||
<name>Quarkus CXF - Runtime Management - Parent</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>deployment</module> | ||
<module>runtime</module> | ||
</modules> | ||
|
||
</project> |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.quarkiverse.cxf</groupId> | ||
<artifactId>quarkus-cxf-rt-management-parent</artifactId> | ||
<version>3.18.2-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>quarkus-cxf-rt-management</artifactId> | ||
<name>Quarkus CXF - Runtime Management</name> | ||
<description>Native support for CXF Runtime Management</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.cxf</groupId> | ||
<artifactId>cxf-rt-management</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>extension-descriptor</goal> | ||
</goals> | ||
<phase>compile</phase> | ||
<configuration> | ||
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version} | ||
</deployment> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${quarkus.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
extensions/rt-management/runtime/src/main/resources/META-INF/quarkus-extension.yaml
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
artifact: ${project.groupId}:${project.artifactId}:${project.version} | ||
name: "Quarkus CXF Runtime Management" | ||
description: "Native support for CXf Runtime Management" | ||
metadata: | ||
unlisted: true | ||
keywords: | ||
- "jmx" | ||
categories: | ||
- "jmx" | ||
guide: "https://quarkiverse.github.io/quarkiverse-docs/quarkus-cxf/dev/index.html" | ||
status: "stable" |
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
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
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
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
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