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:
Stefano Mazzocchi 2010-03-04 08:46:33 +00:00
parent 22f226358d
commit 409b451085
4 changed files with 1399 additions and 4 deletions

View File

@ -48,6 +48,8 @@ and <action> is one of
make_dmg <version> ........ Make MacOSX DMG distribution make_dmg <version> ........ Make MacOSX DMG distribution
make_exe <version> ........ Make Windows EXE distribution make_exe <version> ........ Make Windows EXE distribution
generate .................. Generate Protocol Buffer code
clean ..................... Clean compiled classes clean ..................... Clean compiled classes
distclean ................. Remove all generated files distclean ................. Remove all generated files
@ -61,6 +63,9 @@ add_option() {
OPTS="$GRIDWORKS_OPTS" OPTS="$GRIDWORKS_OPTS"
# Normalize the current directory
cd `dirname $0`
SYSTEM=`uname` SYSTEM=`uname`
if [ "$SYSTEM" == "Darwin" ] && [ "$JAVA_HOME" == "" ] ; then if [ "$SYSTEM" == "Darwin" ] && [ "$JAVA_HOME" == "" ] ; then
@ -82,12 +87,14 @@ ant_prepare() {
ANT=`which ant` ANT=`which ant`
if [ "$ANT" = "" ] ; then 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//'` ANT_DIR=`echo $ANT_TAR | sed 's/.tar.gz//'`
if [ ! -d $ANT_DIR ] ; then if [ ! -d $ANT_DIR ] ; then
tar xzf $ANT_TAR -C $GRIDWORKS_BUILD_DIR || exit 1 tar xzf $ANT_TAR -C . || exit 1
fi fi
ANT="$ANT_DIR/bin/ant" ANT="`pwd`/$ANT_DIR/bin/ant"
cd ..
fi fi
} }
@ -104,11 +111,30 @@ dist_prepare() {
} }
launch4j_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" LAUNCH4J_DIR="thirdparty/launch4j"
if [ ! -d "$LAUNCH4J_DIR" ] ; then if [ ! -d "$LAUNCH4J_DIR" ] ; then
tar xzf $LAUNCH4J_TAR -C thirdparty || exit 1 tar xzf $LAUNCH4J_TAR -C thirdparty || exit 1
fi 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() { get_version() {
@ -181,6 +207,17 @@ make_dmg() {
rm -f "$GRIDWORKS_BUILD_DIR/temp_gridworks.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() { run() {
if [ ! -d $GRIDWORKS_BUILD_DIR/classes ] ; then if [ ! -d $GRIDWORKS_BUILD_DIR/classes ] ; then
ant build ant build
@ -289,6 +326,10 @@ fi
# ----- Respond to the action given -------------------------------------------- # ----- Respond to the action given --------------------------------------------
case "$ACTION" in case "$ACTION" in
generate)
generate;;
build) build)
ant build;; ant build;;

File diff suppressed because it is too large Load Diff

View 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

Binary file not shown.