Re: [protobuf] Re: execute multiple .proto files

2012-01-26 Thread Tom Swirly
You're trying to compile the single file named test1.proto;test2.proto
instead of the two files test.proto and test2.proto.  I assume this is
something to do with your build file (is it Ant?  I'm not an expert in it
anyway).

Either separate the file names with spaces or (probably better) arrange it
so the files are compiled individually.



On Thu, Jan 26, 2012 at 12:48 PM, joel
joel.lafond.lapa...@usherbrooke.cawrote:

 sorry i just copy and paste an other message i don't want to execute I
 want to
 compile!! and here's my error message:

 Project c:\dir1\dir2\dir3\prototest.xml on node 0 (default targets).
  Generating DTO for c++
  test1.proto;test2.proto: No such file or directory
 c:\dir1\dir2\dir3\dir4\dir5\dir6\dir7\prototest.xml(20,7): error MSB3073:
 The
 command C:\code\protobuf\protoc.exe --cpp_out=. test1.proto;test2.proto
 exited
 with code 1.




 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To post to this group, send email to protobuf@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.




-- 
 /t

http://radio.swirly.com - art music radio 24/7 366/1000

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@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] Re: execute multiple .proto files

2012-01-26 Thread Tom Swirly
On Thu, Jan 26, 2012 at 1:02 PM, joel joel.lafond.lapa...@usherbrooke.cawrote:


 I'm not a expert too ... I can't compile individually because
 both file depend on  the other.


You should set the proto path using --proto_path to be the root directory
of your protocol buffer files, and then you don't need to compile them
together.

But if you're saying that test1.proto depends on test2.proto, and
test2.proto depends on test1.proto - well, that's simply a bad idea.  I'm
not 100% sure that the protocol buffer compiler will even accept that
(though it probably will), but it's a terrible idea conceptually.

Because there are no forward references and no cycles, you can *always* break
up your protocol buffer files so that this doesn't happen!




 I think i will merge everything
 in 1 proto ... it's gonna be long but
 more simple!!


Unless there are only ever going to be two protocol buffers, and their
files are small, this is not a great idea.  It's going to make your builds
progressively longer, it makes maintenance harder, there's no good reason
for it.

Take the extra time and master this tool - it's extremely powerful and
flexible, the small amounts of time you spend now will pay off 10x over
your project.




 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To post to this group, send email to protobuf@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.




-- 
 /t

http://radio.swirly.com - art music radio 24/7 366/1000

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@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] Re: execute multiple .proto files

2012-01-26 Thread Tom Swirly
This is the script I use to compile my protocol buffer files.  The last few
lines are the key ones - I use find to locate all the protocol buffer
files relative to the root directory $SRC_ROOT and then pass all of those
files to the protocol compiler, and it stores the results elsewhere, under
$PROTO_ROOT.

I have quite a lot of proto files, so this is very convenient so that my
generated _pb.cc and .pb.h files don't litter my source directories (and so
I can blow away all the generated files without fear...)

Sorry, I won't be able to help with more details on how I do it, have fun!


PACKAGE=protobuf
CONFIG=debug

source $ROOT/rec/scripts/variables.sh

SRC_ROOT=$ROOT/rec/src
PROTO_ROOT=$ROOT/rec/genfiles/proto

mkdir -p $PROTO_ROOT
echo Deleting `find $PROTO_ROOT -name \*.pb.\* | wc -l` compiled files.
find $PROTO_ROOT -name \*.pb.\* | xargs rm

find $SRC_ROOT -name \*.proto |\
 xargs $INSTALL_DIR/bin/protoc\
   --proto_path $SRC_ROOT\
   --proto_path $ROOT/build/$CONFIG/protobuf/include\
   --cpp_out=$PROTO_ROOT





On Thu, Jan 26, 2012 at 1:58 PM, joel joel.lafond.lapa...@usherbrooke.cawrote:

 Yeah you are right i will check what i can do with this and I'll post back
 if I
 have other question

 Do you have an example to see how using  --proto_path

 Thanks


 --
 You received this message because you are subscribed to the Google Groups
 Protocol Buffers group.
 To post to this group, send email to protobuf@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.




-- 
 /t

http://radio.swirly.com - art music radio 24/7 366/1000

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@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.