Skip to content
This repository has been archived by the owner on Sep 16, 2023. It is now read-only.

Commit

Permalink
chore: Migrate asset synth.py to bazel (#122)
Browse files Browse the repository at this point in the history
The changes in grpc stubs are caused by the gRPC upgrade from 1.10 (more than a year old) to 1.27 (same version which is used as runtime dependency)
  • Loading branch information
vam-google committed Mar 23, 2020
1 parent 68a5e4e commit 1b62627
Show file tree
Hide file tree
Showing 11 changed files with 377 additions and 490 deletions.
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -23,12 +23,13 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-asset</artifactId>
</dependency>
</dependencies>

```

[//]: # ({x-version-update-start:google-cloud-asset:released})
Expand All @@ -41,6 +42,7 @@ If you are using Maven without BOM, add this to your dependencies:
<artifactId>google-cloud-asset</artifactId>
<version>1.1.0</version>
</dependency>

```

If you are using Gradle, add this to your dependencies
Expand Down
10 changes: 10 additions & 0 deletions grpc-google-cloud-asset-v1/clirr-ignored-differences.xml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<difference>
<!-- TODO: remove after 1.1.1 released -->
<differenceType>6001</differenceType>
<className>com/google/cloud/asset/v1/*Grpc</className>
<field>METHOD_*</field>
</difference>
</differences>

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions grpc-google-cloud-asset-v1beta1/clirr-ignored-differences.xml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<difference>
<!-- TODO: remove after 1.1.1 released -->
<differenceType>6001</differenceType>
<className>com/google/cloud/asset/v1beta1/*Grpc</className>
<field>METHOD_*</field>
</difference>
</differences>
Expand Up @@ -30,7 +30,7 @@
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.10.0)",
value = "by gRPC proto compiler",
comments = "Source: google/cloud/asset/v1beta1/asset_service.proto")
public final class AssetServiceGrpc {

Expand All @@ -39,26 +39,18 @@ private AssetServiceGrpc() {}
public static final String SERVICE_NAME = "google.cloud.asset.v1beta1.AssetService";

// Static method descriptors that strictly reflect the proto.
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
@java.lang.Deprecated // Use {@link #getExportAssetsMethod()} instead.
public static final io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.ExportAssetsRequest, com.google.longrunning.Operation>
METHOD_EXPORT_ASSETS = getExportAssetsMethodHelper();

private static volatile io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.ExportAssetsRequest, com.google.longrunning.Operation>
getExportAssetsMethod;

@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "ExportAssets",
requestType = com.google.cloud.asset.v1beta1.ExportAssetsRequest.class,
responseType = com.google.longrunning.Operation.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.ExportAssetsRequest, com.google.longrunning.Operation>
getExportAssetsMethod() {
return getExportAssetsMethodHelper();
}

private static io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.ExportAssetsRequest, com.google.longrunning.Operation>
getExportAssetsMethodHelper() {
io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.ExportAssetsRequest, com.google.longrunning.Operation>
getExportAssetsMethod;
Expand All @@ -72,9 +64,7 @@ private AssetServiceGrpc() {}
com.google.longrunning.Operation>
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
generateFullMethodName(
"google.cloud.asset.v1beta1.AssetService", "ExportAssets"))
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ExportAssets"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
Expand All @@ -91,30 +81,20 @@ private AssetServiceGrpc() {}
return getExportAssetsMethod;
}

@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
@java.lang.Deprecated // Use {@link #getBatchGetAssetsHistoryMethod()} instead.
public static final io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest,
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse>
METHOD_BATCH_GET_ASSETS_HISTORY = getBatchGetAssetsHistoryMethodHelper();

private static volatile io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest,
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse>
getBatchGetAssetsHistoryMethod;

@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "BatchGetAssetsHistory",
requestType = com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest.class,
responseType = com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest,
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse>
getBatchGetAssetsHistoryMethod() {
return getBatchGetAssetsHistoryMethodHelper();
}

private static io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest,
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse>
getBatchGetAssetsHistoryMethodHelper() {
io.grpc.MethodDescriptor<
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest,
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse>
Expand All @@ -132,8 +112,7 @@ private AssetServiceGrpc() {}
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
generateFullMethodName(
"google.cloud.asset.v1beta1.AssetService", "BatchGetAssetsHistory"))
generateFullMethodName(SERVICE_NAME, "BatchGetAssetsHistory"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
Expand All @@ -154,19 +133,43 @@ private AssetServiceGrpc() {}

/** Creates a new async stub that supports all call types for the service */
public static AssetServiceStub newStub(io.grpc.Channel channel) {
return new AssetServiceStub(channel);
io.grpc.stub.AbstractStub.StubFactory<AssetServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AssetServiceStub>() {
@java.lang.Override
public AssetServiceStub newStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AssetServiceStub(channel, callOptions);
}
};
return AssetServiceStub.newStub(factory, channel);
}

/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static AssetServiceBlockingStub newBlockingStub(io.grpc.Channel channel) {
return new AssetServiceBlockingStub(channel);
io.grpc.stub.AbstractStub.StubFactory<AssetServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AssetServiceBlockingStub>() {
@java.lang.Override
public AssetServiceBlockingStub newStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AssetServiceBlockingStub(channel, callOptions);
}
};
return AssetServiceBlockingStub.newStub(factory, channel);
}

/** Creates a new ListenableFuture-style stub that supports unary calls on the service */
public static AssetServiceFutureStub newFutureStub(io.grpc.Channel channel) {
return new AssetServiceFutureStub(channel);
io.grpc.stub.AbstractStub.StubFactory<AssetServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<AssetServiceFutureStub>() {
@java.lang.Override
public AssetServiceFutureStub newStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new AssetServiceFutureStub(channel, callOptions);
}
};
return AssetServiceFutureStub.newStub(factory, channel);
}

/**
Expand All @@ -192,7 +195,7 @@ public abstract static class AssetServiceImplBase implements io.grpc.BindableSer
public void exportAssets(
com.google.cloud.asset.v1beta1.ExportAssetsRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
asyncUnimplementedUnaryCall(getExportAssetsMethodHelper(), responseObserver);
asyncUnimplementedUnaryCall(getExportAssetsMethod(), responseObserver);
}

/**
Expand All @@ -212,20 +215,20 @@ public void batchGetAssetsHistory(
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest request,
io.grpc.stub.StreamObserver<com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse>
responseObserver) {
asyncUnimplementedUnaryCall(getBatchGetAssetsHistoryMethodHelper(), responseObserver);
asyncUnimplementedUnaryCall(getBatchGetAssetsHistoryMethod(), responseObserver);
}

@java.lang.Override
public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getExportAssetsMethodHelper(),
getExportAssetsMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.cloud.asset.v1beta1.ExportAssetsRequest,
com.google.longrunning.Operation>(this, METHODID_EXPORT_ASSETS)))
.addMethod(
getBatchGetAssetsHistoryMethodHelper(),
getBatchGetAssetsHistoryMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest,
Expand All @@ -242,11 +245,8 @@ public final io.grpc.ServerServiceDefinition bindService() {
* Asset service definition.
* </pre>
*/
public static final class AssetServiceStub extends io.grpc.stub.AbstractStub<AssetServiceStub> {
private AssetServiceStub(io.grpc.Channel channel) {
super(channel);
}

public static final class AssetServiceStub
extends io.grpc.stub.AbstractAsyncStub<AssetServiceStub> {
private AssetServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
Expand All @@ -271,7 +271,7 @@ public void exportAssets(
com.google.cloud.asset.v1beta1.ExportAssetsRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getExportAssetsMethodHelper(), getCallOptions()),
getChannel().newCall(getExportAssetsMethod(), getCallOptions()),
request,
responseObserver);
}
Expand All @@ -294,7 +294,7 @@ public void batchGetAssetsHistory(
io.grpc.stub.StreamObserver<com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse>
responseObserver) {
asyncUnaryCall(
getChannel().newCall(getBatchGetAssetsHistoryMethodHelper(), getCallOptions()),
getChannel().newCall(getBatchGetAssetsHistoryMethod(), getCallOptions()),
request,
responseObserver);
}
Expand All @@ -308,11 +308,7 @@ public void batchGetAssetsHistory(
* </pre>
*/
public static final class AssetServiceBlockingStub
extends io.grpc.stub.AbstractStub<AssetServiceBlockingStub> {
private AssetServiceBlockingStub(io.grpc.Channel channel) {
super(channel);
}

extends io.grpc.stub.AbstractBlockingStub<AssetServiceBlockingStub> {
private AssetServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
Expand All @@ -336,8 +332,7 @@ protected AssetServiceBlockingStub build(
*/
public com.google.longrunning.Operation exportAssets(
com.google.cloud.asset.v1beta1.ExportAssetsRequest request) {
return blockingUnaryCall(
getChannel(), getExportAssetsMethodHelper(), getCallOptions(), request);
return blockingUnaryCall(getChannel(), getExportAssetsMethod(), getCallOptions(), request);
}

/**
Expand All @@ -356,7 +351,7 @@ public com.google.longrunning.Operation exportAssets(
public com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse batchGetAssetsHistory(
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest request) {
return blockingUnaryCall(
getChannel(), getBatchGetAssetsHistoryMethodHelper(), getCallOptions(), request);
getChannel(), getBatchGetAssetsHistoryMethod(), getCallOptions(), request);
}
}

Expand All @@ -368,11 +363,7 @@ public com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse batchGetAsse
* </pre>
*/
public static final class AssetServiceFutureStub
extends io.grpc.stub.AbstractStub<AssetServiceFutureStub> {
private AssetServiceFutureStub(io.grpc.Channel channel) {
super(channel);
}

extends io.grpc.stub.AbstractFutureStub<AssetServiceFutureStub> {
private AssetServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
Expand All @@ -397,7 +388,7 @@ protected AssetServiceFutureStub build(
public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation>
exportAssets(com.google.cloud.asset.v1beta1.ExportAssetsRequest request) {
return futureUnaryCall(
getChannel().newCall(getExportAssetsMethodHelper(), getCallOptions()), request);
getChannel().newCall(getExportAssetsMethod(), getCallOptions()), request);
}

/**
Expand All @@ -417,7 +408,7 @@ protected AssetServiceFutureStub build(
com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryResponse>
batchGetAssetsHistory(com.google.cloud.asset.v1beta1.BatchGetAssetsHistoryRequest request) {
return futureUnaryCall(
getChannel().newCall(getBatchGetAssetsHistoryMethodHelper(), getCallOptions()), request);
getChannel().newCall(getBatchGetAssetsHistoryMethod(), getCallOptions()), request);
}
}

Expand Down Expand Up @@ -517,8 +508,8 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() {
result =
io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new AssetServiceFileDescriptorSupplier())
.addMethod(getExportAssetsMethodHelper())
.addMethod(getBatchGetAssetsHistoryMethodHelper())
.addMethod(getExportAssetsMethod())
.addMethod(getBatchGetAssetsHistoryMethod())
.build();
}
}
Expand Down
10 changes: 10 additions & 0 deletions grpc-google-cloud-asset-v1p1beta1/clirr-ignored-differences.xml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
<differences>
<difference>
<!-- TODO: remove after 1.1.1 released -->
<differenceType>6001</differenceType>
<className>com/google/cloud/asset/v1p1beta1/*Grpc</className>
<field>METHOD_*</field>
</difference>
</differences>

0 comments on commit 1b62627

Please sign in to comment.