Skip to content

Commit 5ddde99

Browse files
committed
.
1 parent 83ac54d commit 5ddde99

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

generator/internal/make_generators.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ std::vector<std::unique_ptr<GeneratorInterface>> MakeGenerators(
6969
absl::optional<std::string> body = mixin_method.method_override.http_body;
7070

7171
std::cout << mixin_method.method.get().full_name() << " "
72+
<< mixin_method.grpc_stub_fqn << " "
73+
<< mixin_method.grpc_stub_name << " "
7274
<< mixin_method.method_override.http_verb << " "
7375
<< mixin_method.method_override.http_path << " "
7476
<< (body.has_value() ? *body : "") << std::endl;

generator/internal/mixin_utils.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "generator/internal/mixin_utils.h"
2+
#include "generator/internal/codegen_utils.h"
23
#include "google/cloud/log.h"
4+
#include "absl/strings/ascii.h"
35
#include "absl/types/optional.h"
46
#include <google/protobuf/compiler/code_generator.h>
57
#include <yaml-cpp/yaml.h>
@@ -133,7 +135,9 @@ std::vector<MixinMethod> GetMixinMethods(YAML::Node const& service_config,
133135
mixin_method_overrides.end())
134136
continue;
135137
mixin_methods.push_back(
136-
{*mixin_method, mixin_method_overrides[mixin_method_full_name]});
138+
{absl::AsciiStrToLower(mixin_service->name()) + "_stub",
139+
ProtoNameToCppName(mixin_service->full_name()), *mixin_method,
140+
mixin_method_overrides[mixin_method_full_name]});
137141
}
138142
}
139143
}

generator/internal/mixin_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ struct MixinMethodOverride {
3232
};
3333

3434
struct MixinMethod {
35+
std::string grpc_stub_name;
36+
std::string grpc_stub_fqn;
3537
std::reference_wrapper<google::protobuf::MethodDescriptor const> method;
3638
MixinMethodOverride method_override;
3739
};

generator/internal/stub_factory_generator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Status StubFactoryGenerator::GenerateCc() {
9090
std::vector<std::string> headers =
9191
absl::StrSplit(vars("mixin_proto_grpc_header_paths"), ",");
9292
headers.insert(headers.end(),
93-
{vars("proto_grpc_header_path"), "memory", "utility"});
93+
{vars("proto_grpc_header_path"), "memory", "utility"});
9494
CcSystemIncludes(headers);
9595

9696
auto result = CcOpenNamespaces(NamespaceType::kInternal);

generator/internal/stub_generator.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ StubGenerator::StubGenerator(
3535
std::vector<MixinMethod> const& mixin_methods)
3636
: StubGeneratorBase("stub_header_path", "stub_cc_path", service_descriptor,
3737
std::move(service_vars), std::move(service_method_vars),
38-
context, mixin_methods) {}
38+
context, mixin_methods),
39+
mixin_methods_(mixin_methods) {}
3940

4041
Status StubGenerator::GenerateHeader() {
4142
HeaderPrint(CopyrightLicenseFileHeader());
@@ -236,6 +237,10 @@ Status StubGenerator::GenerateHeader() {
236237
"\n"
237238
"class Default$stub_class_name$ : public $stub_class_name$ {\n"
238239
" public:");
240+
// std::string mixin_stub = "";
241+
// for (auto const& mixin_method : mixin_methods_) {
242+
// mixin_stub += ",\n " + mixin_method.grpc_stub_name + "_(std::move"
243+
// }
239244
if (HasLongrunningMethod()) {
240245
HeaderPrint( // clang-format off
241246
"\n"

generator/internal/stub_generator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class StubGenerator : public StubGeneratorBase {
5151
private:
5252
Status GenerateHeader() override;
5353
Status GenerateCc() override;
54+
std::vector<MixinMethod> mixin_methods_;
5455
};
5556

5657
} // namespace generator_internal

0 commit comments

Comments
 (0)