From e7b45ce20ec65f0fe0edc8c4586323786a0a90a6 Mon Sep 17 00:00:00 2001 From: Toshihiro Suzuki Date: Wed, 18 Sep 2024 16:26:28 +0900 Subject: [PATCH] Upgrade Gradle and Gradle plugins (#54) --- build.gradle | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../grpc/com/scalar/admin/rpc/AdminGrpc.java | 89 +++++++++++-------- .../scalar/admin/rpc/CheckPausedResponse.java | 9 +- .../com/scalar/admin/rpc/PauseRequest.java | 11 +-- 5 files changed, 64 insertions(+), 53 deletions(-) diff --git a/build.gradle b/build.gradle index abf6fb4..eef2287 100644 --- a/build.gradle +++ b/build.gradle @@ -4,8 +4,8 @@ plugins { id 'idea' id 'application' id 'java-library-distribution' - id 'com.google.protobuf' version '0.8.8' - id 'com.github.johnrengelman.shadow' version '6.1.0' + id 'com.google.protobuf' version '0.9.1' + id 'com.github.johnrengelman.shadow' version '7.1.2' id 'com.palantir.docker' version '0.25.0' } startScripts.enabled = false @@ -34,7 +34,7 @@ dependencies { implementation "io.grpc:grpc-stub:${grpcVersion}" implementation "com.google.protobuf:protobuf-java-util:${protobufVersion}" implementation 'dnsjava:dnsjava:3.6.1' - compileOnly 'javax.annotation:javax.annotation-api:1.2' + implementation 'javax.annotation:javax.annotation-api:1.2' testImplementation 'junit:junit:4.12' testImplementation 'org.assertj:assertj-core:3.9.1' testImplementation 'org.mockito:mockito-core:2.16.0' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4d9ca16..3994438 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/grpc/com/scalar/admin/rpc/AdminGrpc.java b/src/main/grpc/com/scalar/admin/rpc/AdminGrpc.java index 0a06861..87da314 100644 --- a/src/main/grpc/com/scalar/admin/rpc/AdminGrpc.java +++ b/src/main/grpc/com/scalar/admin/rpc/AdminGrpc.java @@ -5,14 +5,14 @@ /** */ @javax.annotation.Generated( - value = "by gRPC proto compiler (version 1.51.0)", + value = "by gRPC proto compiler (version 1.66.0)", comments = "Source: scalar/protobuf/admin.proto") @io.grpc.stub.annotations.GrpcGenerated public final class AdminGrpc { private AdminGrpc() {} - public static final String SERVICE_NAME = "rpc.Admin"; + public static final java.lang.String SERVICE_NAME = "rpc.Admin"; // Static method descriptors that strictly reflect the proto. private static volatile io.grpc.MethodDescriptor responseObserver) { io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getPauseMethod(), responseObserver); } /** */ - public void unpause(com.google.protobuf.Empty request, + default void unpause(com.google.protobuf.Empty request, io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUnpauseMethod(), responseObserver); } /** */ - public void checkPaused(com.google.protobuf.Empty request, + default void checkPaused(com.google.protobuf.Empty request, io.grpc.stub.StreamObserver responseObserver) { io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCheckPausedMethod(), responseObserver); } + } + + /** + * Base class for the server implementation of the service Admin. + */ + public static abstract class AdminImplBase + implements io.grpc.BindableService, AsyncService { @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getPauseMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.scalar.admin.rpc.PauseRequest, - com.google.protobuf.Empty>( - this, METHODID_PAUSE))) - .addMethod( - getUnpauseMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.protobuf.Empty, - com.google.protobuf.Empty>( - this, METHODID_UNPAUSE))) - .addMethod( - getCheckPausedMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.protobuf.Empty, - com.scalar.admin.rpc.CheckPausedResponse>( - this, METHODID_CHECK_PAUSED))) - .build(); + return AdminGrpc.bindService(this); } } /** + * A stub to allow clients to do asynchronous rpc calls to service Admin. */ - public static final class AdminStub extends io.grpc.stub.AbstractAsyncStub { + public static final class AdminStub + extends io.grpc.stub.AbstractAsyncStub { private AdminStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); @@ -244,8 +231,10 @@ public void checkPaused(com.google.protobuf.Empty request, } /** + * A stub to allow clients to do synchronous rpc calls to service Admin. */ - public static final class AdminBlockingStub extends io.grpc.stub.AbstractBlockingStub { + public static final class AdminBlockingStub + extends io.grpc.stub.AbstractBlockingStub { private AdminBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); @@ -280,8 +269,10 @@ public com.scalar.admin.rpc.CheckPausedResponse checkPaused(com.google.protobuf. } /** + * A stub to allow clients to do ListenableFuture-style rpc calls to service Admin. */ - public static final class AdminFutureStub extends io.grpc.stub.AbstractFutureStub { + public static final class AdminFutureStub + extends io.grpc.stub.AbstractFutureStub { private AdminFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions) { super(channel, callOptions); @@ -327,10 +318,10 @@ private static final class MethodHandlers implements io.grpc.stub.ServerCalls.ServerStreamingMethod, io.grpc.stub.ServerCalls.ClientStreamingMethod, io.grpc.stub.ServerCalls.BidiStreamingMethod { - private final AdminImplBase serviceImpl; + private final AsyncService serviceImpl; private final int methodId; - MethodHandlers(AdminImplBase serviceImpl, int methodId) { + MethodHandlers(AsyncService serviceImpl, int methodId) { this.serviceImpl = serviceImpl; this.methodId = methodId; } @@ -367,6 +358,32 @@ public io.grpc.stub.StreamObserver invoke( } } + public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getPauseMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.scalar.admin.rpc.PauseRequest, + com.google.protobuf.Empty>( + service, METHODID_PAUSE))) + .addMethod( + getUnpauseMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.protobuf.Empty, + com.google.protobuf.Empty>( + service, METHODID_UNPAUSE))) + .addMethod( + getCheckPausedMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.protobuf.Empty, + com.scalar.admin.rpc.CheckPausedResponse>( + service, METHODID_CHECK_PAUSED))) + .build(); + } + private static abstract class AdminBaseDescriptorSupplier implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier { AdminBaseDescriptorSupplier() {} @@ -390,9 +407,9 @@ private static final class AdminFileDescriptorSupplier private static final class AdminMethodDescriptorSupplier extends AdminBaseDescriptorSupplier implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; + private final java.lang.String methodName; - AdminMethodDescriptorSupplier(String methodName) { + AdminMethodDescriptorSupplier(java.lang.String methodName) { this.methodName = methodName; } diff --git a/src/main/java/com/scalar/admin/rpc/CheckPausedResponse.java b/src/main/java/com/scalar/admin/rpc/CheckPausedResponse.java index 71bbe63..7993332 100644 --- a/src/main/java/com/scalar/admin/rpc/CheckPausedResponse.java +++ b/src/main/java/com/scalar/admin/rpc/CheckPausedResponse.java @@ -25,11 +25,6 @@ protected java.lang.Object newInstance( return new CheckPausedResponse(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.scalar.admin.rpc.AdminProto.internal_static_rpc_CheckPausedResponse_descriptor; @@ -164,11 +159,13 @@ public static com.scalar.admin.rpc.CheckPausedResponse parseFrom( return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } + public static com.scalar.admin.rpc.CheckPausedResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } + public static com.scalar.admin.rpc.CheckPausedResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -393,7 +390,7 @@ public boolean getPaused() { * @return This builder for chaining. */ public Builder setPaused(boolean value) { - + paused_ = value; bitField0_ |= 0x00000001; onChanged(); diff --git a/src/main/java/com/scalar/admin/rpc/PauseRequest.java b/src/main/java/com/scalar/admin/rpc/PauseRequest.java index 0198a47..13e4d1f 100644 --- a/src/main/java/com/scalar/admin/rpc/PauseRequest.java +++ b/src/main/java/com/scalar/admin/rpc/PauseRequest.java @@ -25,11 +25,6 @@ protected java.lang.Object newInstance( return new PauseRequest(); } - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return com.scalar.admin.rpc.AdminProto.internal_static_rpc_PauseRequest_descriptor; @@ -201,11 +196,13 @@ public static com.scalar.admin.rpc.PauseRequest parseFrom( return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } + public static com.scalar.admin.rpc.PauseRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } + public static com.scalar.admin.rpc.PauseRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) @@ -445,7 +442,7 @@ public boolean getWaitOutstanding() { * @return This builder for chaining. */ public Builder setWaitOutstanding(boolean value) { - + waitOutstanding_ = value; bitField0_ |= 0x00000001; onChanged(); @@ -485,7 +482,7 @@ public long getMaxPauseWaitTime() { * @return This builder for chaining. */ public Builder setMaxPauseWaitTime(long value) { - + maxPauseWaitTime_ = value; bitField0_ |= 0x00000002; onChanged();