[protobuf] How to get rid of metadata only extensions dependencies

2010-05-14 Thread Igor Gatis
So, let's say I'm developing a plugin which, say, add or removes builder
pattern to java generator (this is actually a real use case). So I created a
.proto file with my plugin metadata info:

MyPluginMetadata.proto:

import google/protobuf/descriptor.proto

extend google.protobuf.MessageOptions {
  optional bool use_builder_pattern = 50001;
}


Now I can just do:

MyAppMessages.proto:

import path/to/MyPluginMetadata.proto

message Foo {
  option (use_builder_pattern) = true;
}


Now, when I ask protoc to generate code for MyAppMessages.proto, I
get MyAppMessages.java which depends on MyPluginMetadata.java, even
though MyPluginMetadata.proto solely provides metadata extensions. Is there
a way to avoid that?

Thanks,
-Gatis

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] How to get rid of metadata only extensions dependencies

2010-05-14 Thread Jason Hsueh
No, there isn't any way to remove the dependency. The compiler doesn't try
to detect why you defined an import.

On Fri, May 14, 2010 at 2:38 PM, Igor Gatis igorga...@gmail.com wrote:

 So, let's say I'm developing a plugin which, say, add or removes builder
 pattern to java generator (this is actually a real use case). So I created a
 .proto file with my plugin metadata info:

 MyPluginMetadata.proto:

 import google/protobuf/descriptor.proto

 extend google.protobuf.MessageOptions {
   optional bool use_builder_pattern = 50001;
 }


 Now I can just do:

 MyAppMessages.proto:

 import path/to/MyPluginMetadata.proto

 message Foo {
   option (use_builder_pattern) = true;
 }


 Now, when I ask protoc to generate code for MyAppMessages.proto, I
 get MyAppMessages.java which depends on MyPluginMetadata.java, even
 though MyPluginMetadata.proto solely provides metadata extensions. Is there
 a way to avoid that?

 Thanks,
 -Gatis

 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To post to this group, send email to proto...@googlegroups.com.
 To unsubscribe from this group, send email to
 protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/protobuf?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.