started work on protocol buffers
git-svn-id: http://google-refine.googlecode.com/svn/trunk@197 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
22f226358d
commit
409b451085
49
gridworks
49
gridworks
@ -48,6 +48,8 @@ and <action> is one of
|
||||
make_dmg <version> ........ Make MacOSX DMG distribution
|
||||
make_exe <version> ........ Make Windows EXE distribution
|
||||
|
||||
generate .................. Generate Protocol Buffer code
|
||||
|
||||
clean ..................... Clean compiled classes
|
||||
distclean ................. Remove all generated files
|
||||
|
||||
@ -61,6 +63,9 @@ add_option() {
|
||||
|
||||
OPTS="$GRIDWORKS_OPTS"
|
||||
|
||||
# Normalize the current directory
|
||||
cd `dirname $0`
|
||||
|
||||
SYSTEM=`uname`
|
||||
|
||||
if [ "$SYSTEM" == "Darwin" ] && [ "$JAVA_HOME" == "" ] ; then
|
||||
@ -82,12 +87,14 @@ ant_prepare() {
|
||||
|
||||
ANT=`which ant`
|
||||
if [ "$ANT" = "" ] ; then
|
||||
ANT_TAR=`find thirdparty | grep apache-ant | grep -v svn`
|
||||
cd thirdparty
|
||||
ANT_TAR=`ls | grep apache-ant | grep tar.gz | grep -v svn`
|
||||
ANT_DIR=`echo $ANT_TAR | sed 's/.tar.gz//'`
|
||||
if [ ! -d $ANT_DIR ] ; then
|
||||
tar xzf $ANT_TAR -C $GRIDWORKS_BUILD_DIR || exit 1
|
||||
tar xzf $ANT_TAR -C . || exit 1
|
||||
fi
|
||||
ANT="$ANT_DIR/bin/ant"
|
||||
ANT="`pwd`/$ANT_DIR/bin/ant"
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
@ -104,11 +111,30 @@ dist_prepare() {
|
||||
}
|
||||
|
||||
launch4j_prepare() {
|
||||
LAUNCH4J_TAR=`find thirdparty | grep launch4j | grep -v svn`
|
||||
cd thirdparty
|
||||
LAUNCH4J_TAR=`ls | grep launch4j | grep tar.gz | grep -v svn`
|
||||
LAUNCH4J_DIR="thirdparty/launch4j"
|
||||
if [ ! -d "$LAUNCH4J_DIR" ] ; then
|
||||
tar xzf $LAUNCH4J_TAR -C thirdparty || exit 1
|
||||
fi
|
||||
cd ..
|
||||
}
|
||||
|
||||
protobuf_prepare() {
|
||||
cd thirdparty
|
||||
PROTOBUF_TAR=`ls | grep protobuf | grep tar.gz | grep -v svn`
|
||||
PROTOBUF_DIR=`echo $PROTOBUF_TAR | sed 's/.tar.gz//'`
|
||||
PROTOC="`pwd`/$PROTOBUF_DIR/bin/protoc"
|
||||
if [ ! -f $PROTOC ] ; then
|
||||
tar xzf $PROTOBUF_TAR -C . || exit 1
|
||||
cd $PROTOBUF_DIR
|
||||
./configure --prefix=`pwd`
|
||||
make
|
||||
make install
|
||||
cd ..
|
||||
fi
|
||||
PROTOC="`pwd`/$PROTOBUF_DIR/bin/protoc"
|
||||
cd ..
|
||||
}
|
||||
|
||||
get_version() {
|
||||
@ -181,6 +207,17 @@ make_dmg() {
|
||||
rm -f "$GRIDWORKS_BUILD_DIR/temp_gridworks.dmg"
|
||||
}
|
||||
|
||||
generate() {
|
||||
protobuf_prepare
|
||||
|
||||
PROTO_SRC_DIR="src/main/proto"
|
||||
JAVA_SRC_DIR="src/main/java"
|
||||
|
||||
for i in `find $PROTO_SRC_DIR -name \*.proto` ; do
|
||||
$PROTOC -I=$PROTO_SRC_DIR --java_out=$JAVA_SRC_DIR $i
|
||||
done
|
||||
}
|
||||
|
||||
run() {
|
||||
if [ ! -d $GRIDWORKS_BUILD_DIR/classes ] ; then
|
||||
ant build
|
||||
@ -289,6 +326,10 @@ fi
|
||||
# ----- Respond to the action given --------------------------------------------
|
||||
|
||||
case "$ACTION" in
|
||||
|
||||
generate)
|
||||
generate;;
|
||||
|
||||
build)
|
||||
ant build;;
|
||||
|
||||
|
1331
src/main/java/com/metaweb/gridworks/data/Model.java
Normal file
1331
src/main/java/com/metaweb/gridworks/data/Model.java
Normal file
File diff suppressed because it is too large
Load Diff
23
src/main/proto/gridworks.proto
Normal file
23
src/main/proto/gridworks.proto
Normal file
@ -0,0 +1,23 @@
|
||||
package gridworks;
|
||||
|
||||
option java_package = "com.metaweb.gridworks.data";
|
||||
option java_outer_classname = "Model";
|
||||
|
||||
message Expression {
|
||||
required string value = 1;
|
||||
}
|
||||
|
||||
message Project {
|
||||
required string name = 1;
|
||||
required int64 created = 2;
|
||||
required int64 modified = 3;
|
||||
required string encoding = 4;
|
||||
optional int32 encoding_confidence = 5;
|
||||
optional string creator = 6;
|
||||
optional string password = 7;
|
||||
repeated Expression expression = 8;
|
||||
}
|
||||
|
||||
message ProjectManager {
|
||||
repeated Project projects = 1;
|
||||
}
|
BIN
thirdparty/protobuf-2.3.0.tar.gz
vendored
Normal file
BIN
thirdparty/protobuf-2.3.0.tar.gz
vendored
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user