ninjudd / clojure-protobuf Goto Github PK
View Code? Open in Web Editor NEWGoogle protocol buffers wrapper for Clojure.
License: Eclipse Public License 1.0
Google protocol buffers wrapper for Clojure.
License: Eclipse Public License 1.0
a Message with mixedCase fields will have those fields omitted when printing the message.
When printing the schema for the message, the key is printed as all-lower-case, however the value is only associated with the mixed-case key.
When printing the message out, it seems the toString method is referencing the lower-case key from the schema, which returns nil and therefore omits the key:value pair.
This may be related to #39
For example, it'd be nice to see the output of configure and make. I'm already working on a library for this. Should be done soon.
protofields does not do the cool renaming trick:
String name = ((String) key).replaceAll("-","_");
I expected protofields to return field names with underscores converted to hyphens.
this bit me, because I need to construct a full map with defaults filled in (please consider adding this in clojure-protobuf):
(defn- fill-default-fields [cfg](let [all-keys %28keys %28protofields CustomerConfig%29%29]
%28merge %28apply hash-map %28interleave all-keys %28map #%28protodefault CustomerConfig %%29 all-keys%29%29%29 cfg%29))
This would allow you store empty collections and reset a collection to empty using an append.
My fix for #26 was a little too greedy, preventing lein-protobuf from compiling descriptor in the protobuf project itself. This is super easy to fix, but I'm busy at the moment so I'm creating this issue to remind me to fix it when I get a moment.
When running cake repl, it starts to download and compile protoc, but even when running with sudo, it displays a weird password prompt that does not work.
@Password
mypasswordinplaintext
I tried installing protobuf myself, but the version does not match, so installed? returns false.
[update] I bumped the number, and now it throws exceptions about proto files.
java.lang.Exception: unable to find proto/google/protobuf/descriptor.proto on classpath
It seems that the code currently requires enums to be keywords in the original case when loading them from a map, but converts them to lower case as soon as they are loaded. This gives an error if you persist it to a database and then load it and try to convert it to protobuf again.
Minimum example:
example.proto
option java_package = "com.example";
package Example;
enum Answer {
YES = 1;
NO = 2;
MAYBE = 3;
}
message Quiz {
optional string question = 1;
optional Answer answer = 2;
}
Failing test:
(ns proto-test.test.core
(:use proto-test.core
protobuf.core
clojure.test))
(def Quiz (protodef com.example.Example$Quiz))
(deftest same-map-after-encoding
(let [quiz-map {:question "Is it raining outside?"
:answer :MAYBE}
quiz (protobuf Quiz quiz-map)]
(is (= quiz quiz-map))
(is (= quiz (protobuf Quiz quiz)))))
I'm walking through the README example, but I get an error (see below).
I start a sample project with this project.clj
:
(defproject sample "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.5.1"]
[org.flatland/protobuf "0.8.1"]]
:plugins [[lein-protobuf "0.4.1"]]
:profiles {:dev {:source-paths ["dev"]
:dependencies [[org.clojure/tools.namespace "0.2.4"]]}})
I create resources/proto/person.proto
with these contents:
message Person {
required int32 id = 1;
required string name = 2;
optional string email = 3;
repeated string likes = 4;
}
Then I run lein protobuf
and I get:
/Users/david/.lein/cache/lein-protobuf/protobuf-2.5.0/src/protoc person.proto --java_out=/Users/david/dev/maybe/sample/target/protosrc -I. -I/Users/david/dev/maybe/sample/target/proto -I/Users/david/dev/maybe/sample/resources/proto
ERROR: /Users/david/dev/maybe/sample/target/proto: warning: directory does not exist.
--java_out: person.proto: person.proto: Cannot generate Java output because the file's outer class name, "Person", matches the name of one of the types declared inside it. Please either rename the type or use the java_outer_classname option to specify a different outer class name for the .proto file.
If the lein protobuf task fails while invoking protoc, it doesn't abort the build. Instead it just prints an error message in the middle of a bunch of non-error text, making it hard to notice when something goes wrong.
@Raynes says we have to do this to upgrade to clojure 1.3.
This should not be necessary:
amnesia:protobuf develop$ lein javac
> protoc google/protobuf/descriptor.proto --java_out=/Users/justin/clojure/protobuf/target/protobuf-2.3.0/java/src/main/java -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
Compiling 1 source file to /Users/justin/clojure/protobuf/classes
> protoc google/protobuf/descriptor.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/core/extensions.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/codec.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/core.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/example.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
Compiling 4 source files to /Users/justin/clojure/protobuf/classes
amnesia:protobuf develop$ lein jar
Copying 8 files to /Users/justin/clojure/protobuf/lib/dev
Copying 4 files to /Users/justin/clojure/protobuf/lib/dev
> protoc google/protobuf/descriptor.proto --java_out=/Users/justin/clojure/protobuf/target/protobuf-2.3.0/java/src/main/java -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
Compiling 1 source file to /Users/justin/clojure/protobuf/classes
> protoc google/protobuf/descriptor.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/core/extensions.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/codec.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/core.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/example.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
Compiling 4 source files to /Users/justin/clojure/protobuf/classes
No namespaces to :aot compile listed in project.clj.
Created /Users/justin/clojure/protobuf/protobuf-0.6.0-beta13.jar
amnesia:protobuf develop$ lein install
Copying 8 files to /Users/justin/clojure/protobuf/lib/dev
Copying 4 files to /Users/justin/clojure/protobuf/lib/dev
> protoc google/protobuf/descriptor.proto --java_out=/Users/justin/clojure/protobuf/target/protobuf-2.3.0/java/src/main/java -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
Compiling 1 source file to /Users/justin/clojure/protobuf/classes
> protoc google/protobuf/descriptor.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/core/extensions.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/codec.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/core.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
> protoc protobuf/test/example.proto --java_out=/Users/justin/clojure/protobuf/target/protosrc -I. -I/Users/justin/clojure/protobuf/target/proto -I/Users/justin/clojure/protobuf/proto
Compiling 4 source files to /Users/justin/clojure/protobuf/classes
No namespaces to :aot compile listed in project.clj.
Created /Users/justin/clojure/protobuf/protobuf-0.6.0-beta13.jar
Wrote pom.xml
[INFO] Installing /Users/justin/clojure/protobuf/protobuf-0.6.0-beta13.jar to /Users/justin/.m2/repository/protobuf/protobuf/0.6.0-beta13/protobuf-0.6.0-beta13.jar
amnesia:protobuf develop$
Looks like my recent changes broke the specific-file compilation stuff. You can't do lein protobuf compile my.proto
right now. I'll look into this soon and this is mostly just a reminder.
The current version of clojure-protobuf doesn't seem to work with protobuf 2.4.1. It appears some of the method signatures have changed in the new version.
P.S. - Thanks for this library! And sorry if I'm mistaken or you already know @ this!
Just like, say, read-lines in clojure.contrib.io. Otherwise, it isn't very useful in real life, because you need to hold on to the stream and babysit it (and remember to close it) until you consume the sequence. Or read it all in one go, which defeats the purpose of using protobuf-seq in the first place.
This would really help me -- I have a structure defined using protobufs and want to create a function similar to read-lines (i.e., one accepting an input stream and returning a lazy seq of protobuf-decoded structures, of which there could be more than can coexist in memory at a time).
Would it be possible to add this?
Using leiningen 0.7.0, I've created a stand alone project which this issue is easily reproducible.
test.proto
:
option java_package = "com.test.models";
message Person {
required int32 id = 1;
required string name = 2;
optional string email = 3;
repeated string likes = 4;
}
Then I compile that with lein protobuf compile test.proto
.
Then I do something like this in a repl
(use 'protobuf.core)
(import 'com.test.models.Test)
(import 'com.test.models.Test$Person)
(import 'java.io.FileOutputStream)
(def Person (protodef Test$Person))
(def p (protobuf Person {:id 123 :name "Bob Smith"}))
(protobuf-write (FileOutputStream. "person.data") p)
Now if I try and decode that as raw input in the terminal: echo person.data | protoc --decode_raw
I get Failed to parse input.
Similarly, if I go back to the repl and try this
(import 'java.io.BufferedInputStream)
(protobuf-load-stream Person (BufferedInputStream. (FileInputStream. "person.data")))
I get an exception
While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either than the input has been truncated or that an embedded message misreported its own length.
[Thrown class com.google.protobuf.InvalidProtocolBufferException]
Restarts:
0: [QUIT] Quit to the SLIME top level
Backtrace:
0: com.google.protobuf.InvalidProtocolBufferException.truncatedMessage(Unknown Source)
1: com.google.protobuf.CodedInputStream.refillBuffer(Unknown Source)
2: com.google.protobuf.CodedInputStream.readRawBytes(Unknown Source)
3: com.google.protobuf.CodedInputStream.readBytes(Unknown Source)
4: com.google.protobuf.UnknownFieldSet$Builder.mergeFieldFrom(Unknown Source)
5: com.google.protobuf.AbstractMessage$Builder.mergeFieldFrom(Unknown Source)
6: com.google.protobuf.AbstractMessage$Builder.mergeFrom(Unknown Source)
7: com.google.protobuf.AbstractMessage$Builder.mergeFrom(Unknown Source)
8: com.google.protobuf.DynamicMessage.parseFrom(Unknown Source)
9: protobuf.core.PersistentProtocolBufferMap$Def.parseFrom(Unknown Source)
10: protobuf.core.PersistentProtocolBufferMap.parseFrom(Unknown Source)
11: protobuf.core$protobuf_load_stream.invoke(core.clj:88)
Hi, thanks for a great project!
When I add [org.flatland/protobuf "0.8.2"]
and try to build project, I get the following message:
Retrieving org/flatland/protobuf/0.8.2/protobuf-0.8.2.jar from clojars
Could not find artifact org.flatland:protobuf:jar:0.8.2 in central (https://repo1.maven.org/maven2/)
Could not transfer artifact org.flatland:protobuf:jar:0.8.2 from/to clojars (https://clojars.org/repo/): Checksum validation failed, no checksums available from the repository
For some reason this fork works.
Mostly just putting this here to remind me to do it on Monday.
Hmm. I've just tried to use clojure-protobuf in my project. I followed the instructions on the project page, except I also tried to use version 0.2.10. I only get:
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate useful/io__init.class or useful/io.clj on classpath: (tasks.clj:1)
at clojure.lang.Compiler.eval (Compiler.java:5440)
clojure.lang.Compiler.eval (Compiler.java:5415)
clojure.lang.Compiler.load (Compiler.java:5857)
clojure.lang.RT.loadResourceScript (RT.java:340)
clojure.lang.RT.loadResourceScript (RT.java:331)
clojure.lang.RT.load (RT.java:409)
clojure.lang.RT.load (RT.java:381)
clojure.core$load$fn__4511.invoke (core.clj:4905)
clojure.core$load.doInvoke (core.clj:4904)
clojure.lang.RestFn.invoke (RestFn.java:409)
clojure.core$load_one.invoke (core.clj:4729)
clojure.core$load_lib.doInvoke (core.clj:4766)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.invoke (core.clj:542)
clojure.core$load_libs.doInvoke (core.clj:4800)
clojure.lang.RestFn.applyTo (RestFn.java:138)
clojure.core$apply.invoke (core.clj:542)
clojure.core$require.doInvoke (core.clj:4869)
clojure.lang.RestFn.invoke (RestFn.java:409)
cake.core$eval1503.invoke (project.clj:1)
clojure.lang.Compiler.eval (Compiler.java:5424)
clojure.lang.Compiler.eval (Compiler.java:5414)
clojure.lang.Compiler.load (Compiler.java:5857)
clojure.lang.Compiler.loadFile (Compiler.java:5820)
clojure.lang.RT$3.invoke (RT.java:296)
cake.project$init.invoke (project.clj:29)
cake.core$start_server.invoke (core.clj:219)
user$eval925.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:5424)
clojure.lang.Compiler.eval (Compiler.java:5391)
clojure.core$eval.invoke (core.clj:2382)
clojure.main$eval_opt.invoke (main.clj:235)
clojure.main$initialize.invoke (main.clj:254)
clojure.main$null_opt.invoke (main.clj:279)
clojure.main$main.doInvoke (main.clj:354)
clojure.lang.RestFn.invoke (RestFn.java:422)
clojure.lang.Var.invoke (Var.java:369)
clojure.lang.AFn.applyToHelper (AFn.java:165)
clojure.lang.Var.applyTo (Var.java:482)
clojure.main.main (main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate useful/io__init.class or useful/io.clj on classpath:
at clojure.lang.RT.load (RT.java:412)
clojure.lang.RT.load (RT.java:381)
clojure.core$load$fn__4511.invoke (core.clj:4905)
clojure.core$load.doInvoke (core.clj:4904)
clojure.lang.RestFn.invoke (RestFn.java:409)
clojure.core$load_one.invoke (core.clj:4729)
clojure.core$load_lib.doInvoke (core.clj:4766)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.invoke (core.clj:542)
clojure.core$load_libs.doInvoke (core.clj:4800)
clojure.lang.RestFn.applyTo (RestFn.java:138)
clojure.core$apply.invoke (core.clj:544)
clojure.core$use.doInvoke (core.clj:4880)
clojure.lang.RestFn.invoke (RestFn.java:513)
protobuf.tasks$eval1507$loading__4410__auto____1508.invoke (tasks.clj:1)
protobuf.tasks$eval1507.invoke (tasks.clj:1)
clojure.lang.Compiler.eval (Compiler.java:5424)
clojure.lang.Compiler.eval (Compiler.java:5415)
clojure.lang.Compiler.load (Compiler.java:5857)
clojure.lang.RT.loadResourceScript (RT.java:340)
clojure.lang.RT.loadResourceScript (RT.java:331)
clojure.lang.RT.load (RT.java:409)
clojure.lang.RT.load (RT.java:381)
clojure.core$load$fn__4511.invoke (core.clj:4905)
clojure.core$load.doInvoke (core.clj:4904)
clojure.lang.RestFn.invoke (RestFn.java:409)
clojure.core$load_one.invoke (core.clj:4729)
clojure.core$load_lib.doInvoke (core.clj:4766)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.invoke (core.clj:542)
clojure.core$load_libs.doInvoke (core.clj:4800)
clojure.lang.RestFn.applyTo (RestFn.java:138)
clojure.core$apply.invoke (core.clj:542)
clojure.core$require.doInvoke (core.clj:4869)
clojure.lang.RestFn.invoke (RestFn.java:409)
cake.core$eval1503.invoke (project.clj:1)
clojure.lang.Compiler.eval (Compiler.java:5424)
clojure.lang.Compiler.eval (Compiler.java:5414)
clojure.lang.Compiler.load (Compiler.java:5857)
clojure.lang.Compiler.loadFile (Compiler.java:5820)
clojure.lang.RT$3.invoke (RT.java:296)
cake.project$init.invoke (project.clj:29)
cake.core$start_server.invoke (core.clj:219)
user$eval925.invoke (NO_SOURCE_FILE:1)
clojure.lang.Compiler.eval (Compiler.java:5424)
clojure.lang.Compiler.eval (Compiler.java:5391)
clojure.core$eval.invoke (core.clj:2382)
clojure.main$eval_opt.invoke (main.clj:235)
clojure.main$initialize.invoke (main.clj:254)
clojure.main$null_opt.invoke (main.clj:279)
clojure.main$main.doInvoke (main.clj:354)
clojure.lang.RestFn.invoke (RestFn.java:422)
clojure.lang.Var.invoke (Var.java:369)
clojure.lang.AFn.applyToHelper (AFn.java:165)
clojure.lang.Var.applyTo (Var.java:482)
clojure.main.main (main.java:37)
Any hints?
I'm getting
Exception in thread "main" java.lang.IllegalArgumentException: error setting string field foo to :bar, compiling:(client.clj:12:10)
when I try to pass a map containing keyword values to protobuf
without converting them to strings first.
I followed the Person example and failed to create a protobuf instance. I'm running on OSX Mavericks.
lein --version
Leiningen 2.3.4 on Java 1.7.0_55 Java HotSpot(TM) 64-Bit Server VM
I have the following project.clj:
(defproject my-project "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0-RC1"]
[org.flatland/protobuf "0.7.1"]
[org.clojure/data.codec "0.1.0"]]
:main ^:skip-aot my-project.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}}
:global-vars {*print-length* 100}
:plugins [[lein-protobuf "0.4.3"]]
:resource-paths ["resources/protobuf-java-2.6.1.jar"])
As you can see I installed protobuf 2.6.1 manually and included the jar in the resource-path.
I use the following person.proto file in resources/proto:
message Person {
required int32 id = 1;
required string name = 2;
optional string email = 3;
repeated string likes = 4;
}
Running "lein protobuf" works and correctly creates PersonOuterClass.java in the target/protosrc
Loading the namespace also works:
(ns my-project.proto
(:use flatland.protobuf.core)
(:import PersonOuterClass$Person))
Next up in the cider-repl (0.9.0):
(def Person (protodef PersonOuterClass$Person)); => #'my-project.proto/Person
And then the error when:
(def p (protobuf Person :id 4 :name "Bob" :email "[email protected]"))
CompilerException java.lang.NoSuchMethodError: com.google.protobuf.DescriptorProtos$FieldOptions.getExtension(Lcom/google/protobuf/GeneratedMessage$GeneratedExtension;)Ljava/lang/Object;, compiling:(form-init5554068261882864915.clj:1:8)
More details:
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling: form-init5554068261882864915.clj:1:8
Compiler.java: 3628 clojure.lang.Compiler$InvokeExpr/eval
Compiler.java: 439 clojure.lang.Compiler$DefExpr/eval
Compiler.java: 6797 clojure.lang.Compiler/eval
Compiler.java: 6755 clojure.lang.Compiler/eval
core.clj: 3079 clojure.core/eval
main.clj: 240 clojure.main/repl/read-eval-print/fn
main.clj: 240 clojure.main/repl/read-eval-print
main.clj: 258 clojure.main/repl/fn
main.clj: 258 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 58 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 628 clojure.core/apply
core.clj: 1866 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 56 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 188 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 157 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1145 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 615 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run
1. Caused by java.lang.NoSuchMethodError
com.google.protobuf.DescriptorProtos$FieldOptions.getExtension(Lcom/google/protobuf/GeneratedMessage$GeneratedExtension;)Ljava/lang/Object;
PersistentProtocolBufferMap.java: 581 flatland.protobuf.PersistentProtocolBufferMap/addField
PersistentProtocolBufferMap.java: 735 flatland.protobuf.PersistentProtocolBufferMap/cons
PersistentProtocolBufferMap.java: 286 flatland.protobuf.PersistentProtocolBufferMap/construct
core.clj: 46 flatland.protobuf.core/protobuf
RestFn.java: 146 clojure.lang.RestFn/applyTo
Compiler.java: 3623 clojure.lang.Compiler$InvokeExpr/eval
Compiler.java: 439 clojure.lang.Compiler$DefExpr/eval
Compiler.java: 6797 clojure.lang.Compiler/eval
Compiler.java: 6755 clojure.lang.Compiler/eval
core.clj: 3079 clojure.core/eval
main.clj: 240 clojure.main/repl/read-eval-print/fn
main.clj: 240 clojure.main/repl/read-eval-print
main.clj: 258 clojure.main/repl/fn
main.clj: 258 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 58 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 628 clojure.core/apply
core.clj: 1866 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 56 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 188 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 157 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1145 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 615 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run
I also get the same error when I drop the "repeated string likes" from the Person.proto.
Any idea what is causing this?
I can assoc anything into a PersistentProtocolBufferMap, and unknown fields will get silently dropped when serializing it (with e.g. toByteArray).
Could you please either throw an error on unknown fields or provide a way to check whether a PersistentProtocolBufferMap contains them?
Hate to open an issue, but I haven't the foggiest idea how to address this and want to leave a record for later googlers. On OS X 10.6.7, clojure 1.2.0, protobuf 0.5.0-beta4, I'm getting an exception from cake test, complaining that protobuf__init isn't on the classpath. Cake did build protoc correctly and successfully compiled my .proto file. I've got some google protobuf classes in my lib dir, but nothing explicitly named "protobuf__
init.class" or "protobuf.clj". Any ideas?
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at clojure.lang.LazySeq.sval (LazySeq.java:47)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.RT.seq (RT.java:450)
clojure.core$seq.invoke (core.clj:122)
clojure.core$dorun.invoke (core.clj:2450)
clojure.core$doall.invoke (core.clj:2465)
cake.task$run_actions.invoke (task.clj:160)
cake.task$run_task$fn__1771.invoke (task.clj:202)
cake.task$run_task.invoke (task.clj:196)
cake.task$run_task.invoke (task.clj:189)
cake.main$process_command.invoke (main.clj:30)
cake.server$create$fn__4133.invoke (server.clj:69)
cake.utils.server_socket$accept_fn$fn__3868$fn__3871.invoke (server_socket.clj:39)
cake.utils.server_socket$accept_fn$fn__3868.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:680)
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke (Method.java:597)
classlojure.core$eval_in.doInvoke (core.clj:82)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.doInvoke (core.clj:548)
clojure.lang.RestFn.invoke (RestFn.java:534)
cake.classloader$bake_eval.doInvoke (classloader.clj:165)
clojure.lang.RestFn.invoke (RestFn.java:440)
cake.tasks.test$test_vars.invoke (test.clj:159)
cake.tasks.test$run_project_tests$fn__2808.invoke (test.clj:171)
cake.classloader$in_bake_ns.invoke (classloader.clj:130)
cake.tasks.test$run_project_tests.invoke (test.clj:166)
cake.tasks.test$eval2831$cake_DOT_tasks_DOT_test_test__2833.invoke (test.clj:205)
cake.task$run_actions$iter__1735__1739$fn__1740$fn__1741.invoke (task.clj:161)
cake.task$run_actions$iter__1735__1739$fn__1740.invoke (task.clj:160)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.RT.seq (RT.java:450)
clojure.core$seq.invoke (core.clj:122)
clojure.core$dorun.invoke (core.clj:2450)
clojure.core$doall.invoke (core.clj:2465)
cake.task$run_actions.invoke (task.clj:160)
cake.task$run_task$fn__1771.invoke (task.clj:202)
cake.task$run_task.invoke (task.clj:196)
cake.task$run_task.invoke (task.clj:189)
cake.main$process_command.invoke (main.clj:30)
cake.server$create$fn__4133.invoke (server.clj:69)
cake.utils.server_socket$accept_fn$fn__3868$fn__3871.invoke (server_socket.clj:39)
cake.utils.server_socket$accept_fn$fn__3868.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:680)
Caused by: clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate protobuf__init.class or protobuf.clj on classpath: (core.clj:1)
at clojure.lang.Compiler.eval (Compiler.java:5440)
clojure.lang.Compiler.load (Compiler.java:5857)
clojure.lang.RT.loadResourceScript (RT.java:340)
clojure.lang.RT.loadResourceScript (RT.java:331)
clojure.lang.RT.load (RT.java:409)
clojure.lang.RT.load (RT.java:381)
clojure.core$load$fn__4511.invoke (core.clj:4905)
clojure.core$load.doInvoke (core.clj:4904)
clojure.lang.RestFn.invoke (RestFn.java:409)
clojure.core$load_one.invoke (core.clj:4729)
clojure.core$load_lib.doInvoke (core.clj:4766)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.invoke (core.clj:542)
clojure.core$load_libs.doInvoke (core.clj:4800)
clojure.lang.RestFn.applyTo (RestFn.java:138)
clojure.core$apply.invoke (core.clj:544)
clojure.core$use.doInvoke (core.clj:4880)
clojure.lang.RestFn.invoke (RestFn.java:409)
ufold.test.core$eval5848$loading__4410__auto____5849.invoke (core.clj:1)
ufold.test.core$eval5848.invoke (core.clj:1)
clojure.lang.Compiler.eval (Compiler.java:5424)
clojure.lang.Compiler.eval (Compiler.java:5415)
clojure.lang.Compiler.load (Compiler.java:5857)
clojure.lang.RT.loadResourceScript (RT.java:340)
clojure.lang.RT.loadResourceScript (RT.java:331)
clojure.lang.RT.load (RT.java:409)
clojure.lang.RT.load (RT.java:381)
clojure.core$load$fn__4511.invoke (core.clj:4905)
clojure.core$load.doInvoke (core.clj:4904)
clojure.lang.RestFn.invoke (RestFn.java:409)
clojure.core$load_one.invoke (core.clj:4729)
clojure.core$load_lib.doInvoke (core.clj:4766)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.invoke (core.clj:542)
clojure.core$load_libs.doInvoke (core.clj:4800)
clojure.lang.RestFn.applyTo (RestFn.java:138)
clojure.core$apply.invoke (core.clj:542)
clojure.core$require.doInvoke (core.clj:4869)
clojure.lang.RestFn.invoke (RestFn.java:409)
bake.test$test_vars$fn__312.invoke (test.clj:26)
clojure.core$r.invoke (core.clj:799)
bake.test$test_vars.invoke (test.clj:25)
clojure.lang.AFn.applyToHelper (AFn.java:165)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:540)
bake4293$eval5842$fn__5843.invoke (NO_SOURCE_FILE:0)
sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke (Method.java:597)
classlojure.core$eval_in.doInvoke (core.clj:82)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.doInvoke (core.clj:548)
clojure.lang.RestFn.invoke (RestFn.java:534)
cake.classloader$bake_eval.doInvoke (classloader.clj:165)
clojure.lang.RestFn.invoke (RestFn.java:440)
cake.tasks.test$test_vars.invoke (test.clj:159)
cake.tasks.test$run_project_tests$fn__2808.invoke (test.clj:171)
cake.classloader$in_bake_ns.invoke (classloader.clj:130)
cake.tasks.test$run_project_tests.invoke (test.clj:166)
cake.tasks.test$eval2831$cake_DOT_tasks_DOT_test_test__2833.invoke (test.clj:205)
cake.task$run_actions$iter__1735__1739$fn__1740$fn__1741.invoke (task.clj:161)
cake.task$run_actions$iter__1735__1739$fn__1740.invoke (task.clj:160)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.RT.seq (RT.java:450)
clojure.core$seq.invoke (core.clj:122)
clojure.core$dorun.invoke (core.clj:2450)
clojure.core$doall.invoke (core.clj:2465)
cake.task$run_actions.invoke (task.clj:160)
cake.task$run_task$fn__1771.invoke (task.clj:202)
cake.task$run_task.invoke (task.clj:196)
cake.task$run_task.invoke (task.clj:189)
cake.main$process_command.invoke (main.clj:30)
cake.server$create$fn__4133.invoke (server.clj:69)
cake.utils.server_socket$accept_fn$fn__3868$fn__3871.invoke (server_socket.clj:39)
cake.utils.server_socket$accept_fn$fn__3868.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:680)
Caused by: java.io.FileNotFoundException: Could not locate protobuf__init.class or protobuf.clj on classpath:
at clojure.lang.RT.load (RT.java:412)
clojure.lang.RT.load (RT.java:381)
clojure.core$load$fn__4511.invoke (core.clj:4905)
clojure.core$load.doInvoke (core.clj:4904)
clojure.lang.RestFn.invoke (RestFn.java:409)
clojure.core$load_one.invoke (core.clj:4729)
clojure.core$load_lib.doInvoke (core.clj:4766)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.invoke (core.clj:542)
clojure.core$load_libs.doInvoke (core.clj:4800)
clojure.lang.RestFn.applyTo (RestFn.java:138)
clojure.core$apply.invoke (core.clj:544)
clojure.core$use.doInvoke (core.clj:4880)
clojure.lang.RestFn.invoke (RestFn.java:409)
ufold.core$eval5860.invoke (core.clj:5)
clojure.lang.Compiler.eval (Compiler.java:5424)
clojure.lang.Compiler.load (Compiler.java:5857)
clojure.lang.RT.loadResourceScript (RT.java:340)
clojure.lang.RT.loadResourceScript (RT.java:331)
clojure.lang.RT.load (RT.java:409)
clojure.lang.RT.load (RT.java:381)
clojure.core$load$fn__4511.invoke (core.clj:4905)
clojure.core$load.doInvoke (core.clj:4904)
clojure.lang.RestFn.invoke (RestFn.java:409)
clojure.core$load_one.invoke (core.clj:4729)
clojure.core$load_lib.doInvoke (core.clj:4766)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.invoke (core.clj:542)
clojure.core$load_libs.doInvoke (core.clj:4800)
clojure.lang.RestFn.applyTo (RestFn.java:138)
clojure.core$apply.invoke (core.clj:544)
clojure.core$use.doInvoke (core.clj:4880)
clojure.lang.RestFn.invoke (RestFn.java:409)
ufold.test.core$eval5848$loading__4410__auto____5849.invoke (core.clj:1)
ufold.test.core$eval5848.invoke (core.clj:1)
clojure.lang.Compiler.eval (Compiler.java:5424)
clojure.lang.Compiler.eval (Compiler.java:5415)
clojure.lang.Compiler.load (Compiler.java:5857)
clojure.lang.RT.loadResourceScript (RT.java:340)
clojure.lang.RT.loadResourceScript (RT.java:331)
clojure.lang.RT.load (RT.java:409)
clojure.lang.RT.load (RT.java:381)
clojure.core$load$fn__4511.invoke (core.clj:4905)
clojure.core$load.doInvoke (core.clj:4904)
clojure.lang.RestFn.invoke (RestFn.java:409)
clojure.core$load_one.invoke (core.clj:4729)
clojure.core$load_lib.doInvoke (core.clj:4766)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.invoke (core.clj:542)
clojure.core$load_libs.doInvoke (core.clj:4800)
clojure.lang.RestFn.applyTo (RestFn.java:138)
clojure.core$apply.invoke (core.clj:542)
clojure.core$require.doInvoke (core.clj:4869)
clojure.lang.RestFn.invoke (RestFn.java:409)
bake.test$test_vars$fn__312.invoke (test.clj:26)
clojure.core$r.invoke (core.clj:799)
bake.test$test_vars.invoke (test.clj:25)
clojure.lang.AFn.applyToHelper (AFn.java:165)
clojure.lang.AFn.applyTo (AFn.java:151)
clojure.core$apply.invoke (core.clj:540)
bake4293$eval5842$fn__5843.invoke (NO_SOURCE_FILE:0)
sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke (Method.java:597)
classlojure.core$eval_in.doInvoke (core.clj:82)
clojure.lang.RestFn.applyTo (RestFn.java:143)
clojure.core$apply.doInvoke (core.clj:548)
clojure.lang.RestFn.invoke (RestFn.java:534)
cake.classloader$bake_eval.doInvoke (classloader.clj:165)
clojure.lang.RestFn.invoke (RestFn.java:440)
cake.tasks.test$test_vars.invoke (test.clj:159)
cake.tasks.test$run_project_tests$fn__2808.invoke (test.clj:171)
cake.classloader$in_bake_ns.invoke (classloader.clj:130)
cake.tasks.test$run_project_tests.invoke (test.clj:166)
cake.tasks.test$eval2831$cake_DOT_tasks_DOT_test_test__2833.invoke (test.clj:205)
cake.task$run_actions$iter__1735__1739$fn__1740$fn__1741.invoke (task.clj:161)
cake.task$run_actions$iter__1735__1739$fn__1740.invoke (task.clj:160)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.RT.seq (RT.java:450)
clojure.core$seq.invoke (core.clj:122)
clojure.core$dorun.invoke (core.clj:2450)
clojure.core$doall.invoke (core.clj:2465)
cake.task$run_actions.invoke (task.clj:160)
cake.task$run_task$fn__1771.invoke (task.clj:202)
cake.task$run_task.invoke (task.clj:196)
cake.task$run_task.invoke (task.clj:189)
cake.main$process_command.invoke (main.clj:30)
cake.server$create$fn__4133.invoke (server.clj:69)
cake.utils.server_socket$accept_fn$fn__3868$fn__3871.invoke (server_socket.clj:39)
cake.utils.server_socket$accept_fn$fn__3868.invoke (server_socket.clj:38)
clojure.lang.AFn.run (AFn.java:24)
java.lang.Thread.run (Thread.java:680)
All of the calls to fromProtoValue
and getValAt
in PersistentProtocolBufferMap
have the use_extensions
parameter hard coded to true
. This causes runtime failures on schemas that don't use extensions.
To workaround for my specific schema I've had to build with line 393, line 713 and line 718 hardcoded to false
. I assume there's a way to detect this but I'm not familiar enough with protobufs yet to implement.
Hello, I have a project https://github.com/bitemyapp/revise which depends on this library. I recently separated the compiled protocol buffers from the project into a separate jar (and dependency). And I also removed the plugin "lein-protobuf" from my project.clj (none of these changes are live yet) and then I deleted all of my .proto files.
My problem is that this still downloads protoc, compiles it and then downloads - a seemingly outdated 2.4.1 - protobuf jar. And in the end it does nothing because there are no .proto files to compile.
My understanding is that lein-protobuf should do the compilation while clojure-protobuf should just use the actual compiled protocol buffers. So what I want is that the user should be able to use them separately.
Also the automatic compilation of the protoc sources probably makes this project explode on windows.
Thanks.
Ever seen this before? I'm wondering if it's a conflict with the lein plugin somehow... digging into the source.
aphyr@azimuth:~/ustate/reimann master$ lein uberjar
Compiling reimann.bin
Compiling reimann.bin
Compilation succeeded.
Created /home/aphyr/ustate/reimann/reimann-0.0.1-SNAPSHOT.jar
Including reimann-0.0.1-SNAPSHOT.jar
Including tools.macro-0.1.1.jar
Including clojure-1.2.0.jar
Including lamina-0.4.0.jar
Including commons-compress-1.3.jar
Including httpclient-4.0.3.jar
Including gloss-0.2.0.jar
Including netty-3.2.5.Final.jar
Including commons-codec-1.4.jar
Including potemkin-0.1.0.jar
Including commons-io-1.4.jar
Including useful-0.7.4-alpha4.jar
Including clojure-contrib-1.2.0.jar
Including protobuf-0.6.0-beta4.jar
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: duplicate entry: leiningen/protobuf.clj (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: java.util.zip.ZipException: duplicate entry: leiningen/protobuf.clj
at clojure.lang.LazySeq.sval(LazySeq.java:47)
at clojure.lang.LazySeq.seq(LazySeq.java:56)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.next(RT.java:560)
at clojure.core$next.invoke(core.clj:61)
at clojure.core$r.invoke(core.clj:799)
at clojure.core$into.invoke(core.clj:2614)
at leiningen.uberjar$include_dep.invoke(uberjar.clj:47)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:544)
at clojure.core$partial$fn__3684.doInvoke(core.clj:2011)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.core$r.invoke(core.clj:799)
at leiningen.uberjar$write_components.invoke(uberjar.clj:54)
at leiningen.uberjar$uberjar$fn__1571.invoke(uberjar.clj:93)
at leiningen.uberjar$uberjar.invoke(uberjar.clj:86)
at leiningen.uberjar$uberjar.invoke(uberjar.clj:97)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:264)
at leiningen.core$_main.doInvoke(core.clj:331)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:334)
at user$eval361.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5424)
... 11 more
Caused by: java.util.zip.ZipException: duplicate entry: leiningen/protobuf.clj
at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:192)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:90)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at leiningen.uberjar$copy_entries$iter__1546__1550$fn__1551.invoke(uberjar.clj:36)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
... 41 more
Instead of compiling protoc
from source, we should have users install protobuf using the package manager for their OS (brew, yum, etc...).
We may still have to download the Java source though, right @Raynes.
I just found out that naming strategies exist after spending a good chunk of time diagnosing enum-value-name-related issues in my project and then reading through the Issues section of this github project. Between reading the actual source code of the library and cross-referencing against the discussion on https://github.com/flatland/clojure-protobuf/issues/27 , I think I'll be able to figure out what's going on and how to take advantage of naming strategies, but this definitely seems like the sort of thing that should be written down somewhere, preferably in the README or wherever else this project is documented; a Google search for "clojure protobuf naming strategy" doesn't turn up anything at all.
(also thanks for your work on this project, I'm really glad you guys did all this heavy lifting so I won't have to! :)
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cake/file__init.class or cake/file.clj on classpath: (tasks.clj:1)
This is with 0.2.11-SNAPSHOT. I can't move to 0.2.10, because that one can't find the "useful" package.
I think it's something along the lines of:
lein protobuf compile
lein test
OS: Ubuntu Lucid 10.04
Shell: zsh
While building and installing protoc, the password prompt (via System.console.readPassword) only reads one character. It then tries to sudo using the 1 character (which fails).
Using the latest release of clojure-protobuf, and this particular .proto definition:
message Key {
required bytes salt = 1;
required bytes iv = 2;
required bytes encryptedKey = 3;
required bytes verifyingKey = 4;
}
When ever I try loading from a file via protobuf-load-stream or via protobuf-load, the returned protobuf object does not yield the encryptedKey and verifyingKey keys, and its str representation doesn't have those keys either, e.g.:
protobuf-raw-seq
-> {:salt #<ByteString com.google.protobuf.ByteString@ca222b04>, :iv #<ByteString com.google.protobuf.ByteString@ae9053d8>}
(:encryptedKey protobuf-raw-seq)
-> #<ByteString com.google.protobuf.ByteString@e2fd05ec>
(take 4 (seq protobuf-raw-seq))
-> ([:salt #<ByteString com.google.protobuf.ByteString@ca222b04>] [:iv #<ByteString com.google.protobuf.ByteString@ae9053d8>])
A function that I've written to unpack ByteStrings into byte arrays and translate the protobuf object into a Clojure map depends on being able to seq into the PersistentProtocolBufferMap without losing keys.
This is on Clojure 1.4.0
I can provide a minimal test case. I am not sure whether this is a bug in clojure-protobuf or protobuf itself, but doing (.. protobuf-raw-master-rec def type getFields) does yield the missing fields.
Right now, they use the same naming strategy as fields. It would be nice to be able to make enum values be ALL_CAPS and have them automatically be downcased in Clojure.
I always find it confusing when there are flatland forks of libraries, sometimes the authors one is the canonical one, sometimes it is the flatland that is canonical, or has more activities. The group-id's on the POM aren't always consistent, further adding to confusion. Sometimes the links on one README go to the Clojars page for the other one. In general, I find it very confusing. Alan Malloy said this was done previously because Github didn't count contributions to repos that you didn't own, but I don't think that is the case any longer.
Would you please consider consolidating the flatland/ninjudd/amalloy, e.t.c. libraries, perhaps all into flatland? This would make my life as a maintainer a little bit easier.
Thanks!
README suggests creating resources/proto/person.proto with "Person" message.
Hovewer this way "lein protoc" fails:
> /home/vi/.lein/cache/lein-protobuf/protobuf-2.4.1/src/protoc person.proto --java_out=/tmp/qq/prototest/target/protosrc -I. -I/tmp/qq/prototest/target/proto -I/tmp/qq/prototest/resources/proto
ERROR: --java_out: person.proto: person.proto: Cannot generate Java output because the file's outer class name, "Person", matches the name of one of the types declared inside it. Please either rename the type or use the java_outer_classname option to specify a different outer class name for the .proto file.
I have to rename the message to "Person2" to get it well and use (import Person$Person2)
as well. Also I have to fix: (use 'flatland.protobuf.core)
instead of (use 'protobuf.core)
...
I'm having problems with:
[org.flatland/protobuf "0.8.1"]
It appears to be compiled for Java 1.7 and I'm using it on Java 1.6.
Is is possible to release a version supporting Java 1.6?
Thanks,
Repeated fields should be able to contain null values in their collections. This should work with sets and maps too.
Hi,
I've been interested in using clojure-protobuf with a project I'm currently working on. So I decided to get it using lein. I kept getting the following errors however when I ran lein deps:
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.2.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.clojure -DartifactId=clojure -Dversion=1.2.0-master-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) clojure-protobuf:clojure-protobuf:jar:0.2.4
3) org.clojure:clojure:jar:1.2.0-master-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.clojure -DartifactId=clojure-contrib -Dversion=1.2.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.clojure -DartifactId=clojure-contrib -Dversion=1.2.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) clojure-protobuf:clojure-protobuf:jar:0.2.4
3) org.clojure:clojure-contrib:jar:1.2.0-SNAPSHOT
I downloaded the jar and took a peek at the META-INF/maven/clojure-protobuf/clojure-protobuf/pom.xml file and noticed that it was referencing clojure 1.2.0-master-SNAPSHOT and clojure-contrib 1.2.0-SNAPSHOT.
I was wondering if it would be better to just refer to the 1.2.0 versions of these libraries instead.
Proto file:
message Settings {
repeated string currencies = 1;
repeated string timezones = 2;
}
When running lein jar
, I'm getting these errors:
/home/michael/Dev/projects/af-protocol/target/protosrc/af_protocol/protobuf/Events.java:6377: error: cannot find symbol
currencies_ = currencies_.getUnmodifiableView();
...
symbol: method getUnmodifiableView()
location: variable timezones_ of type LazyStringList
/home/michael/Dev/projects/af-protocol/target/protosrc/af_protocol/protobuf/Events.java:6753: error: cannot find symbol
return currencies_.getUnmodifiableView();
...
symbol: method getUnmodifiableView()
location: variable timezones_ of type LazyStringList
/home/michael/Dev/projects/af-protocol/target/protosrc/af_protocol/protobuf/Events.java:6420: error: incompatible types: LazyStringList cannot be converted to ProtocolStringList
return currencies_;
^
...
Project settings are:
:plugins [[lein-protobuf "0.4.3"]]
:dependencies [[org.clojure/clojure "1.6.0"]
[org.flatland/protobuf "0.8.1"]
[com.google.protobuf/protobuf-java "2.6.1"]])
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.