google / google/protobuf-gradle-plugin

Support Kotlin multiplatform builds

Open
#497 6 comments 37 reactions 0 assignees View on GitHub
enhancement
Dominant language
Groovy
Stars
1.8k
Forks
288
PR merge metrics
No merged PRs in 30d

Description

I'd like to combine separate Gradle projects for generation of Android client protobuf Java (lite) sources and server protobuf Java sources into a single project via a Kotlin multiplatform Gradle project. Clearly the intention of the protobuf Gradle plugin is to generate sources for different languages & flavors within a single project; it should support this use case. Conceptually it seems the most sensible way to set up Gradle-based protobuf code generation when Android is involved.

Some problems I encountered:
- Single Gradle protobuf block not allowing me to specify different codegen options for builtins & plugins for the various multiplatform targets, in particular `option("lite")`.
- Plugin generates code only for Android build configurations "debug" and "release". No code is generated for the "jvm" multiplatform target (the server protobuf sources).
- Plugin by default compiles protobuf source from "src/main/proto" rather than "src/commonMain/proto" or any of the other actual multiplatform sourcesets.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the protobuf Gradle plugin's handling of builtins and plugins across Kotlin multiplatform targets, especially Android debug/release and the jvm target. Compare how it selects protobuf sources from src/main/proto versus multiplatform source sets. Done means one project can generate the requested Android lite and server Java sources with target-specific options.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.