This parses .proto
files. It produces output based on custom generators. It comes with a generator of Mongo DB schema.
Based on https://github.com/Tand0/javaccProto.
gradle clean build
To invoke directly,
- Download apache-commons-cli.jar
- Run:
java -cp build/libs/protopick.jar -cp apache-commons-cli.jar io.github.protopick.compile.Run
. That gives you help on the parameters.
To invoke from Gradle, run:
gradle run --args='actual arguments'
For example:
gradle run "--args=-I proto-test -f User.proto -p io.github.protopick.generate.MessagesMongo" --quiet > User.js
echo "db = db.getSiblingDB('User');" | cat /dev/stdin User.js | mongo
For help on the actual arguments, invoke:
gradle run
or gradle run --args='--help'
Far from complete. It's not complete, but it supports enum, message, repeated
and basic built-in types (string, int32, int64, bool
).
For now it fails if there's an external import
or type (from Google), except for
google/protobuf/any.proto
(which is OK). So comment out imports like
google/protobuf/field_mask.proto
and their usage.
If you define a message called Any, you're in trouble (regardless of whether you import
google/protobuf/any.proto
or not).
The plugin API is likely to change.
We don't support reading from standard input or writing to standard output. If you need that, pass -f /dev/stdin
(and --I /dev
), and/or -o /dev
and (TODO:) use a plugin that specifies output filename to be stdout
.
For later:
gradle run --args='-I proto-test -g io.github.protopick.generate.MessagesMongo -ep OuterMost=outer_most.js relative-sub-types.proto'