#!/usr/bin/env bash
SMAC_MEMORY_INPUT=$SMAC_MEMORY
SMACMEM=1024
test "$SMAC_MEMORY_INPUT" -ge 1 2>&- && SMACMEM=$SMAC_MEMORY_INPUT
EXEC=ca.ubc.cs.beta.aeatk.example.evaluator.TAEEvaluator
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ ! -d "$DIR/lib" ]; then
DIR="$(dirname "$DIR")"
fi
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DIR/lib/native/:$DIR/lib/:$DIR/
DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:$DIR/lib/native/:$DIR/lib/:$DIR/
echo "Starting tae-evaluator with $SMACMEM MB of RAM"

for f in $DIR/lib/*.jar
do
	jarconcat=$jarconcat:$f
done
for f in $DIR/*.jar
do
	jarconcat=$jarconcat:$f
done
jarconcat=${jarconcat:1}

exec java -Xmx"$SMACMEM"m -cp "$DIR/conf/:$DIR/patches/:$jarconcat:$DIR/patches/" ca.ubc.cs.beta.aeatk.ant.execscript.Launcher $EXEC "$@"
