-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60dd703
commit 6ebd7ec
Showing
14 changed files
with
281 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>quarkus-grpc-common-parent</artifactId> | ||
<groupId>io.quarkus</groupId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-grpc-common-deployment</artifactId> | ||
<name>Quarkus - gRPC Common - Deployment</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-grpc-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-vertx-deployment</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<systemProperties> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
</systemProperties> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${project.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
65 changes: 65 additions & 0 deletions
65
...ommon/deployment/src/main/java/io/quarkus/grpc/common/deployment/GrpcCommonProcessor.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,65 @@ | ||
package io.quarkus.grpc.common.deployment; | ||
|
||
import java.util.Collection; | ||
|
||
import org.jboss.jandex.ClassInfo; | ||
|
||
import io.grpc.internal.DnsNameResolverProvider; | ||
import io.grpc.internal.PickFirstLoadBalancerProvider; | ||
import io.grpc.netty.NettyChannelProvider; | ||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.CombinedIndexBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; | ||
|
||
public class GrpcCommonProcessor { | ||
|
||
@BuildStep | ||
public void configureNativeExecutable(CombinedIndexBuildItem combinedIndex, | ||
BuildProducer<ReflectiveClassBuildItem> reflectiveClass) { | ||
|
||
// we force the usage of the reflection invoker. | ||
Collection<ClassInfo> messages = combinedIndex.getIndex() | ||
.getAllKnownSubclasses(GrpcDotNames.GENERATED_MESSAGE_V3); | ||
for (ClassInfo message : messages) { | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, true, message.name().toString())); | ||
} | ||
Collection<ClassInfo> builders = combinedIndex.getIndex().getAllKnownSubclasses(GrpcDotNames.MESSAGE_BUILDER); | ||
for (ClassInfo builder : builders) { | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, true, builder.name().toString())); | ||
} | ||
|
||
Collection<ClassInfo> lbs = combinedIndex.getIndex().getAllKnownSubclasses(GrpcDotNames.LOAD_BALANCER_PROVIDER); | ||
for (ClassInfo lb : lbs) { | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, false, lb.name().toString())); | ||
} | ||
|
||
Collection<ClassInfo> nrs = combinedIndex.getIndex().getAllKnownSubclasses(GrpcDotNames.NAME_RESOLVER_PROVIDER); | ||
for (ClassInfo nr : nrs) { | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, false, nr.name().toString())); | ||
} | ||
|
||
// Built-In providers: | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, false, DnsNameResolverProvider.class)); | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, false, PickFirstLoadBalancerProvider.class)); | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, false, | ||
"io.grpc.util.SecretRoundRobinLoadBalancerProvider$Provider")); | ||
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, false, NettyChannelProvider.class)); | ||
} | ||
|
||
@BuildStep | ||
NativeImageConfigBuildItem nativeImageConfiguration() { | ||
NativeImageConfigBuildItem.Builder builder = NativeImageConfigBuildItem.builder() | ||
.addRuntimeInitializedClass("io.grpc.netty.Utils$ByteBufAllocatorPreferDirectHolder") | ||
.addRuntimeInitializedClass("io.grpc.netty.Utils$ByteBufAllocatorPreferHeapHolder") | ||
// substitutions are runtime-only, Utils have to be substituted until we cannot use EPoll | ||
// in native. NettyServerBuilder and NettyChannelBuilder would "bring in" Utils in build time | ||
// if they were not marked as runtime initialized: | ||
.addRuntimeInitializedClass("io.grpc.netty.Utils") | ||
.addRuntimeInitializedClass("io.grpc.netty.NettyServerBuilder") | ||
.addRuntimeInitializedClass("io.grpc.netty.NettyChannelBuilder"); | ||
return builder.build(); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
.../grpc-common/deployment/src/main/java/io/quarkus/grpc/common/deployment/GrpcDotNames.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,15 @@ | ||
package io.quarkus.grpc.common.deployment; | ||
|
||
import org.jboss.jandex.DotName; | ||
|
||
import com.google.protobuf.GeneratedMessageV3; | ||
|
||
import io.grpc.LoadBalancerProvider; | ||
import io.grpc.NameResolverProvider; | ||
|
||
public class GrpcDotNames { | ||
static final DotName MESSAGE_BUILDER = DotName.createSimple(GeneratedMessageV3.Builder.class.getName()); | ||
static final DotName GENERATED_MESSAGE_V3 = DotName.createSimple(GeneratedMessageV3.class.getName()); | ||
static final DotName NAME_RESOLVER_PROVIDER = DotName.createSimple(NameResolverProvider.class.getName()); | ||
static final DotName LOAD_BALANCER_PROVIDER = DotName.createSimple(LoadBalancerProvider.class.getName()); | ||
} |
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,22 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>quarkus-extensions-parent</artifactId> | ||
<groupId>io.quarkus</groupId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-grpc-common-parent</artifactId> | ||
<name>Quarkus - gRPC Common - Parent</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>runtime</module> | ||
<module>deployment</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,88 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>quarkus-grpc-common-parent</artifactId> | ||
<groupId>io.quarkus</groupId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-grpc-common</artifactId> | ||
<name>Quarkus - gRPC Common - Runtime</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.code.findbugs</groupId> | ||
<artifactId>jsr305</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.vertx</groupId> | ||
<artifactId>vertx-grpc</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>animal-sniffer-annotations</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>com.google.code.findbugs</groupId> | ||
<artifactId>jsr305</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.checkerframework</groupId> | ||
<artifactId>checker-qual</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>com.google.android</groupId> | ||
<artifactId>annotations</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-vertx</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.graalvm.nativeimage</groupId> | ||
<artifactId>svm</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-bootstrap-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>generate-extension-descriptor</id> | ||
<goals> | ||
<goal>extension-descriptor</goal> | ||
</goals> | ||
<phase>process-resources</phase> | ||
<configuration> | ||
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${project.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
2 changes: 1 addition & 1 deletion
2
...runtime/graal/GrpcNettySubstitutions.java → ...runtime/graal/GrpcNettySubstitutions.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
2 changes: 1 addition & 1 deletion
2
...grpc/runtime/graal/GrpcSubstitutions.java → ...mmon/runtime/graal/GrpcSubstitutions.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
11 changes: 11 additions & 0 deletions
11
extensions/grpc-common/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,11 @@ | ||
--- | ||
name: "gRPC Common" | ||
metadata: | ||
keywords: | ||
- "gRPC" | ||
categories: | ||
- "web" | ||
- "serialization" | ||
- "reactive" | ||
status: "experimental" | ||
unlisted: "true" |
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
Oops, something went wrong.