#!/bin/sh
#---------------------------------------------------------------------
# Compile the MyCommand example component on Unix.
#---------------------------------------------------------------------

# ---------------------------------------------------------------------
# *** IMPORTANT *** 
# The Java compiler must be of correct version. Please refer
# "Application Development - Environment Setup" section of the 
# Development Guide, to know the required Java compiler version.
# ---------------------------------------------------------------------

#---------------------------------------------------------------------
# Confirm installation of JAVA compiler under JAVA_JDK
# and of Isight under FIPER_HOME
#---------------------------------------------------------------------
if [ ! -f "$JAVA_JDK/bin/javac" ]; then
    echo "The environment variable JAVA_JDK must point to a Java compiler"
    exit 1
fi
if [ ! -f $FIPER_HOME/docs/java/SMAFIPsdk.jar ]; then
    echo "The environment variable FIPER_HOME must point to an Isight installation"
    exit 1
fi

#---------------------------------------------------------------------
# Set up the JAVA class-path and build all source files.
#---------------------------------------------------------------------
CLASSPATH="$FIPER_HOME/docs/java/SMAFIPsdk.jar:$FIPER_HOME/docs/java/SMAFIPdesktopSDK.jar"
set -x
$JAVA_JDK/bin/javac -classpath "$CLASSPATH" -d . *.java

#---------------------------------------------------------------------
# Now build a Jar file containing the class files and the MetaModel.
#---------------------------------------------------------------------
$JAVA_JDK/bin/jar -cvfm MyCommand.jar MyCommand.mf MyCommand.xml examples/development/components/mycommand/*
