I'm integrating protobuf into a custom build system based on GNU make, call it yamake ("yet another make") and a proprietary IDL-like language, call it SDL ("sort-of definition language"). SDL is firmly rooted in the culture and systems, so it is non-negotiable. Over the course of the past few days, learned the steps:
- Write a backend for the Python compiler script which translates SDL to your target language, in my case protobuf.
- Hand off protobuf backend to guru colleague who munges it to better match the overall systems, and patches it into yamake.
- Work on
makefile
to actually build usable jar of compiled protobuf for Java. - Watch colleague redo munging to something more permanent, less hacktastic.
- Rework on
makefile
to actually build usable jar of compiled protobuf for Java. - Roll fake maven local repo holding new jar, of course yamake knows nothing about deploying jars.
- Build new CORBA IDL jar for Java including new interfaces to access protobuf in other systems.
But this is not the point of my post.
Yamake is a wrapper around venerable GNU make, so I am editing makefiles. Ultimately I have this dependency chain: SDL to protobuf to Java to classes to jar. But watch:
$ sdlc -t protobuf foobar.sdl -o proto/foobar.proto $ protoc --java_out=java proto/foobar.proto $ javac -sourcepath java java/my/package/FoobarProtos.java $ jar cf foobar.jar -C java my/package/FoobarProtos*.classIt's actually more Rube-Goldbergesque than this, as the C++ versions of the protobuf play games with namespaces requiring various flags at various stages along with directory changes. So I made Java keep up. You come up with dependency rules that cope with
option java_package = "something.random"
and option java_outer_classname="SomethingProtos"
and mismatched output directories!I opted for using helper shell scripts for parsing protobuf for proper Java packages with class names and generating dependency makefiles to include in my actual
makefile
.Maven, remind me to quit poking on you for your ugly XML and ridiculously noisy output. I forgot all the love you give me.
No comments:
Post a Comment