diff --git a/build b/build index 166df99f9..47f91d514 100755 --- a/build +++ b/build @@ -9,7 +9,8 @@ rm -rf $TARGET mkdir $TARGET # find all protocol buffer files in src directory -PROTO_FILES=`find src -name *.proto` +#PROTO_FILES=`find src -name *.proto` +PROTO_FILES=src/client_container.proto # make variables available to sub-scripts export SRC TARGET PROTO_FILES diff --git a/build_protoc b/build_protoc index 452a2dc25..47c2a6fd2 100755 --- a/build_protoc +++ b/build_protoc @@ -3,9 +3,12 @@ # this build file uses protoc to build all protocol buffers # http://code.google.com/p/protobuf/downloads/list + TARGET_CPP="$TARGET/cpp" +TARGET_JAVA="$TARGET/java" mkdir -p "$TARGET_CPP" +mkdir -p "$TARGET_JAVA" # if you don't want to put protoc on the command line, # then set a PROTOC environment variable @@ -20,3 +23,5 @@ set -e echo "building cpp protocol buffers" $PROTOC $PROTO_FILES --cpp_out=$TARGET_CPP --proto_path=$SRC +echo "building java protocol buffers" +$PROTOC $PROTO_FILES --java_out=$TARGET_JAVA --proto_path=$SRC diff --git a/ivy.xml b/ivy.xml new file mode 100644 index 000000000..3e6df90b2 --- /dev/null +++ b/ivy.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ivysettings.xml b/ivysettings.xml new file mode 100644 index 000000000..ba74af988 --- /dev/null +++ b/ivysettings.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/package_java b/package_java new file mode 100755 index 000000000..83bb0e8da --- /dev/null +++ b/package_java @@ -0,0 +1,16 @@ +#!/bin/bash + +# not yet integrated into any formal build step. +# usage: after you've run ./build, run ./package_java to generate a jar +set -e + +echo "packaging java" +# retrieve protocol buffer dependency +java -jar $IVY -sync -retrieve "target/lib/[conf]/[artifact]-[type].[ext]" +# compile java file generated by protocol buffrs +javac -cp target/lib/default/protobuf-java-jar.jar target/java/jampb/ClientContainer.java +pushd target/java/jampb +# create jar with all classes generated by javac +jar cvf jampb-clientcontainer.jar `find . -name \*.class` +popd + diff --git a/src/client_container.proto b/src/client_container.proto new file mode 100644 index 000000000..7a721325d --- /dev/null +++ b/src/client_container.proto @@ -0,0 +1,24 @@ + +package jampb; + +message ClientMessage { + enum Type { LOGIN = 1; JOIN_JAM_SESSION = 2;} + + // Identifies which inner message is filled in + required Type type = 1; + required string target = 2; + + // One of the following messages can be populated + optional Login login = 100; + optional JoinJamSession join_jam_session = 101; +} + +message JoinJamSession { + optional string user_token = 1; // token provided from previous login + optional string jam_session_id = 2; // id for jam_session +} + +message Login { + optional string username = 1; // username + optional string token = 2; // a token provided by the server that validates this user +} diff --git a/src/login.proto b/src/login.proto deleted file mode 100644 index 4f960f2ca..000000000 --- a/src/login.proto +++ /dev/null @@ -1,4 +0,0 @@ -message Login { - optional string username = 1; // username - optional string token = 2; // a token provided by the server that validates this user -}