-
Notifications
You must be signed in to change notification settings - Fork 0
Introduce protobuf-setup-plugins module
#155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Also: * Add TODO for taking into account a Maven Publication when composing a `MavenArtifact` out of a `Project`.
We will do it manually when applying the plugin in Base.
…ugin` Also: * Extract a common test base for Protobuf tool plugins.
Also: * Improve code layout in tests.
protobuf-setup-plugins module
Also: * Use `JavaTaskName` and `SourceSetName` instead of string literals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new protobuf-setup-plugins module containing Gradle plugins for configuring Protocol Buffer compilation tasks. This consolidates previously duplicated code from buildSrc and Compiler Gradle plugins into reusable plugins.
Key Changes:
- Creates new
protobuf-setup-pluginsmodule with two main plugins:DescriptorSetFilePluginandGeneratedSourcePlugin - Migrates existing Protobuf-related code from various locations into the new module
- Updates project structure and dependency management to use the new common plugins
Reviewed Changes
Copilot reviewed 37 out of 39 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| settings.gradle.kts | Adds protobuf-setup-plugins module and reorganizes project includes |
| protobuf-setup-plugins/build.gradle.kts | New module build configuration with plugin publishing setup |
| protobuf-setup-plugins/src/main/kotlin/.../plugin/* | Core plugin implementations including DescriptorSetFilePlugin and GeneratedSourcePlugin |
| protobuf-setup-plugins/src/main/kotlin/.../gradle/* | Migrated utility classes and extensions for Protobuf operations |
| protobuf-setup-plugins/src/test/kotlin/.../plugin/* | Comprehensive test suite for the new plugins |
| plugin-base/src/main/kotlin/.../task/ProtobufTaskName.kt | Removed deprecated class (moved to new module) |
| plugin-base/src/main/kotlin/.../project/ProjectExts.kt | Enhanced artifact resolution with Maven publication support |
| jvm-tool-plugins/* | Updates to use standardized task names and plugin constants |
| Various test files | Updates to import from new module locations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
...setup-plugins/src/main/kotlin/io/spine/tools/protobuf/gradle/plugin/GeneratedSourcePlugin.kt
Outdated
Show resolved
Hide resolved
...plugins/src/test/kotlin/io/spine/tools/protobuf/gradle/plugin/DescriptorSetFilePluginSpec.kt
Outdated
Show resolved
Hide resolved
plugin-base/src/main/kotlin/io/spine/tools/gradle/project/ProjectExts.kt
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
armiol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexander-yevsyukov LGTM except for a minor comment.
This PR initiates the migration to common code base for configuring
GenerateProtoTasks of a project.Currently, we have two parts of code that do the same set of things for configuring
GenerateProtoTasks. One part of code lives underbuildSrcin theProtoTaskExtensions.ktfile. This code is used when building modules of Base and ToolBase that have Protobuf types. Another part is in the code of the Compiler and CoreJvm Compiler Gradle plugins.We aim to have the same set of Gradle plugins that would be used for building Base and ToolBase and inside Compiler and CoreJvm Compiler Gradle plugins that configure Protobuf in a project.
The plugins introduced in new
protobuf-setup-pluginsmodule and other improvements are described in the sections below.DescriptorSetFilePluginThis plugin configures Protobuf generation tasks to produce descriptor set files and expose them as resources of the corresponding source set.
GeneratedSourcePluginThis plugin makes
GenerateProtoTaskcopy the produced sources under$projectDir/generated/directory, and updates project compilation tasks accordingly.Using
MavenPublicationfor calculatingMavenArtifactfor a projectThe
Project.artifact(SourceSetName)extension function was improved to take a name of a project'sMavenPublicationinstead ofProject.namewhen creating corresponding instance ofMavenArtifact. If a project is not published, theProject.nameis used as before.Consolidation of code related to Protobuf Gradle Plugin
The code related to configuring Protobuf Gradle Plugin was moved from
plugin-basemodule to theprotobuf-setup-pluginsmodule.runGradleBuildfunction got optional parametersOptional parameters
stdOutputandstdErrorwere introduced to allow stream redirection at the usage sites toSystem.errwhen needed.