google / google/protobuf-gradle-plugin
Consider splitting protobuf plugin into several ones for separating capabilities from conventions
- Dominant language
- Groovy
- Stars
- 1.8k
- Forks
- 288
- PR merge metrics
- No merged PRs in 30d
Description
See https://docs.gradle.org/current/userguide/designing_gradle_plugins.html#capabilities-vs-conventions
It would be nice, if adding protobuf plugin to a java library would automatically configure protoc tasks with a reasonable default protoc version.
In other words:
Example "default automatic configuration":
```diff
plugins {
id("java-library")
+ id("com.google.protobuf") version "0.8.19" // it would automatically configure protoc for "main" source set
}
```
Example "no defaults, user configures everything":
```diff
plugins {
id("java-library")
+ id("com.google.protobuf.base") version "0.8.19" // It would skip all default protoc mapping, and it would defer to the user
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.9.1")
+. // The user will be able to fine-tune protobuf configuration
+ protobufCompiler("com.google.protobuf:protoc:3.21.7")
+ protobufPlugin("io.grpc:protoc-gen-grpc-java:1.50.0")
}
```
Multiple plugins can be shipped within a single jar, and the key point is that `com.google.protobuf.base` would implement basic set of APIs, configurations, etc, and `com.google.protobuf` (or `com.google.protobuf.auto` or whatever you call it) would `apply(plugin = "com.google.protobuf.base")`, then it would configure protoc for the main sourceSet when `java-library` plugin is detected.
Contributor guide
Assessment
This issue has not been assessed yet.