- removed all bash-isms (hopefully)

- hardened FULL_VERSION calculation (used only in the win32 exe, btw)
- made windows_dist run on all operating systems, not just mac

git-svn-id: http://google-refine.googlecode.com/svn/trunk@1265 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Stefano Mazzocchi 2010-09-16 18:16:46 +00:00
parent df0a30e22d
commit 221504e2da

View File

@ -97,7 +97,7 @@ load_configs() {
}
check_macosx() {
if ! $DARWIN ; then
if [ "$OS" != "macosx" ] ; then
error "This action can only run on MacOSX"
fi
}
@ -156,17 +156,23 @@ get_version() {
fail "Must specify a version number"
fi
if [[ "${VERSION}" == *.*.*.* ]]; then
FULL_VERSION="${VERSION}"
elif [[ "${VERSION}" == *.*.* ]]; then
FULL_VERSION="${VERSION}.0"
elif [[ "${VERSION}" == *.* ]]; then
FULL_VERSION="${VERSION}.0.0"
else
FULL_VERSION="${VERSION}.0.0.0"
NUM_VERSION=`echo $VERSION | sed -E 's/[a-zA-Z]+/./g'`
if [ "${NUM_VERSION}" == "" ] ; then
fail "${VERSION} is not a valid version number"
fi
NUM_VERSION=`echo $VERSION | sed 's/[a-zA-Z]//g'`
if [ "`echo "${NUM_VERSION}" | egrep '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'`" == "${NUM_VERSION}" ] ; then
FULL_VERSION="${NUM_VERSION}"
elif [ "`echo "${NUM_VERSION}" | egrep '^[0-9]+\.[0-9]+\.[0-9]+$'`" == "${NUM_VERSION}" ] ; then
FULL_VERSION="${NUM_VERSION}.0"
elif [ "`echo "${NUM_VERSION}" | egrep ''^[0-9]+\.[0-9]+$''`" == "${NUM_VERSION}" ] ; then
FULL_VERSION="${NUM_VERSION}.0.0"
elif [ "`echo "${NUM_VERSION}" | egrep '^[0-9]+$'`" == "${NUM_VERSION}" ] ; then
FULL_VERSION="${NUM_VERSION}.0.0.0"
else
fail "${VERSION} is not a valid version number"
fi
}
get_revision() {
@ -267,7 +273,7 @@ ant_prepare() {
tar xzf $ANT_FILE -C . || error "Error while expanding $ANT_FILE"
fi
export ANT_HOME="`pwd`/$ANT_DIR"
if $CYGWIN ; then
if [ "$OS" = "windows" ] ; then
export ANT_HOME=`cygpath --unix "$ANT_HOME"`
fi
cd ..
@ -291,7 +297,14 @@ appengine_prepare() {
launch4j_prepare() {
tools_prepare
if [ "$OS" == "macosx" ] ; then
LAUNCH4J_URL="http://downloads.sourceforge.net/project/launch4j/launch4j-3/3.0.1/launch4j-3.0.1-macosx.tgz"
elif [ "$OS" == "windows" ] ; then
LAUNCH4J_URL="http://downloads.sourceforge.net/project/launch4j/launch4j-3/3.0.1/launch4j-3.0.1-linux.tgz"
elif [ "$OS" == "linux" ] ; then
LAUNCH4J_URL="http://downloads.sourceforge.net/project/launch4j/launch4j-3/3.0.1/launch4j-3.0.1-win32.zip"
fi
LAUNCH4J_FILE=`echo $LAUNCH4J_URL | sed 's|.*/||'`
LAUNCH4J_DIR="launch4j"
@ -318,7 +331,7 @@ virtualenv_prepare() {
tool_download $VIRTUALENV_URL $VIRTUALENV_FILE $VIRTUALENV_DIR
PYTHON_LOCAL="$GRIDWORKS_TOOLS_DIR/python"
if $CYGWIN ; then
if [ "$OS" = "windows" ] ; then
PYTHON_LOCAL="${PYTHON_LOCAL}_win"
fi
@ -328,7 +341,7 @@ virtualenv_prepare() {
PYTHON_HOME="`pwd`/$PYTHON_LOCAL"
if $CYGWIN ; then
if [ "$OS" = "windows" ] ; then
PYTHON="$PYTHON_HOME/Scripts/python.exe"
PYTHON_INSTALL="$PYTHON_HOME/Scripts/easy_install.exe"
else
@ -344,7 +357,7 @@ windmill_prepare() {
tools_prepare
virtualenv_prepare
if $CYGWIN ; then
if [ "$OS" = "windows" ] ; then
check_pywin32
WINDMILL="$PYTHON_HOME/Scripts/windmill.exe"
else
@ -394,7 +407,7 @@ ant() {
#export ANT_OPTS="-Xmx1024M"
"$ANT" -f build.xml $ANT_PARAMS -Dversion="$VERSION" -Dnum_version="$NUM_VERSION" -Dfull_version="$FULL_VERSION" -Drevision="$REVISION" $1 || error "Error while running ant task '$1'"
"$ANT" -f build.xml $ANT_PARAMS -Dversion="$VERSION" -Dfull_version="$FULL_VERSION" -Drevision="$REVISION" $1 || error "Error while running ant task '$1'"
}
# ----------------------------------------------------------------------------------------------
@ -421,7 +434,6 @@ dist() {
}
windows_dist() {
check_macosx
dist_prepare
get_version $1
get_revision
@ -588,7 +600,7 @@ run() {
add_option "-Dgridworks.autoreload=true -Dbutterfly.autoreload=true"
fi
if $DARWIN ; then
if [ "$OS" = "macosx" ] ; then
add_option "-Xdock:name=Gridworks -Xdock:icon=graphics/icon/gridworks.icns"
fi
@ -771,15 +783,14 @@ OPTS=""
SYSTEM=`uname`
CYGWIN=false
DARWIN=false
case "$SYSTEM" in
CYGWIN*) CYGWIN=true ;;
Darwin*) DARWIN=true ;;
CYGWIN*) OS="windows" ;;
Darwin*) OS="macosx" ;;
Linux*) OS="linux" ;;
esac
SEP=":"
if $CYGWIN ; then
if [ "$OS" = "windows" ] ; then
SEP=";"
fi
@ -789,7 +800,7 @@ load_configs gridworks.ini
# ----- Make sure there is an appropriate java environment is available -------------
if $DARWIN ; then
if [ "$OS" = "macosx" ] ; then
if [ -z "$JAVA_HOME" ] ; then
# Mac OS X defaults to Java 5. So update JAVA_HOME unless the user manually set it.
export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home"