Refactor gRPC plugin implementation for modular architecture#206
Refactor gRPC plugin implementation for modular architecture#206zZHorizonZz merged 9 commits intoeclipse-vertx:mainfrom
Conversation
a46a650 to
8810b50
Compare
- Replace `VertxGrpcGeneratorImpl` with a new modular architecture for better maintainability. - Update Protobuf plugin configuration in `pom.xml` to reflect new plugin structure with `io.github.ascopes`. Signed-off-by: Daniel Fiala <danfiala23@gmail.com>
…ss modules Signed-off-by: Daniel Fiala <danfiala23@gmail.com>
…gRPC plugin flexibility
83898b0 to
73e3c95
Compare
| List<ServiceDescriptor> services = new ArrayList<>(); | ||
|
|
||
| for (DescriptorProtos.FileDescriptorProto fileProto : request.getProtoFileList()) { | ||
| if (!request.getFileToGenerateList().contains(fileProto.getName())) { |
There was a problem hiding this comment.
filtering should be done by the caller, that is the VertxGrpcGenerator should filter the list to be processed by the ProtocRequestConverter instead of relying on it to skip the files that should not be generated
There was a problem hiding this comment.
so convertServices should actually convert a single service and iteration should be done by the generator instead
| @@ -0,0 +1,21 @@ | |||
| package io.vertx.grpc.plugin.template; | |||
There was a problem hiding this comment.
at the moment we have only one engine, so we just need the MustatcheTemplateEngine class and the builder does not need to care about it because it's always the same
| */ | ||
| public abstract class CodeGenerator { | ||
|
|
||
| protected final TemplateEngine templateEngine; |
There was a problem hiding this comment.
the CodeGenerator does not need to keep a reference to the template engine as we only have a single engine that is the mustache engine, this will simplify a bit.
| return null; | ||
| } | ||
|
|
||
| public static class Builder { |
There was a problem hiding this comment.
this is only used by VertxGrpcGenerator to build a list of generator that are then iterated to generate the code, we don't really need that at the moment. The setup then generate can be fully done in the VertxGrpcGenerator.
…gine, simplify template handling, and refactor code generation APIs for reduced complexity. Signed-off-by: Daniel Fiala <danfiala23@gmail.com>
vertx-grpc-protoc-plugin2/src/main/java/io/vertx/grpc/plugin/generation/context/NameUtils.java
Outdated
Show resolved
Hide resolved
vertx-grpc-protoc-plugin2/src/main/java/io/vertx/grpc/plugin/file/FileWriter.java
Outdated
Show resolved
Hide resolved
- Replace `mixedLower` with `formatMethodName` for clarity and consistency. - Leverage `LowerCamelCase` utility for improved maintainability.
- Simplify file handling logic by removing `FileWriter` and `ProtocFileWriter` classes. - Refactor `CodeGenerationEngine` to eliminate dependency on file writing.
Refactor the gRPC plugin by replacing
VertxGrpcGeneratorImplwith a new modular architecture to improve maintainability, and allow future extendability.This PR supersedes: #172