#!/bin/bash

BINDIR=$(cd $(dirname "$0"); pwd)
. ${BINDIR}/set-env.sh
if [ -z "$COH_HOME" ]; then
    echo Cannot run $0, environment not correctly set
    echo Please examine bin/set-env.sh and set OBE_HOME and COH_HOME
    kill -2 $$
fi

CLASSPATH=${COH_HOME}/lib/coherence.jar:./classes:./config:.


echo Removing the any previously created classes
rm -rf ${OBE_HOME}/classes
mkdir ${OBE_HOME}/classes
echo compiling the files in the src/java directory
find ${OBE_HOME}/src -name "*.java" > src_files.list
echo javac -classpath ${COH_HOME}/coherence.jar -sourcepath ${OBE_HOME}/src/java/ -d ../classes @src_files.list
javac -classpath ${COH_HOME}/lib/coherence.jar -sourcepath ${OBE_HOME}/src/java/ -d ${OBE_HOME}/classes @src_files.list

rm src_files.list
echo Done
