Skip to content

Introduce PipelineSetup testing utility#230

Merged
alexander-yevsyukov merged 49 commits intomasterfrom
protodata-testlib
May 9, 2024
Merged

Introduce PipelineSetup testing utility#230
alexander-yevsyukov merged 49 commits intomasterfrom
protodata-testlib

Conversation

@alexander-yevsyukov
Copy link
Collaborator

@alexander-yevsyukov alexander-yevsyukov commented Apr 22, 2024

This PR initiates protodata-testlib artifact with the PipelineSetup utility.

Code generation process for a ProtoData plugin requires an instance of Pipeline.
Its constructor accepts CodeGeneratorRequest instance.
There are simplest cases of code generation (e.g. TypeAnnotation and derived classes) that do not require much from the information coming from protoc. For such cases we can pass CodeGeneratorRequest.getDefaultInstance(). More sophisticated codegen needs a legitimate CodeGeneratorRequest because Pipeline produces numerous events about the Protobuf code out of it.

PipelineSetup class can be created in two ways. The first way, through the primary constructor, is for the rare cases of having the generated code and CodeGeneratorRequest instance already available some way. The second, recommended, way is through the factory method byResources, which assumes having ProtoTap Gradle Plugin added to the project. Please see the documentation for the PipelineSetup class for more details.

Other notable changes

  • The SettingsDirectory.directory property was renamed to path for better readability at the use sites.
  • Extensions for Format enum items were sorted in the order from most to least expected.
  • Improved documentation of the main() of the ProtoData protoc plugin.

@alexander-yevsyukov alexander-yevsyukov self-assigned this Apr 22, 2024
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review May 9, 2024 00:20
@alexander-yevsyukov alexander-yevsyukov requested a review from armiol May 9, 2024 00:20
Copy link
Collaborator

@armiol armiol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-yevsyukov LGTM with some comments.

@alexander-yevsyukov alexander-yevsyukov requested a review from armiol May 9, 2024 13:55
@alexander-yevsyukov alexander-yevsyukov merged commit 8fab442 into master May 9, 2024
@alexander-yevsyukov alexander-yevsyukov deleted the protodata-testlib branch May 9, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants