google / protobuf-gradle-plugin

Protobuf Plugin for Gradle
Other
1.77k stars 274 forks source link

Support descriptor_set_in protoc option #251

Open rbbrns opened 6 years ago

rbbrns commented 6 years ago

--descriptor_set_in=FILES Specifies a delimited list of FILES each containing a FileDescriptorSet (a protocol buffer defined in descriptor.proto). The FileDescriptor for each of the PROTO_FILES provided will be loaded from these FileDescriptorSets. If a FileDescriptor appears multiple times, the first occurrence will be used.

This option cannot be used with --protop_path: "Only one of --descriptor_set_in and --proto_path can be specified."

zpencer commented 6 years ago

If the idea is to support both flags, the behavior is from the underlying protoc compiler, and the enhancement idea should be discussed there: https://github.com/google/protobuf/issues/3973

Are you trying to use descriptor_set_in alone for the gradle plugin?

rbbrns commented 6 years ago

Sorry for not being more clear. I want to to be able to use descriptor_set_in from the gradle plugin. I was just documenting that descriptor_set_in and proto_path cannot be used together since it isn't clear from the descriptor_set_in documentation.

tatemz commented 4 years ago

I would much rather have this feature over copying my proto files across projects. Can we dig this issue back out of the 2018 Issue Graveyard? :smile:

I have already started looking at the plugin source code but don't know gradle or groovy well enough to discern what types of changes to make.

I think we have to divide the problem into two parts:

  1. Optionally using descriptor files as a gradle source set

  2. When using descriptor sets, protoc still needs to know which files within the descriptor set to compile

    • This could be a string list :man_shrugging:
    • Or this could be another source set, but if the source set is detected to be empty (which it would be when using a descriptor set), then the compile task is skipped (link).

Could really some suggestions from the repo owners on this one. :pray:

friscoMad commented 3 months ago

Any news on this? It has been a long time and I see there was an attempt to add this in a PR 2 years ago, but seems that it was stalled.