Hi, David, Jan
Many thanks for taking the trouble to explain all this!
I've ended up with this in an ant.conf file:
#!/bin/sh
DITA_HOME=~/DITA-OT1.4.2.1
DITA_HOME=`cd "$DITA_HOME" && pwd`
#export ANT_HOME="$DITA_HOME"/tools/ant
export ANT_HOME=/Developer/Java/Ant
export ANT_OPTS="-Xmx512m"
export ANT_ARGS="-lib $DITA_HOME/lib -Ddita.dir=$DITA_HOME"
Are you saying I don't need to export any of these? I can just define
them?
The DITA Toolkit includes its own version of ant, so I can switch
between it and the XCode installed version.
Many thanks,
David
On Mon, May 19, 2008 at 7:44 AM, <[EMAIL PROTECTED]>
wrote:
I find shell scripts distinctly un-intutive, so no, I haven't
tried it!
Let's look at the scripts step by step:
if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then
if [ -f "/etc/ant.conf" ] ; then
. /etc/ant.conf
fi
fi
The outer if/then statement says if ANT_HOME isn't defined, or it is
defined as /usr/share/ant, then you check to see if the file
/etc/ant.conf exists. If it does, you execute it in the current
environment. This file should set some environment variables -- maybe
even the $ANT_HOME environment variable. This is the system wide
ant.conf file. You could set JAVA_HOME, ANT_HOME, whether to use the
jikes compiler, etc. And, these would apply to anyone who uses that
computer and doesn't have their own ANT installation.
# load user ant configuration
if [ -f "$HOME/.ant/ant.conf" ] ; then
. $HOME/.ant/ant.conf
fi
if [ -f "$HOME/.antrc" ] ; then
. "$HOME/.antrc"
fi
The first if/ten statement looks to see if a file called
$HOME/.ant/ant.conf exists. If it does, it executes it in the current
environment. Again, this file probably just sets some environment
variables including JAVA_HOME and ANT_HOME.
The second if/then statement does the same thing for $HOME/.antrc.
Files that begin with a dot are normally invisible to the user. It is
common practice to have either a .xxxrc file to set parameters or to
have a .xxx directory that contains a *.conf file that sets
parameters. Ant does it both ways for no good reason.
Do I have to use both Set and Export for ANT_HOME, do you think?
Exporting an environment variable makes it available in all child
processes. Otherwise, it is only available in the current process. If
you define ANT_HOME in your .antrc file, you don't have to export it
since the shell script doesn't spawn another process. If you define it
before you run this script, you do have to export it or the script
won't see it.
BTW, notice that the ant script sets
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
if you don't have JAVA_HOME defined before your execute the "ant"
script on a Mac.
--
David Weintraub
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]