localshred/protobuf — Issue #9: imports from imported proto files fail on loading dependancy
Author: ljackson
Created: 2012-03-06 15:11:10+00:00
State: open

I am testing out using ruby protobuf for some code, the google protobuf implementation is ok with this type of nesting in fact it is required for message reuse. Seems like it should be a simple thing to fix with the import statement and it's resolution path. Reproducible with:

gem protobuf (1.1.3)
ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]

#test/TestMessage.proto

package com.test;
option java_outer_classname = "Test";

import "TestService.proto";
import "TestMessageResponse.proto";

message TestMessage {
optional TestService svc = 1;
optional TestMessageResponse res = 2;
}

#test/TestService.proto

package com.test;

option java_outer_classname = "SVC";

message TestService {
optional string name = 1;
}

#test/TestMessageResponse.proto

package com.test;

option java_outer_classname = "Res";

import "TestService.proto";

message TestMessageResponse {
optional string message = 1;
optional TestService svc = 2;
}

rprotoc -p test/ test/TestMessage.proto test/TestService.proto test/TestMessageResponse.proto
wrote ./com/test/TestService.pb.rb
wrote ./com/test/TestService.pb.rb
Error creating file ./TestMessageResponse.pb.rb
cannot load such file -- TestService.pb

with protoc from libprotoc 2.4.1

protoc --cpp_out=. --java_out=. --python_out=. --proto_path=test/ test/TestMessage.proto test/TestService.proto test/TestMessageResponse.proto

nothing to stdout all files generated as expected...

Thoughts? I am using zeromq for RPC and other work so I don't need the RPC functions thus the service in this test example doesn't have anything to do with protobuf RPC services.

Thanks,
Leif