#!/bin/ksh
#*******************************************************************************
# ALMA - Atacama Large Millimiter Array
# (c) European Southern Observatory, 2002
# Copyright by ESO (in the framework of the ALMA collaboration),
# All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
# MA 02111-1307  USA
#
# "@(#) $Id: xmlIdlCompiler,v 1.3 2004/09/20 14:58:38 mpasquat Exp $"
#
# who       when      what
# --------  --------  ----------------------------------------------
# hsommer   18/01/03  added --tie to jidl Orbacus command
#
#************************************************************************

# param1 root output directory for ALMA IDL compiler (usually some temporary directory)

# param2 IDL include directory1, e.g. project's /idl directory
# param3 IDL include directory2, e.g. INTROOT/idl
# param4 IDL include directory4  e.g. INTLISTdir/idl
# param5 IDL include directory5, e.g. ACSROOT/idl

# param6 the idl file that should be compiled
# param7 flag for generation of component helper classes ("true" will do, otherwise not)
# param8 root output directory for component helper generator (usually some /src directory)

# example call from XmlIdl/test
# xmlIdlCompiler ../src_generated ../idl ../introot/idl Y:/alma/ACS-2.0/ACSSW/idl ../idl/xmltest.idl true ../src_generated


# will be removed later, as the Makefile is supposed to provide us with the all-powerfull classpath
#

#CLASSPATH=../lib/xmlidl.jar:../lib/openorb13Debug.jar:../lib/logkit.jar:../lib/avalon-framework.jar:/introot/lib/comphelpgen.jar
#CLASSPATH=${CLASSPATH}:../lib/castor.jar
CLASSPATH=`vltMakeJavaClasspath`
CLASSPATH=${CLASSPATH}:/alma/ACS-2.0/ACSSW/lib/endorsed/xercesImpl.jar:

# Separation of dirs
item_list=`echo $INTLIST | sed s/:/\ /g`
intlist_list=""
for item in $item_list
do
   intlist_list=$intlist_list" -I$item/idl"
done


AlmaIDLOutRootDirDef="-d $1"
AlmaIDLIncludeDef="-I $2 -I $3 $4 -I $5"
AlmaIDLMainClass=alma.tools.idlgen.XmlIdlCompiler

CompHelpDoGenerateDef=-Dalma.acs.tools.comphelpergen.doGenerate=$7
CompHelpOutRootDirDef=-Dalma.acs.tools.comphelpergen.outRootDir=$8

# feel free to toggle this for debug output
# set verboseDef=-verbose
verboseDef=""

echo "java $CompHelpDoGenerateDef $CompHelpOutRootDirDef -cp $CLASSPATH $AlmaIDLMainClass $AlmaIDLOutRootDirDef $AlmaIDLIncludeDef -notie $verboseDef $6"



