#!/bin/sh

# This script rebuilds the solution code jar file.  It only excludes
# java files (which allows solutions to the current lab to be run
# without giving away the solution code.  The code must already be
# compiled before running this.
#
# This script was lost in 2008, recovered and modified by Carrick in 2009

echo "NOTE: SOLUTION CODE MUST ALREADY BE COMPILED"

if [ ! -e tmp ]; then
  mkdir tmp
fi

cd tmp

pkgdirs=`find ..  -maxdepth 1 -mindepth 1 -type d -a -not -name tmp -a -not -name .svn`

for d in $pkgdirs; do
  rsync -Crav --include="*.class" --exclude="*.java" $d .
done

jar cvf solutions.jar *

mv solutions.jar ..

cd ..

rm -rf tmp

echo "NOTE: SOLUTION CODE MUST ALREADY BE COMPILED"
