@ECHO OFF
SETLOCAL

goto begin
:usage
echo.
echo.
echo Build Config. Command line options (see build.xml for details):
echo    clean    -  Remove the build directory structure.
echo    prepare  -  Create the build directory structure.
echo    compile  -  Compile the java code.
echo    javadoc  -  Generate javadoc API documentation.
echo    all      -  Rebuild everything. Performs each of the above.
echo    test     -  Run unit tests.
echo    dist     -  Builds the distribution JAR files.
echo    applet   -  Builds and signs the applet
echo    junittest-  Generates & executes the JUnit test cases
echo.
echo Examples:
echo    %0 compile
echo    %0 all
echo.
echo.
echo Environment variables.
echo.
echo    ENV. VAR.    DESCRIPTION                               
echo    ------------ ---------------------------------------------------------
echo    JAVA_HOME        Home dir of Java developer kit.
echo    ANT_HOME         Home dir of Java developer kit.
echo    JUNIT_HOME       Home dir of JUnit test utility
echo    JUNITDOCLET_HOME Home dir of JUnit doclet generation utility
echo    CLASSPATH        Additional classpath entries beyond what the build tool needs.
echo.
goto End

rem ===========================================================================
rem == Begin processing the build request                                    ==
rem ===========================================================================
:begin

rem ===========================================================================
rem == Check for a request for help                                          ==
rem ===========================================================================
if "%1" == "-h" goto usage
if "%1" == "-H" goto usage
if "%1" == "--h" goto usage
if "%1" == "--H" goto usage
if "%1" == "/h" goto usage
if "%1" == "/H" goto usage
if "%1" == "?" goto usage
if "%1" == "-?" goto usage
if "%1" == "/?" goto usage
if "%1" == "-help" goto usage
if "%1" == "-HELP" goto usage
if "%1" == "--help" goto usage
if "%1" == "--HELP" goto usage
if "%1" == "/help" goto usage
if "%1" == "/HELP" goto usage

if exist .\config.bat call config.bat

if "%JAVA_HOME%"  == "" set JAVA_HOME=c:\j2sdk1.4.2
if "%ANT_HOME%"   == "" set ANT_HOME=C:\apache-ant-1.5.3-1
if "%JUNIT_HOME%" == "" set JUNIT_HOME=C:\Downloads\junit\junit3.8.1
if "%JUNITDOCLET_HOME%" == "" set JUNITDOCLET_HOME=C:\Downloads\junit\JUnitDoclet.1.0.2

set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin\;%path%
set CLASSPATH=%JUNIT_HOME%\junit.jar;%JUNITDOCLET_HOME%\JUnitDoclet.jar;%CLASSPATH%

ant %1 %2 %3 %4 %5 %6 %7 %8
goto end


:end
ENDLOCAL
