diff --git a/config/etcd/pom.xml b/config/etcd/pom.xml index eb056ec5154..070087f2385 100644 --- a/config/etcd/pom.xml +++ b/config/etcd/pom.xml @@ -53,8 +53,12 @@ - io.helidon.grpc - io.grpc + io.grpc + grpc-api + + + io.grpc + grpc-core io.grpc diff --git a/config/etcd/src/main/java9/module-info.java b/config/etcd/src/main/java9/module-info.java index 0c3b5834158..c2ff0c0eb3c 100644 --- a/config/etcd/src/main/java9/module-info.java +++ b/config/etcd/src/main/java9/module-info.java @@ -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. @@ -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; diff --git a/dependencies/pom.xml b/dependencies/pom.xml index a31df5d5957..1677c5b5a5f 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -46,10 +46,10 @@ 3.0.0 2.17.0 1.35.2 - 3.21.7 + 3.25.5 21.3.0 2.9.0 - 1.57.1 + 1.65.1 32.0.0-jre 1.4.199 1.3 @@ -615,6 +615,13 @@ + + io.grpc + grpc-bom + ${version.lib.grpc} + pom + import + com.google.protobuf protobuf-bom @@ -629,13 +636,6 @@ pom import - - io.grpc - grpc-bom - ${version.lib.grpc} - pom - import - org.glassfish.jersey jersey-bom diff --git a/grpc/client/src/test/java/io/helidon/grpc/client/GrpcChannelsProviderIT.java b/grpc/client/src/test/java/io/helidon/grpc/client/GrpcChannelsProviderIT.java index 33a90a693dc..6eaf41d34be 100644 --- a/grpc/client/src/test/java/io/helidon/grpc/client/GrpcChannelsProviderIT.java +++ b/grpc/client/src/test/java/io/helidon/grpc/client/GrpcChannelsProviderIT.java @@ -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. @@ -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; @@ -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()) @@ -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; diff --git a/grpc/core/pom.xml b/grpc/core/pom.xml index 7e838a60be5..293ecee8993 100644 --- a/grpc/core/pom.xml +++ b/grpc/core/pom.xml @@ -36,24 +36,31 @@ io.helidon.common helidon-common-configurable + + + io.grpc + grpc-api + + + io.grpc + grpc-core + + + io.grpc + grpc-inprocess + + + io.grpc + grpc-util + io.grpc grpc-netty - - - io.grpc - grpc-core - - io.grpc grpc-services - - io.grpc - grpc-stub - com.google.j2objc j2objc-annotations @@ -63,16 +70,16 @@ io.grpc grpc-protobuf - - - io.grpc - grpc-core - - io.grpc grpc-stub + + + com.google.j2objc + j2objc-annotations + + diff --git a/grpc/core/src/main/java/io/helidon/grpc/core/MarshallerSupplier.java b/grpc/core/src/main/java/io/helidon/grpc/core/MarshallerSupplier.java index 1e30673fd8e..299cfcce1ee 100644 --- a/grpc/core/src/main/java/io/helidon/grpc/core/MarshallerSupplier.java +++ b/grpc/core/src/main/java/io/helidon/grpc/core/MarshallerSupplier.java @@ -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. @@ -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 @@ -69,7 +69,7 @@ class DefaultMarshallerSupplier @Override public MethodDescriptor.Marshaller get(Class clazz) { - if (MessageLite.class.isAssignableFrom(clazz)) { + if (Message.class.isAssignableFrom(clazz)) { return proto.get(clazz); } return JavaMarshaller.instance(); @@ -89,9 +89,9 @@ class ProtoMarshallerSupplier public MethodDescriptor.Marshaller get(Class 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) ProtoLiteUtils.marshaller(instance); + return (MethodDescriptor.Marshaller) 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", diff --git a/grpc/core/src/main/java9/module-info.java b/grpc/core/src/main/java9/module-info.java index 0f9e9747cb3..d70c98d94e4 100644 --- a/grpc/core/src/main/java9/module-info.java +++ b/grpc/core/src/main/java9/module-info.java @@ -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. @@ -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; diff --git a/grpc/server/src/main/java9/module-info.java b/grpc/server/src/main/java9/module-info.java index f3fe959ae6c..49aaa2f2a41 100644 --- a/grpc/server/src/main/java9/module-info.java +++ b/grpc/server/src/main/java9/module-info.java @@ -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. @@ -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; diff --git a/microprofile/grpc/client/src/main/java9/module-info.java b/microprofile/grpc/client/src/main/java9/module-info.java index 8f435642fce..e3500579123 100644 --- a/microprofile/grpc/client/src/main/java9/module-info.java +++ b/microprofile/grpc/client/src/main/java9/module-info.java @@ -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. @@ -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; -} \ No newline at end of file +} diff --git a/microprofile/grpc/server/src/main/java9/module-info.java b/microprofile/grpc/server/src/main/java9/module-info.java index 3a891cc3453..131900cecbf 100644 --- a/microprofile/grpc/server/src/main/java9/module-info.java +++ b/microprofile/grpc/server/src/main/java9/module-info.java @@ -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. @@ -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; diff --git a/pom.xml b/pom.xml index 4881175a604..6cb643eea98 100644 --- a/pom.xml +++ b/pom.xml @@ -552,7 +552,7 @@ ${version.plugin.protobuf} - com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier} + com.google.protobuf:protoc:${version.lib.google-protobuf}:exe:${os.detected.classifier} grpc-java