#!/bin/sh

DM_SVN_URL=https://subversion.xray.aps.anl.gov/DataManagement

execute() {
    echo "Executing: $@"
    eval "$@"
}

# load tools
execute svn export $DM_SVN_URL/trunk/tools/ExperimentSynchronizer ExperimentSynchronizer
EXPSYNC_DIR=ExperimentSynchronizer
cd $EXPSYNC_DIR/lib

# load java 7
execute svn export $DM_SVN_URL/support/src/jdk-7u51-linux-x64.tar.gz 
JAVA_VERSION=7u51
tar zxf jdk-${JAVA_VERSION}*.tar.gz

cd ..
mkdir bin
execute lib/jdk1.7.0_51/bin/javac -classpath lib/*:resources/* -d bin/ src/gov/anl/dm/esafsync/*.java src/gov/anl/dm/esafsync/serviceconn/*.java
mkdir target
execute jar cfm target/ExperimentSynchronizer.jar manifest.txt -C bin/ . 

