diff --git a/.gitignore b/.gitignore index 63c1c1c..6f4da85 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ protosrc .project .settings target/ +.lein-repl-history diff --git a/project.clj b/project.clj index 02ff5c2..a5d33fb 100644 --- a/project.clj +++ b/project.clj @@ -7,8 +7,9 @@ [org.flatland/useful "0.9.0"] [org.flatland/schematic "0.1.0"] [org.flatland/io "0.3.0"] - [ordered-collections "0.4.0"]] - :plugins [[lein-protobuf "0.4.1"]] + [ordered-collections "0.4.0"] + [com.google.protobuf/protobuf-java "2.5.0"] + [revise/proto-extensions "1.0.3"]] :aliases {"testall" ["with-profile" "dev,default:dev,1.3,default:dev,1.5,default" "test"]} :profiles {:1.3 {:dependencies [[org.clojure/clojure "1.3.0"]]} :1.5 {:dependencies [[org.clojure/clojure "1.5.0-master-SNAPSHOT"]]} diff --git a/resources/proto/flatland/protobuf/extensions.proto b/resources/proto/flatland/protobuf/extensions.proto deleted file mode 100644 index ee15932..0000000 --- a/resources/proto/flatland/protobuf/extensions.proto +++ /dev/null @@ -1,22 +0,0 @@ -import "google/protobuf/descriptor.proto"; - -option java_package = "flatland.protobuf"; -option java_outer_classname = "Extensions"; - -extend google.protobuf.FieldOptions { - optional bool set = 52001; - optional bool map = 52002; - optional string map_by = 52003; - optional bool counter = 52004; - optional bool succession = 52005; - optional string map_deleted = 52006; - optional string map_exists = 52007; - optional string meta = 52010; - optional bool nullable = 52020; - optional string null_string = 52021; - optional sint32 null_int = 52022; - optional sint64 null_long = 52023; - optional float null_float = 52024; - optional double null_double = 52025; - optional uint32 null_enum = 52026; -} diff --git a/resources/proto/flatland/protobuf/test/codec.proto b/resources/proto/flatland/protobuf/test/codec.proto deleted file mode 100644 index 02b6635..0000000 --- a/resources/proto/flatland/protobuf/test/codec.proto +++ /dev/null @@ -1,47 +0,0 @@ -package flatland.protobuf.test.codec; - -import "flatland/protobuf/extensions.proto"; - -option java_package = "flatland.protobuf.test"; -option java_outer_classname = "Codec"; - -message Foo { - optional int32 foo = 1; - optional int32 bar = 2; - optional int32 baz = 3; - - repeated string tags = 4; - repeated Item tag_set = 5 [(set) = true]; - repeated Entry num_map = 6 [(map) = true]; - - optional Foo nested = 7; - - repeated int32 revisions = 14; - optional fixed32 proto_length = 15; -} - -message Item { - required string item = 1; - required bool exists = 2 [default = true]; -} - -message Entry { - required int32 key = 1; - required string val = 2; -} - -message Edge { - required string to_id = 1; - optional string a = 2; - optional string b = 3; - optional bool deleted = 4; -} - -message Node { - optional string id = 1; - repeated Edge edges = 2 [(map_by) = "to_id"]; - optional int32 rev = 3; - optional int32 foo = 4; - optional string bar = 5; - repeated int32 baz = 6; -} \ No newline at end of file diff --git a/resources/proto/flatland/protobuf/test/core.proto b/resources/proto/flatland/protobuf/test/core.proto deleted file mode 100644 index 0bda650..0000000 --- a/resources/proto/flatland/protobuf/test/core.proto +++ /dev/null @@ -1,103 +0,0 @@ -package flatland.protobuf.test.core; - -import "flatland/protobuf/extensions.proto"; - -option java_package = "flatland.protobuf.test"; -option java_outer_classname = "Core"; - -message Foo { - optional uint32 id = 1 [default = 43]; - optional string label = 2 [(meta) = "{:a 1 :b 2 :c 3}"]; - repeated string tags = 3; - optional Foo parent = 4; - repeated Response responses = 5; - - repeated double doubles = 6; - repeated float floats = 7; - - optional double lat = 8; - optional float long = 9; - - repeated Count counts = 10 [(map_by) = "key"]; - - repeated Time time = 11 [(succession) = true]; - - enum Response { - yes = 0; - no = 1; - maybe = 2; - not_sure = 3; - } - - repeated Item tag_set = 20 [(set) = true]; - repeated Pair attr_map = 21 [(map) = true]; - repeated Foo foo_by_id = 22 [(map_by) = "id"]; - repeated Group groups = 23 [(map) = true]; - repeated Item item_map = 24 [(map_by) = "item"]; - repeated Pair pair_map = 25 [(map_by) = "key"]; - optional bool deleted = 26 [default = false]; - repeated Thing things = 27 [(map_by) = "id"]; -} - -message Bar { - optional int32 int = 1 [(nullable) = true, (null_int) = -1]; - optional int64 long = 2 [(nullable) = true, (null_long) = -999999999999]; - optional float flt = 3 [(nullable) = true, (null_float) = -0.0001]; - optional double dbl = 4 [(nullable) = true, (null_double) = -0.00000001]; - optional string str = 5 [(nullable) = true, (null_string) = "NULL"]; - optional Enu enu = 6 [(nullable) = true, (null_enum) = 3]; - - enum Enu { - a = 0; - b = 1; - c = 2; - nil = 3; - } - - repeated string label = 10 [(nullable) = true, (null_string) = "", (succession) = true]; - repeated string labels = 11 [(nullable) = true, (null_string) = ""]; -} - -message Time { - optional sint32 year = 1; - optional int32 month = 2; - optional int32 day = 3; - optional int32 hour = 4; - optional int32 minute = 5; -} - -message Pair { - required string key = 1; - required string val = 2; -} - -message Group { - required string key = 1; - repeated Foo val = 2; -} - -message Item { - required string item = 1; - required bool exists = 2 [default = true]; -} - -message Count { - required string key = 1; - repeated int32 i = 2 [(counter) = true]; - repeated double d = 3 [(counter) = true]; -} - -message ErrorMsg { - required sint32 code = 1; - optional string data = 2; -} - -message Response { - required bool ok = 1; - optional ErrorMsg error = 2; -} - -message Thing { - optional string id = 1; - optional bool marked = 2; -} diff --git a/resources/proto/flatland/protobuf/test/example.proto b/resources/proto/flatland/protobuf/test/example.proto deleted file mode 100644 index 1f8ac8d..0000000 --- a/resources/proto/flatland/protobuf/test/example.proto +++ /dev/null @@ -1,33 +0,0 @@ -package flatland.protobuf.test.example; - -import "flatland/protobuf/extensions.proto"; - -option java_package = "flatland.protobuf.test"; -option java_outer_classname = "Example"; - -message Photo { - required int32 id = 1; - required string path = 2; - repeated Label labels = 3 [(set) = true]; - repeated Attr attrs = 4 [(map) = true]; - repeated Tag tags = 5 [(map_by) = "person_id"]; - optional bytes image = 6; - - message Label { - required string item = 1; - required bool exists = 2; - } - - message Attr { - required string key = 1; - optional string val = 2; - } - - message Tag { - required int32 person_id = 1; - optional int32 x_coord = 2 [(meta) = "{:max 100.0 :min -100.0}"]; - optional int32 y_coord = 3; - optional int32 width = 4; - optional int32 height = 5; - } -} diff --git a/resources/proto/flatland/protobuf/test/maps.proto b/resources/proto/flatland/protobuf/test/maps.proto deleted file mode 100644 index 42891fa..0000000 --- a/resources/proto/flatland/protobuf/test/maps.proto +++ /dev/null @@ -1,29 +0,0 @@ -package flatland.protobuf.test.maps; - -import "flatland/protobuf/extensions.proto"; - -option java_package = "flatland.protobuf.test"; -option java_outer_classname = "Maps"; - -message Element { - optional string id = 1; - optional int32 foo = 2; - optional int32 bar = 3; - optional bool deleted = 4; - optional bool exists = 5; -} - -message Pair { - required string key = 1; - required Element val = 2; -} - -message Struct { - repeated Pair element_map = 1 [(map) = true]; - repeated Pair element_map_e = 2 [(map) = true, (map_exists) = "exists"]; - repeated Pair element_map_d = 3 [(map) = true, (map_deleted) = "deleted"]; - - repeated Element element_by_id = 4 [(map_by) = "id"]; - repeated Element element_by_id_e = 5 [(map_by) = "id", (map_exists) = "exists"]; - repeated Element element_by_id_d = 6 [(map_by) = "id", (map_deleted) = "deleted"]; -}