Skip to content

Conversation

@alexander-yevsyukov
Copy link
Contributor

@alexander-yevsyukov alexander-yevsyukov commented Oct 13, 2025

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 under buildSrc in the ProtoTaskExtensions.kt file. 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-plugins module and other improvements are described in the sections below.

DescriptorSetFilePlugin

This plugin configures Protobuf generation tasks to produce descriptor set files and expose them as resources of the corresponding source set.

GeneratedSourcePlugin

This plugin makes GenerateProtoTask copy the produced sources under $projectDir/generated/ directory, and updates project compilation tasks accordingly.

Using MavenPublication for calculating MavenArtifact for a project

The Project.artifact(SourceSetName) extension function was improved to take a name of a project's MavenPublication instead of Project.name when creating corresponding instance of MavenArtifact. If a project is not published, the Project.name is used as before.

Consolidation of code related to Protobuf Gradle Plugin

The code related to configuring Protobuf Gradle Plugin was moved from plugin-base module to the protobuf-setup-plugins module.

runGradleBuild function got optional parameters

Optional parameters stdOutput and stdError were introduced to allow stream redirection at the usage sites to System.err when needed.

@alexander-yevsyukov alexander-yevsyukov marked this pull request as draft October 13, 2025 20:38
@alexander-yevsyukov alexander-yevsyukov self-assigned this Oct 13, 2025
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.
@alexander-yevsyukov alexander-yevsyukov changed the title Introduce Protobuf tool plugins module Introduce protobuf-setup-plugins module Oct 17, 2025
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review October 17, 2025 16:37
Copy link
Contributor

Copilot AI left a 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-plugins module with two main plugins: DescriptorSetFilePlugin and GeneratedSourcePlugin
  • 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.

alexander-yevsyukov and others added 3 commits October 17, 2025 21:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@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 except for a minor comment.

@alexander-yevsyukov alexander-yevsyukov merged commit 90feab6 into master Oct 18, 2025
6 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the descriptor-set-file-plugin branch October 18, 2025 14:35
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.

3 participants