Skip to content

Commit

Permalink
Upgrade grpc-java to 1.65.1 and protobuf to 3.25.5
Browse files Browse the repository at this point in the history
  • Loading branch information
barchetta committed Feb 20, 2025
1 parent 9b28f45 commit c731e8b
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 56 deletions.
8 changes: 6 additions & 2 deletions config/etcd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@
</dependency>
<!-- etcd v3 -->
<dependency>
<groupId>io.helidon.grpc</groupId>
<artifactId>io.grpc</artifactId>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
Expand Down
8 changes: 4 additions & 4 deletions config/etcd/src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2025 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,9 +22,9 @@
requires java.logging;
requires transitive io.helidon.config;
requires etcd4j;
requires grpc.api;
requires grpc.protobuf;
requires grpc.stub;
requires io.grpc.protobuf;
requires io.grpc.stub;
requires io.grpc;
requires com.google.protobuf;
requires com.google.common;
requires io.helidon.common;
Expand Down
18 changes: 9 additions & 9 deletions dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
<version.lib.el-impl>3.0.0</version.lib.el-impl>
<version.lib.etcd4j>2.17.0</version.lib.etcd4j>
<version.lib.google-api-client>1.35.2</version.lib.google-api-client>
<version.lib.google-protobuf>3.21.7</version.lib.google-protobuf>
<version.lib.google-protobuf>3.25.5</version.lib.google-protobuf>
<version.lib.graalvm>21.3.0</version.lib.graalvm>
<version.lib.gson>2.9.0</version.lib.gson>
<version.lib.grpc>1.57.1</version.lib.grpc>
<version.lib.grpc>1.65.1</version.lib.grpc>
<version.lib.guava>32.0.0-jre</version.lib.guava>
<version.lib.h2>1.4.199</version.lib.h2>
<version.lib.hamcrest>1.3</version.lib.hamcrest>
Expand Down Expand Up @@ -615,6 +615,13 @@
</dependency>
<!-- imported boms -->
<!-- Force upgrade. Used by grpc -->
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-bom</artifactId>
<version>${version.lib.grpc}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
Expand All @@ -629,13 +636,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-bom</artifactId>
<version>${version.lib.grpc}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2021 Oracle and/or its affiliates.
* Copyright (c) 2019, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,10 @@

import io.grpc.EquivalentAddressGroup;
import io.grpc.NameResolver;
import io.grpc.NameResolverProvider;
import io.grpc.NameResolverRegistry;
import io.grpc.StatusRuntimeException;

import io.netty.handler.codec.DecoderException;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
Expand Down Expand Up @@ -208,12 +211,11 @@ public void shouldConnectWithCaCertAndClientCertAndClientKeyTo2WaySslServer() th

@Test
public void shouldUseTarget() throws Exception {
FakeNameResolverFactory factory = new FakeNameResolverFactory(portNoSsl);
NameResolverRegistry.getDefaultRegistry().register(new FakeNameResolverProvider("foo", portNoSsl));
String channelKey = "ChannelKey";
GrpcChannelDescriptor.Builder builder = GrpcChannelDescriptor
.builder()
.target("foo://bar.com")
.nameResolverFactory(factory);
.target("foo://bar.com");

GrpcChannelsProvider provider = GrpcChannelsProvider.builder()
.channel(channelKey, builder.build())
Expand Down Expand Up @@ -303,6 +305,40 @@ public NameResolver.Args getArgs() {
}
}

private static class FakeNameResolverProvider extends NameResolverProvider {
private final String scheme;
private final int port;
private URI targetUri;
private NameResolver.Args args;

public FakeNameResolverProvider(String scheme, int port) {
this.scheme = scheme;
this.port = port;
}

@Override
protected boolean isAvailable() {
return true;
}

@Override
protected int priority() {
return 0;
}

@Override
public NameResolver newNameResolver(URI targetUri, NameResolver.Args args) {
this.targetUri = targetUri;
this.args = args;
return new FakeNameResolver(port);
}

@Override
public String getDefaultScheme() {
return scheme;
}
}


private static class FakeNameResolver extends NameResolver {
private final int port;
Expand Down
39 changes: 23 additions & 16 deletions grpc/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,31 @@
<groupId>io.helidon.common</groupId>
<artifactId>helidon-common-configurable</artifactId>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-inprocess</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-util</artifactId>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-services</artifactId>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
Expand All @@ -63,16 +70,16 @@
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,9 +18,9 @@

import javax.inject.Named;

import com.google.protobuf.MessageLite;
import com.google.protobuf.Message;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.lite.ProtoLiteUtils;
import io.grpc.protobuf.ProtoUtils;

/**
* A supplier of {@link MethodDescriptor.Marshaller} instances for specific
Expand Down Expand Up @@ -69,7 +69,7 @@ class DefaultMarshallerSupplier

@Override
public <T> MethodDescriptor.Marshaller<T> get(Class<T> clazz) {
if (MessageLite.class.isAssignableFrom(clazz)) {
if (Message.class.isAssignableFrom(clazz)) {
return proto.get(clazz);
}
return JavaMarshaller.instance();
Expand All @@ -89,9 +89,9 @@ class ProtoMarshallerSupplier
public <T> MethodDescriptor.Marshaller<T> get(Class<T> clazz) {
try {
java.lang.reflect.Method getDefaultInstance = clazz.getDeclaredMethod("getDefaultInstance");
MessageLite instance = (MessageLite) getDefaultInstance.invoke(clazz);
Message instance = (Message) getDefaultInstance.invoke(clazz);

return (MethodDescriptor.Marshaller<T>) ProtoLiteUtils.marshaller(instance);
return (MethodDescriptor.Marshaller<T>) ProtoUtils.marshaller(instance);
} catch (Exception e) {
String msg = String.format(
"Attempting to use class %s, which is not a valid Protocol buffer message, with a default marshaller",
Expand Down
11 changes: 5 additions & 6 deletions grpc/core/src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023 Oracle and/or its affiliates.
* Copyright (c) 2019, 2025 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,11 +31,10 @@
requires io.helidon.common.context;
requires io.helidon.common.http;

requires grpc.netty;
requires transitive grpc.protobuf;
requires grpc.protobuf.lite;
requires transitive grpc.stub;
requires transitive grpc.api;
requires io.grpc.netty;
requires transitive io.grpc.protobuf;
requires transitive io.grpc.stub;
requires transitive io.grpc;
requires io.netty.handler;
requires io.netty.transport;
requires transitive com.google.protobuf;
Expand Down
9 changes: 6 additions & 3 deletions grpc/server/src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,8 +28,11 @@
requires transitive io.helidon.health;
requires io.helidon.tracing;

requires transitive grpc.services;
requires transitive grpc.core;
requires transitive io.grpc;
requires transitive io.grpc.util;
requires transitive io.grpc.inprocess;
requires transitive io.grpc.internal;
requires transitive io.grpc.services;
requires transitive microprofile.health.api;
requires transitive io.opentracing.api;
requires transitive opentracing.grpc;
Expand Down
7 changes: 4 additions & 3 deletions microprofile/grpc/client/src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,11 +20,12 @@
module io.helidon.microprofile.grpc.client {
exports io.helidon.microprofile.grpc.client;

requires transitive grpc.core;
requires transitive io.grpc.inprocess;
requires transitive io.grpc.internal;
requires transitive io.helidon.microprofile.grpc.core;

requires java.logging;

provides javax.enterprise.inject.spi.Extension
with io.helidon.microprofile.grpc.client.GrpcClientCdiExtension;
}
}
3 changes: 1 addition & 2 deletions microprofile/grpc/server/src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025 Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,6 @@
requires transitive io.helidon.microprofile.grpc.core;
requires io.helidon.common.serviceloader;

requires grpc.protobuf.lite;
requires com.google.protobuf;

requires java.logging;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@
<version>${version.plugin.protobuf}</version>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
<protocArtifact>com.google.protobuf:protoc:${version.lib.google-protobuf}:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<!--suppress UnresolvedMavenProperty -->
<pluginArtifact>
Expand Down

0 comments on commit c731e8b

Please sign in to comment.