ga4gh / ga4gh-schemas

Models and APIs for Genomic data. RETIRED 2018-01-24
http://ga4gh.org
Apache License 2.0
214 stars 110 forks source link

protobuf java square write code-gen #868

Open jpdna opened 7 years ago

jpdna commented 7 years ago

I'm trying to generate code from the GA4GH-schema proto files using:

https://github.com/square/wire

At the moment I am chasing down file dependencies as maven is telling me:

Wire Plugin: Failure compiling proto sources. Failed to locate google/protobuf/struct.proto

I note that: https://github.com/ga4gh/ga4gh-schemas/blob/master/src/main/proto/ga4gh/variants.proto#L10

refers to "google/protobuf/struct.proto"

and GA4GH-schema repo contains a few of these proto files from google.api https://github.com/ga4gh/ga4gh-schemas/tree/master/src/main/proto/google/api

but not struct.proto

I am curious as to why we include in our GA4GH-schema repo these annotations.proto and http.proto files at all as they don't seem project specific (did we require some custom hacked version?), and why struct.proto is not there. I can find it here:

https://github.com/google/protobuf/tree/master/src/google/protobuf but am concerned with the versioning, and think it is strange we have our own copies anyhow.

Here is my non-working attempt to use square write pb code-gen: https://github.com/jpdna/mango/tree/wire_proto

@heuermh may have thoughts as well

david4096 commented 7 years ago

Google ships the struct.proto here https://github.com/google/protobuf/blob/master/src/google/protobuf/struct.proto which is included when you do protoc.

ejacox commented 7 years ago

As for why we have our own copies: https://github.com/ga4gh/ga4gh-schemas/issues/696

Is this too much of an implementation detail? Would the APIs be cleaner without them?

david4096 commented 7 years ago

Protobuf gives you a nice way to namespace packages, and including them is done with a -I just like one might imagine for compiling C code. I would like to keep them in a separate repository, but we need to offer a way to easily get them (for people like Justin), when they go to compile. Until there's a "proto repository" of sorts, some combination of keeping your own copy, git submodules, or downloading via a script are our best options. I think we could close this by adding the struct.proto to our repo. Since we use protoc we get some of Google's dependencies for free.

I'm really happy to learn about Wire, we need alternative implementations of protobuf, especially at the code generation end.