root/trunk/ProjectFortress/ant

Revision 1698, 2.0 kB (checked in by dr2chase, 5 months ago)

This time for sure, make ./ant work if it guesses ANT_HOME, even if DOT is on the PATH

  • Property svn:executable set to *
Line 
1 #!/bin/bash
2
3 ################################################################################
4 #    Copyright 2007 Sun Microsystems, Inc.,
5 #    4150 Network Circle, Santa Clara, California 95054, U.S.A.
6 #    All rights reserved.
7 #
8 #    U.S. Government Rights - Commercial software.
9 #    Government users are subject to the Sun Microsystems, Inc. standard
10 #    license agreement and applicable provisions of the FAR and its supplements.
11 #
12 #    Use is subject to license terms.
13 #
14 #    This distribution may include materials developed by third parties.
15 #
16 #    Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
17 #    trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
18 ################################################################################
19
20 #
21 # For NetBeans, you should not need to adjust anything to
22 # build and test Fortress.
23 #
24 # For Eclipse, workspace and ant builds should not require any
25 # adjustments, but to run tests using Ant within Eclipse, you
26 # will need to add junit.jar to
27 # build.xml -> Run As -> Ant Build... -> Classpath -> User Entries -> Add JARs...
28 #
29
30 find_ant(){
31
32   # if $ANT_HOME is set then search for ant there
33   if [ "x$ANT_HOME" != "x" ]; then
34     if [ -x "$ANT_HOME/bin/ant" ]; then
35       echo "$ANT_HOME/bin/ant"
36       return
37     else
38       echo "Did not find ant in $ANT_HOME/bin" >&2
39     fi
40   else
41     echo "ANT_HOME is not set" >&2
42   fi
43
44   # Otherwise use whatever is in $PATH, minus any dots
45   export NODOTPATH="`echo "$PATH" | sed -e '1,$s/^[.]://g'`"
46   NODOTPATH="`echo "$NODOTPATH" | sed -e '1,$s/:[.]:/:/g'`"
47   NODOTPATH="`echo "$NODOTPATH" | sed -e '1,$s/:[.]$//g'`"
48   result="`(PATH="$NODOTPATH" which ant 2>/dev/null)`"
49   if [ -z "$result" ]; then
50     echo "Could not find ant. You need to install it. See http://ant.apache.org/ for details." >&2
51     exit 1
52   fi
53   echo $result
54   exit 0
55 }
56
57 ant_exec="`find_ant`"
58 n=$?
59 if [ $n -ne 0 ]; then
60         exit $n
61 fi
62 "$ant_exec" -noclasspath -lib third_party/junit "$@"
Note: See TracBrowser for help on using the browser.