google / google/protobuf-gradle-plugin
protobuf dependency configuration is marked consumable
- Dominant language
- Groovy
- Stars
- 1.8k
- Forks
- 288
- PR merge metrics
- No merged PRs in 30d
Description
The `protobuf` dependecy configuration (used to pull in artifacts containing `proto` files that need code generation) appears to mark both `isCanBeConsumed` and `isCanBeResolved` as `true`, which is no longer recommended by Gradle (table just above [here](https://docs.gradle.org/current/userguide/declaring_dependencies.html#sec:choosing-configuration).
The `protobuf` configuration doesn't produce an artifact/variant, so it should probably have `isCanBeConsumed` set to false.
This usually isn't an issue, but in some situations the incorrect indication that `protobuf` is an outgoing variant can make configuring/customize variant selection difficult.
For example, if a plugin adds an outgoing variant that can be used by consumers with the `protobuf` configuration, and also wants the make the `protobuf` configuration prefer variants tagget with a certain attribute, the vestigial `isCanBeConsumed` `protobuf` configuration causes variant selection ambiguity.
I can work around this myself by disabling `isCanBeConsumed` on `protobuf` myself, but ideally the `protobuf-gradle-plugin` configurations would have the resolvable/consumable flags set appropriately.
This would be a fairly minor change [here](https://github.com/google/protobuf-gradle-plugin/blob/master/src/main/groovy/com/google/protobuf/gradle/ProtobufPlugin.groovy#L176) to set the consumable flag to `false`.
I'm not aware if this behavior is relied upon somehow, but I don't see any variant configuration associated with these configurations, so it appears to be safe.
Contributor guide
Assessment
This issue has not been assessed yet.