Skip to content

Commit 2bb72df

Browse files
committed
Minimum generator change. Mix location, iampolicy, lro into datamigration service
1 parent 24e293e commit 2bb72df

File tree

104 files changed

+2686
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2686
-309
lines changed

generator/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ add_library(
9696
internal/metadata_decorator_generator.h
9797
internal/metadata_decorator_rest_generator.cc
9898
internal/metadata_decorator_rest_generator.h
99+
internal/mixin_utils.cc
100+
internal/mixin_utils.h
99101
internal/mock_connection_generator.cc
100102
internal/mock_connection_generator.h
101103
internal/option_defaults_generator.cc

generator/google_cloud_cpp_generator.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ google_cloud_cpp_generator_hdrs = [
5050
"internal/make_generators.h",
5151
"internal/metadata_decorator_generator.h",
5252
"internal/metadata_decorator_rest_generator.h",
53+
"internal/mixin_utils.h",
5354
"internal/mock_connection_generator.h",
5455
"internal/option_defaults_generator.h",
5556
"internal/options_generator.h",
@@ -108,6 +109,7 @@ google_cloud_cpp_generator_srcs = [
108109
"internal/make_generators.cc",
109110
"internal/metadata_decorator_generator.cc",
110111
"internal/metadata_decorator_rest_generator.cc",
112+
"internal/mixin_utils.cc",
111113
"internal/mock_connection_generator.cc",
112114
"internal/option_defaults_generator.cc",
113115
"internal/options_generator.cc",

generator/integration_tests/golden/v1/internal/golden_kitchen_sink_stub.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class DefaultGoldenKitchenSinkStub : public GoldenKitchenSinkStub {
129129
public:
130130
explicit DefaultGoldenKitchenSinkStub(
131131
std::unique_ptr<google::test::admin::database::v1::GoldenKitchenSink::StubInterface> grpc_stub)
132-
: grpc_stub_(std::move(grpc_stub)) {}
132+
: grpc_stub_(std::move(grpc_stub)){}
133133

134134
StatusOr<google::test::admin::database::v1::GenerateAccessTokenResponse> GenerateAccessToken(
135135
grpc::ClientContext& context,

generator/integration_tests/golden/v1/internal/golden_thing_admin_stub.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ class GoldenThingAdminStub {
189189
class DefaultGoldenThingAdminStub : public GoldenThingAdminStub {
190190
public:
191191
DefaultGoldenThingAdminStub(
192-
std::unique_ptr<google::test::admin::database::v1::GoldenThingAdmin::StubInterface> grpc_stub,
193-
std::unique_ptr<google::longrunning::Operations::StubInterface> operations)
194-
: grpc_stub_(std::move(grpc_stub)),
195-
operations_(std::move(operations)) {}
192+
std::unique_ptr<google::test::admin::database::v1::GoldenThingAdmin::StubInterface> grpc_stub
193+
,std::unique_ptr<google::longrunning::Operations::StubInterface> operations)
194+
: grpc_stub_(std::move(grpc_stub))
195+
, operations_(std::move(operations)) {}
196196

197197
StatusOr<google::test::admin::database::v1::ListDatabasesResponse> ListDatabases(
198198
grpc::ClientContext& context,

generator/integration_tests/golden/v1/internal/request_id_stub.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ class RequestIdServiceStub {
8282
class DefaultRequestIdServiceStub : public RequestIdServiceStub {
8383
public:
8484
DefaultRequestIdServiceStub(
85-
std::unique_ptr<google::test::requestid::v1::RequestIdService::StubInterface> grpc_stub,
86-
std::unique_ptr<google::longrunning::Operations::StubInterface> operations)
87-
: grpc_stub_(std::move(grpc_stub)),
88-
operations_(std::move(operations)) {}
85+
std::unique_ptr<google::test::requestid::v1::RequestIdService::StubInterface> grpc_stub
86+
,std::unique_ptr<google::longrunning::Operations::StubInterface> operations)
87+
: grpc_stub_(std::move(grpc_stub))
88+
, operations_(std::move(operations)) {}
8989

9090
StatusOr<google::test::requestid::v1::Foo> CreateFoo(
9191
grpc::ClientContext& context,

generator/internal/auth_decorator_generator.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ AuthDecoratorGenerator::AuthDecoratorGenerator(
2828
google::protobuf::ServiceDescriptor const* service_descriptor,
2929
VarsDictionary service_vars,
3030
std::map<std::string, VarsDictionary> service_method_vars,
31-
google::protobuf::compiler::GeneratorContext* context)
31+
google::protobuf::compiler::GeneratorContext* context,
32+
std::vector<MixinMethod> const& mixin_methods)
3233
: StubGeneratorBase("auth_header_path", "auth_cc_path", service_descriptor,
3334
std::move(service_vars), std::move(service_method_vars),
34-
context) {}
35+
context, mixin_methods) {}
3536

3637
Status AuthDecoratorGenerator::GenerateHeader() {
3738
HeaderPrint(CopyrightLicenseFileHeader());

generator/internal/auth_decorator_generator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class AuthDecoratorGenerator : public StubGeneratorBase {
3737
google::protobuf::ServiceDescriptor const* service_descriptor,
3838
VarsDictionary service_vars,
3939
std::map<std::string, VarsDictionary> service_method_vars,
40-
google::protobuf::compiler::GeneratorContext* context);
40+
google::protobuf::compiler::GeneratorContext* context,
41+
std::vector<MixinMethod> const& mixin_methods);
4142

4243
~AuthDecoratorGenerator() override = default;
4344

generator/internal/client_generator.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ ClientGenerator::ClientGenerator(
3232
google::protobuf::ServiceDescriptor const* service_descriptor,
3333
VarsDictionary service_vars,
3434
std::map<std::string, VarsDictionary> service_method_vars,
35-
google::protobuf::compiler::GeneratorContext* context)
35+
google::protobuf::compiler::GeneratorContext* context,
36+
std::vector<MixinMethod> const& mixin_methods)
3637
: ServiceCodeGenerator("client_header_path", "client_cc_path",
3738
service_descriptor, std::move(service_vars),
38-
std::move(service_method_vars), context) {
39+
std::move(service_method_vars), context,
40+
mixin_methods) {
3941
// Remember if there are methods from google.iam.v1.GetIamPolicyRequest and
4042
// google.iam.v1.SetIamPolicyRequest to google.iam.v1.Policy with signature
4143
// extensions. If so, we'll generate a "set" wrapper method to help prevent

generator/internal/client_generator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class ClientGenerator : public ServiceCodeGenerator {
3636
ClientGenerator(google::protobuf::ServiceDescriptor const* service_descriptor,
3737
VarsDictionary service_vars,
3838
std::map<std::string, VarsDictionary> service_method_vars,
39-
google::protobuf::compiler::GeneratorContext* context);
39+
google::protobuf::compiler::GeneratorContext* context,
40+
std::vector<MixinMethod> const& mixin_methods);
4041

4142
~ClientGenerator() override = default;
4243

generator/internal/connection_generator.cc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "generator/internal/pagination.h"
2020
#include "generator/internal/predicate_utils.h"
2121
#include "generator/internal/printer.h"
22+
#include "absl/strings/str_split.h"
2223
#include <google/protobuf/descriptor.h>
2324

2425
namespace google {
@@ -29,10 +30,12 @@ ConnectionGenerator::ConnectionGenerator(
2930
google::protobuf::ServiceDescriptor const* service_descriptor,
3031
VarsDictionary service_vars,
3132
std::map<std::string, VarsDictionary> service_method_vars,
32-
google::protobuf::compiler::GeneratorContext* context)
33+
google::protobuf::compiler::GeneratorContext* context,
34+
std::vector<MixinMethod> const& mixin_methods)
3335
: ServiceCodeGenerator("connection_header_path", "connection_cc_path",
3436
service_descriptor, std::move(service_vars),
35-
std::move(service_method_vars), context) {}
37+
std::move(service_method_vars), context,
38+
mixin_methods) {}
3639

3740
Status ConnectionGenerator::GenerateHeader() {
3841
HeaderPrint(CopyrightLicenseFileHeader());
@@ -68,11 +71,14 @@ Status ConnectionGenerator::GenerateHeader() {
6871
: "",
6972
IsExperimental() ? "google/cloud/experimental_tag.h" : "",
7073
"google/cloud/version.h"});
71-
HeaderSystemIncludes(
72-
{vars("proto_header_path"), vars("additional_pb_header_paths"),
73-
HasGRPCLongrunningOperation() ? "google/longrunning/operations.grpc.pb.h"
74-
: "",
75-
"memory"});
74+
std::vector<std::string> const additional_pb_header_paths =
75+
absl::StrSplit(vars("additional_pb_header_paths"), absl::ByChar(','));
76+
HeaderSystemIncludes(additional_pb_header_paths);
77+
HeaderSystemIncludes({vars("proto_header_path"),
78+
HasGRPCLongrunningOperation()
79+
? "google/longrunning/operations.grpc.pb.h"
80+
: "",
81+
"memory"});
7682
switch (endpoint_location_style) {
7783
case ServiceConfiguration::LOCATION_DEPENDENT:
7884
case ServiceConfiguration::LOCATION_DEPENDENT_COMPAT:

0 commit comments

Comments
 (0)