#!/bin/sh
## This is the build file

rm -rf tempCompiled
mkdir tempCompiled

javac -d tempCompiled -classpath .:junit.jar:tests:tempCompiled tests/com/declarativa/interprolog/*.java tests/com/xsb/interprolog/*.java com/declarativa/interprolog/*.java com/declarativa/interprolog/util/*.java com/declarativa/interprolog/gui/*.java com/declarativa/interprolog/examples/*.java com/xsb/interprolog/*.java
echo 'Step1 ----> Compiled the java files'

./compile_Ps
echo 'Step2 ----> Compiled the .P files'

cp com/declarativa/interprolog/*.O tempCompiled/com/declarativa/interprolog
cp com/declarativa/interprolog/gui/*.O tempCompiled/com/declarativa/interprolog/gui

cp com/declarativa/interprolog/*.xwam tempCompiled/com/declarativa/interprolog
cp com/declarativa/interprolog/gui/*.xwam tempCompiled/com/declarativa/interprolog/gui

# images folder is not present in tempCompiled
mkdir tempCompiled/com/declarativa/interprolog/gui/images
cp com/declarativa/interprolog/gui/images/* tempCompiled/com/declarativa/interprolog/gui/images

cd tempCompiled
echo 'Step3 ----> Copied the *.O files in tempCompiled'

rm ../interprolog.jar
echo 'Step4 ----> removed the old interprolog.jar'

jar cf ../interprolog.jar *
echo 'Step5 ----> created a new interprolog.jar'

cd ..
rm -rf tempCompiled
echo 'Step6 ----> removed the tempCompiled'
