normalise whitespace in scripts and use Perl idioms properlymaster
@@ -19,30 +19,34 @@ | |||||
cygwin=false; | cygwin=false; | ||||
darwin=false; | darwin=false; | ||||
case "`uname`" in | case "`uname`" in | ||||
CYGWIN*) cygwin=true ;; | |||||
Darwin*) darwin=true | |||||
if [ -z "$JAVA_HOME" ] ; then | |||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home | |||||
fi | |||||
;; | |||||
CYGWIN*) | |||||
cygwin=true ;; | |||||
Darwin*) | |||||
darwin=true | |||||
if [ -z "$JAVA_HOME" ]; then | |||||
if [ -x '/usr/libexec/java_home' ]; then | |||||
JAVA_HOME=`/usr/libexec/java_home` | |||||
elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then | |||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home | |||||
fi | |||||
fi | |||||
;; | |||||
esac | esac | ||||
# For Cygwin, ensure paths are in UNIX format before anything is touched | # For Cygwin, ensure paths are in UNIX format before anything is touched | ||||
if $cygwin ; then | |||||
[ -n "$JAVA_HOME" ] && | |||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | |||||
[ -n "$CLASSPATH" ] && | |||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"` | |||||
if $cygwin; then | |||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | |||||
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"` | |||||
fi | fi | ||||
# You will need to specify JAVA_HOME if compiling with 1.2 or later. | # You will need to specify JAVA_HOME if compiling with 1.2 or later. | ||||
if [ -n "$JAVA_HOME" ] ; then | |||||
if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then | |||||
if [ -n "$JAVA_HOME" ]; then | |||||
if [ -f "$JAVA_HOME/lib/tools.jar" ]; then | |||||
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar | CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar | ||||
fi | fi | ||||
if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then | |||||
if [ -f "$JAVA_HOME/lib/classes.zip" ]; then | |||||
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip | CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip | ||||
fi | fi | ||||
else | else | ||||
@@ -55,9 +59,9 @@ fi | |||||
# IBM's JDK on AIX uses strange locations for the executables: | # IBM's JDK on AIX uses strange locations for the executables: | ||||
# JAVA_HOME/jre/sh for java and rmid | # JAVA_HOME/jre/sh for java and rmid | ||||
# JAVA_HOME/sh for javac and rmic | # JAVA_HOME/sh for javac and rmic | ||||
if [ -z "$JAVAC" ] ; then | |||||
if [ -n "$JAVA_HOME" ] ; then | |||||
if [ -x "$JAVA_HOME/sh/javac" ] ; then | |||||
if [ -z "$JAVAC" ]; then | |||||
if [ -n "$JAVA_HOME" ]; then | |||||
if [ -x "$JAVA_HOME/sh/javac" ]; then | |||||
JAVAC=${JAVA_HOME}/sh/javac; | JAVAC=${JAVA_HOME}/sh/javac; | ||||
else | else | ||||
JAVAC=${JAVA_HOME}/bin/javac; | JAVAC=${JAVA_HOME}/bin/javac; | ||||
@@ -66,9 +70,9 @@ if [ -z "$JAVAC" ] ; then | |||||
JAVAC=javac | JAVAC=javac | ||||
fi | fi | ||||
fi | fi | ||||
if [ -z "$JAVACMD" ] ; then | |||||
if [ -n "$JAVA_HOME" ] ; then | |||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | |||||
if [ -z "$JAVACMD" ]; then | |||||
if [ -n "$JAVA_HOME" ]; then | |||||
if [ -x "$JAVA_HOME/jre/sh/java" ]; then | |||||
JAVACMD=$JAVA_HOME/jre/sh/java | JAVACMD=$JAVA_HOME/jre/sh/java | ||||
else | else | ||||
JAVACMD=$JAVA_HOME/bin/java | JAVACMD=$JAVA_HOME/bin/java | ||||
@@ -78,7 +82,7 @@ if [ -z "$JAVACMD" ] ; then | |||||
fi | fi | ||||
fi | fi | ||||
if [ ! -x "$JAVACMD" ] ; then | |||||
if [ ! -x "$JAVACMD" ]; then | |||||
echo "Error: JAVA_HOME is not defined correctly." | echo "Error: JAVA_HOME is not defined correctly." | ||||
echo " We cannot execute $JAVACMD" | echo " We cannot execute $JAVACMD" | ||||
exit | exit | ||||
@@ -89,22 +93,21 @@ export ANT_HOME | |||||
echo ... Bootstrapping Ant Distribution | echo ... Bootstrapping Ant Distribution | ||||
if [ -d "bootstrap" ] ; then | |||||
if [ -d "bootstrap" ]; then | |||||
rm -r bootstrap | rm -r bootstrap | ||||
fi | fi | ||||
if [ -d "build" ] ; then | |||||
if [ -d "build" ]; then | |||||
rm -r build | rm -r build | ||||
fi | fi | ||||
DIRLIBS=lib/optional/*.jar | DIRLIBS=lib/optional/*.jar | ||||
for i in ${DIRLIBS} | |||||
do | |||||
# if the directory is empty, then it will return the input string | |||||
# this is stupid, so case for it | |||||
if [ "$i" != "${DIRLIBS}" ] ; then | |||||
CLASSPATH=$CLASSPATH:"$i" | |||||
fi | |||||
for i in ${DIRLIBS}; do | |||||
# if the directory is empty, then it will return the input string | |||||
# this is stupid, so case for it | |||||
if [ "$i" != "${DIRLIBS}" ]; then | |||||
CLASSPATH=$CLASSPATH:"$i" | |||||
fi | |||||
done | done | ||||
TOOLS=src/main/org/apache/tools | TOOLS=src/main/org/apache/tools | ||||
@@ -126,14 +129,14 @@ mkdir -p bin | |||||
echo ... Compiling Ant Classes | echo ... Compiling Ant Classes | ||||
"${JAVAC}" $BOOTJAVAC_OPTS -d ${CLASSDIR} ${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \ | "${JAVAC}" $BOOTJAVAC_OPTS -d ${CLASSDIR} ${TOOLS}/bzip2/*.java ${TOOLS}/tar/*.java ${TOOLS}/zip/*.java \ | ||||
${TOOLS}/ant/util/regexp/RegexpMatcher.java \ | |||||
${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \ | |||||
${TOOLS}/ant/property/*.java \ | |||||
${TOOLS}/ant/types/*.java \ | |||||
${TOOLS}/ant/types/resources/*.java \ | |||||
${TOOLS}/ant/*.java ${TOOLS}/ant/taskdefs/*.java \ | |||||
${TOOLS}/ant/taskdefs/compilers/*.java \ | |||||
${TOOLS}/ant/taskdefs/condition/*.java | |||||
${TOOLS}/ant/util/regexp/RegexpMatcher.java \ | |||||
${TOOLS}/ant/util/regexp/RegexpMatcherFactory.java \ | |||||
${TOOLS}/ant/property/*.java \ | |||||
${TOOLS}/ant/types/*.java \ | |||||
${TOOLS}/ant/types/resources/*.java \ | |||||
${TOOLS}/ant/*.java ${TOOLS}/ant/taskdefs/*.java \ | |||||
${TOOLS}/ant/taskdefs/compilers/*.java \ | |||||
${TOOLS}/ant/taskdefs/condition/*.java | |||||
ret=$? | ret=$? | ||||
if [ $ret != 0 ]; then | if [ $ret != 0 ]; then | ||||
echo ... Failed compiling Ant classes ! | echo ... Failed compiling Ant classes ! | ||||
@@ -143,9 +146,9 @@ fi | |||||
echo ... Copying Required Files | echo ... Copying Required Files | ||||
cp src/main/org/apache/tools/ant/taskdefs/defaults.properties \ | cp src/main/org/apache/tools/ant/taskdefs/defaults.properties \ | ||||
${CLASSDIR}/org/apache/tools/ant/taskdefs | |||||
${CLASSDIR}/org/apache/tools/ant/taskdefs | |||||
cp src/main/org/apache/tools/ant/types/defaults.properties \ | cp src/main/org/apache/tools/ant/types/defaults.properties \ | ||||
${CLASSDIR}/org/apache/tools/ant/types | |||||
${CLASSDIR}/org/apache/tools/ant/types | |||||
cp src/script/antRun bin | cp src/script/antRun bin | ||||
chmod +x bin/antRun | chmod +x bin/antRun | ||||
@@ -158,7 +161,6 @@ if [ $ret != 0 ]; then | |||||
exit $ret | exit $ret | ||||
fi | fi | ||||
echo ... Cleaning Up Build Directories | echo ... Cleaning Up Build Directories | ||||
rm -rf ${CLASSDIR} | rm -rf ${CLASSDIR} | ||||
@@ -19,34 +19,41 @@ | |||||
cygwin=false; | cygwin=false; | ||||
darwin=false; | darwin=false; | ||||
case "`uname`" in | case "`uname`" in | ||||
CYGWIN*) cygwin=true ;; | |||||
Darwin*) darwin=true | |||||
if [ -z "$JAVA_HOME" ] ; then | |||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home | |||||
fi | |||||
;; | |||||
CYGWIN*) | |||||
cygwin=true | |||||
;; | |||||
Darwin*) | |||||
darwin=true | |||||
if [ -z "$JAVA_HOME" ]; then | |||||
if [ -x '/usr/libexec/java_home' ]; then | |||||
JAVA_HOME=`/usr/libexec/java_home` | |||||
elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then | |||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home | |||||
fi | |||||
fi | |||||
;; | |||||
esac | esac | ||||
REALANTHOME=$ANT_HOME | REALANTHOME=$ANT_HOME | ||||
if [ -z "$PWD" ]; then | if [ -z "$PWD" ]; then | ||||
ANT_HOME=./bootstrap | |||||
ANT_HOME=./bootstrap | |||||
else | else | ||||
ANT_HOME="$PWD"/bootstrap | |||||
ANT_HOME="$PWD"/bootstrap | |||||
fi | fi | ||||
export ANT_HOME | export ANT_HOME | ||||
if test ! -f bootstrap/lib/ant.jar -o ! -x bootstrap/bin/ant -o ! -x bootstrap/bin/antRun ; then | |||||
if test ! -f bootstrap/lib/ant.jar -o ! -x bootstrap/bin/ant -o ! -x bootstrap/bin/antRun; then | |||||
/bin/sh ./bootstrap.sh | /bin/sh ./bootstrap.sh | ||||
fi | fi | ||||
if test ! -f bootstrap/lib/ant.jar -o ! -x bootstrap/bin/ant -o ! -x bootstrap/bin/antRun ; then | |||||
if test ! -f bootstrap/lib/ant.jar -o ! -x bootstrap/bin/ant -o ! -x bootstrap/bin/antRun; then | |||||
echo Bootstrap FAILED | echo Bootstrap FAILED | ||||
exit 1 | exit 1 | ||||
fi | fi | ||||
if [ "$REALANTHOME" != "" ] ; then | |||||
if [ "$REALANTHOME" != "" ]; then | |||||
if $cygwin; then | if $cygwin; then | ||||
REALANTHOME=`cygpath --windows "$REALANTHOME"` | |||||
REALANTHOME=`cygpath --windows "$REALANTHOME"` | |||||
fi | fi | ||||
ANT_INSTALL="-Dant.install=$REALANTHOME" | ANT_INSTALL="-Dant.install=$REALANTHOME" | ||||
else | else | ||||
@@ -54,4 +61,3 @@ else | |||||
fi | fi | ||||
bootstrap/bin/ant -nouserlib -lib lib/optional "$ANT_INSTALL" $* | bootstrap/bin/ant -nouserlib -lib lib/optional "$ANT_INSTALL" $* | ||||
@@ -1,2 +1,2 @@ | |||||
ant eol=lf | ant eol=lf | ||||
anrRun eol=lf | |||||
antRun eol=lf |
@@ -22,35 +22,33 @@ use_jikes_default=false | |||||
ant_exec_debug=false | ant_exec_debug=false | ||||
show_help=false | show_help=false | ||||
if [ -z "$PROTECT_NL" ] | |||||
then | |||||
if [ -z "$PROTECT_NL" ]; then | |||||
PROTECT_NL=true | PROTECT_NL=true | ||||
os=`uname -s` | os=`uname -s` | ||||
rel=`uname -r` | rel=`uname -r` | ||||
# heirloom bourne-shell used by Solaris 10 is not POSIX | # heirloom bourne-shell used by Solaris 10 is not POSIX | ||||
# it lacks features necessary to protect trailing NL from subshell trimming | # it lacks features necessary to protect trailing NL from subshell trimming | ||||
if [ "$os" = SunOS -a "$rel" = "5.10" ] | |||||
then | |||||
if [ "$os" = SunOS -a "$rel" = "5.10" ]; then | |||||
PROTECT_NL=false | PROTECT_NL=false | ||||
fi | fi | ||||
fi | fi | ||||
for arg in "$@" ; do | |||||
if [ "$arg" = "--noconfig" ] ; then | |||||
for arg in "$@"; do | |||||
if [ "$arg" = "--noconfig" ]; then | |||||
no_config=true | no_config=true | ||||
elif [ "$arg" = "--usejikes" ] ; then | |||||
elif [ "$arg" = "--usejikes" ]; then | |||||
use_jikes_default=true | use_jikes_default=true | ||||
elif [ "$arg" = "--execdebug" ] ; then | |||||
elif [ "$arg" = "--execdebug" ]; then | |||||
ant_exec_debug=true | ant_exec_debug=true | ||||
elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then | |||||
elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ]; then | |||||
show_help=true | show_help=true | ||||
ant_exec_args="$ant_exec_args -h" | ant_exec_args="$ant_exec_args -h" | ||||
else | else | ||||
if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then | |||||
if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ]; then | |||||
show_help=true | show_help=true | ||||
fi | fi | ||||
if [ "$PROTECT_NL" = "true" ] ; then | |||||
if [ "$PROTECT_NL" = "true" ]; then | |||||
# pad the value with X to protect trailing NLs from subshell output trimming | # pad the value with X to protect trailing NLs from subshell output trimming | ||||
esc_arg="${arg}X" | esc_arg="${arg}X" | ||||
else | else | ||||
@@ -64,14 +62,13 @@ for arg in "$@" ; do | |||||
# subshell (heirloom and posix) will trim the added trailing newline | # subshell (heirloom and posix) will trim the added trailing newline | ||||
esc_arg="`printf '%s\n' "$esc_arg" | sed -e 's@\([$\"\`\\]\)@\\\\\\1@g' `" | esc_arg="`printf '%s\n' "$esc_arg" | sed -e 's@\([$\"\`\\]\)@\\\\\\1@g' `" | ||||
if [ "$PROTECT_NL" = "true" ] ; then | |||||
if [ "$PROTECT_NL" = "true" ]; then | |||||
# remove the padding X added above, this syntax is POSIX compatible but not heirloom-sh | # remove the padding X added above, this syntax is POSIX compatible but not heirloom-sh | ||||
esc_arg="${esc_arg%X}" | esc_arg="${esc_arg%X}" | ||||
fi | fi | ||||
quoted_arg="\"$esc_arg\"" | quoted_arg="\"$esc_arg\"" | ||||
if $ant_exec_debug | |||||
then | |||||
if $ant_exec_debug; then | |||||
# using printf to avoid echo line continuation and escape interpretation | # using printf to avoid echo line continuation and escape interpretation | ||||
printf "arg : %s\n" "$arg" | printf "arg : %s\n" "$arg" | ||||
printf "quoted_arg: %s\n" "$quoted_arg" | printf "quoted_arg: %s\n" "$quoted_arg" | ||||
@@ -81,37 +78,37 @@ for arg in "$@" ; do | |||||
done | done | ||||
# Source/default ant configuration | # Source/default ant configuration | ||||
if $no_config ; then | |||||
if $no_config; then | |||||
rpm_mode=false | rpm_mode=false | ||||
usejikes=$use_jikes_default | usejikes=$use_jikes_default | ||||
else | else | ||||
# load system-wide ant configuration (ONLY if ANT_HOME has NOT been set) | # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set) | ||||
if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then | if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then | ||||
if [ -f "/etc/ant.conf" ] ; then | |||||
if [ -f "/etc/ant.conf" ]; then | |||||
. /etc/ant.conf | . /etc/ant.conf | ||||
fi | fi | ||||
fi | fi | ||||
# load user ant configuration | # load user ant configuration | ||||
if [ -f "$HOME/.ant/ant.conf" ] ; then | |||||
if [ -f "$HOME/.ant/ant.conf" ]; then | |||||
. $HOME/.ant/ant.conf | . $HOME/.ant/ant.conf | ||||
fi | fi | ||||
if [ -f "$HOME/.antrc" ] ; then | |||||
if [ -f "$HOME/.antrc" ]; then | |||||
. "$HOME/.antrc" | . "$HOME/.antrc" | ||||
fi | fi | ||||
# provide default configuration values | # provide default configuration values | ||||
if [ -z "$rpm_mode" ] ; then | |||||
if [ -z "$rpm_mode" ]; then | |||||
rpm_mode=false | rpm_mode=false | ||||
fi | fi | ||||
if [ -z "$usejikes" ] ; then | |||||
if [ -z "$usejikes" ]; then | |||||
usejikes=$use_jikes_default | usejikes=$use_jikes_default | ||||
fi | fi | ||||
fi | fi | ||||
# Setup Java environment in rpm mode | # Setup Java environment in rpm mode | ||||
if $rpm_mode ; then | |||||
if [ -f /usr/share/java-utils/java-functions ] ; then | |||||
if $rpm_mode; then | |||||
if [ -f /usr/share/java-utils/java-functions ]; then | |||||
. /usr/share/java-utils/java-functions | . /usr/share/java-utils/java-functions | ||||
set_jvm | set_jvm | ||||
set_javacmd | set_javacmd | ||||
@@ -123,32 +120,37 @@ cygwin=false; | |||||
darwin=false; | darwin=false; | ||||
mingw=false; | mingw=false; | ||||
case "`uname`" in | case "`uname`" in | ||||
CYGWIN*) cygwin=true ;; | |||||
Darwin*) darwin=true | |||||
if [ -z "$JAVA_HOME" ] ; then | |||||
if [ -x '/usr/libexec/java_home' ] ; then | |||||
JAVA_HOME=`/usr/libexec/java_home` | |||||
elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then | |||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home | |||||
fi | |||||
fi | |||||
;; | |||||
MINGW*) mingw=true ;; | |||||
CYGWIN*) | |||||
cygwin=true | |||||
;; | |||||
Darwin*) | |||||
darwin=true | |||||
if [ -z "$JAVA_HOME" ]; then | |||||
if [ -x '/usr/libexec/java_home' ]; then | |||||
JAVA_HOME=`/usr/libexec/java_home` | |||||
elif [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home" ]; then | |||||
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home | |||||
fi | |||||
fi | |||||
;; | |||||
MINGW*) | |||||
mingw=true | |||||
;; | |||||
esac | esac | ||||
if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then | |||||
if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ]; then | |||||
## resolve links - $0 may be a link to ant's home | ## resolve links - $0 may be a link to ant's home | ||||
PRG="$0" | PRG="$0" | ||||
progname=`basename "$0"` | progname=`basename "$0"` | ||||
# need this for relative symlinks | # need this for relative symlinks | ||||
while [ -h "$PRG" ] ; do | |||||
while [ -h "$PRG" ]; do | |||||
ls=`ls -ld "$PRG"` | ls=`ls -ld "$PRG"` | ||||
link=`expr "$ls" : '.*-> \(.*\)$'` | link=`expr "$ls" : '.*-> \(.*\)$'` | ||||
if expr "$link" : '/.*' > /dev/null; then | if expr "$link" : '/.*' > /dev/null; then | ||||
PRG="$link" | |||||
PRG="$link" | |||||
else | else | ||||
PRG=`dirname "$PRG"`"/$link" | |||||
PRG=`dirname "$PRG"`"/$link" | |||||
fi | fi | ||||
done | done | ||||
@@ -160,41 +162,37 @@ fi | |||||
# For Cygwin and Mingw, ensure paths are in UNIX format before | # For Cygwin and Mingw, ensure paths are in UNIX format before | ||||
# anything is touched | # anything is touched | ||||
if $cygwin ; then | |||||
[ -n "$ANT_HOME" ] && | |||||
ANT_HOME=`cygpath --unix "$ANT_HOME"` | |||||
[ -n "$JAVA_HOME" ] && | |||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | |||||
if $cygwin; then | |||||
[ -n "$ANT_HOME" ] && ANT_HOME=`cygpath --unix "$ANT_HOME"` | |||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | |||||
fi | fi | ||||
if $mingw ; then | |||||
[ -n "$ANT_HOME" ] && | |||||
ANT_HOME="`(cd "$ANT_HOME"; pwd)`" | |||||
[ -n "$JAVA_HOME" ] && | |||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" | |||||
if $mingw; then | |||||
[ -n "$ANT_HOME" ] && ANT_HOME="`(cd "$ANT_HOME"; pwd)`" | |||||
[ -n "$JAVA_HOME" ] && JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" | |||||
fi | fi | ||||
# set ANT_LIB location | # set ANT_LIB location | ||||
ANT_LIB="${ANT_HOME}/lib" | ANT_LIB="${ANT_HOME}/lib" | ||||
if [ -z "$JAVACMD" ] ; then | |||||
if [ -n "$JAVA_HOME" ] ; then | |||||
if [ -z "$JAVACMD" ]; then | |||||
if [ -n "$JAVA_HOME" ]; then | |||||
# IBM's JDK on AIX uses strange locations for the executables | # IBM's JDK on AIX uses strange locations for the executables | ||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | |||||
if [ -x "$JAVA_HOME/jre/sh/java" ]; then | |||||
JAVACMD="$JAVA_HOME/jre/sh/java" | JAVACMD="$JAVA_HOME/jre/sh/java" | ||||
elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then | |||||
elif [ -x "$JAVA_HOME/jre/bin/java" ]; then | |||||
JAVACMD="$JAVA_HOME/jre/bin/java" | JAVACMD="$JAVA_HOME/jre/bin/java" | ||||
else | else | ||||
JAVACMD="$JAVA_HOME/bin/java" | JAVACMD="$JAVA_HOME/bin/java" | ||||
fi | fi | ||||
else | else | ||||
JAVACMD=`which java 2> /dev/null ` | JAVACMD=`which java 2> /dev/null ` | ||||
if [ -z "$JAVACMD" ] ; then | |||||
if [ -z "$JAVACMD" ]; then | |||||
JAVACMD=java | JAVACMD=java | ||||
fi | fi | ||||
fi | fi | ||||
fi | fi | ||||
if [ ! -x "$JAVACMD" ] ; then | |||||
if [ ! -x "$JAVACMD" ]; then | |||||
echo "Error: JAVA_HOME is not defined correctly." | echo "Error: JAVA_HOME is not defined correctly." | ||||
echo " We cannot execute $JAVACMD" | echo " We cannot execute $JAVACMD" | ||||
exit 1 | exit 1 | ||||
@@ -207,41 +205,40 @@ fi | |||||
# is discouraged as it is not java-version safe. A user should | # is discouraged as it is not java-version safe. A user should | ||||
# request optional jars and their dependencies via the OPT_JAR_LIST | # request optional jars and their dependencies via the OPT_JAR_LIST | ||||
# variable | # variable | ||||
if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then | |||||
if $rpm_mode && [ -x /usr/bin/build-classpath ]; then | |||||
LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)" | LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)" | ||||
# If no optional jars have been specified then build the default list | # If no optional jars have been specified then build the default list | ||||
if [ -z "$OPT_JAR_LIST" ] ; then | |||||
if [ -z "$OPT_JAR_LIST" ]; then | |||||
for file in /etc/ant.d/*; do | for file in /etc/ant.d/*; do | ||||
if [ -f "$file" ]; then | if [ -f "$file" ]; then | ||||
case "$file" in | case "$file" in | ||||
*~) ;; | |||||
*#*) ;; | |||||
*.rpmsave) ;; | |||||
*.rpmnew) ;; | |||||
*) | |||||
for dep in `cat "$file"`; do | |||||
OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep" | |||||
done | |||||
*~|*#*|*.rpmsave|*.rpmnew) | |||||
;; | |||||
*) | |||||
for dep in `cat "$file"`; do | |||||
OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep" | |||||
done | |||||
;; | |||||
esac | esac | ||||
fi | fi | ||||
done | done | ||||
fi | fi | ||||
# If the user requested to try to add some other jars to the classpath | # If the user requested to try to add some other jars to the classpath | ||||
if [ -n "$OPT_JAR_LIST" ] ; then | |||||
if [ -n "$OPT_JAR_LIST" ]; then | |||||
_OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)" | _OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)" | ||||
if [ -n "$_OPTCLASSPATH" ] ; then | |||||
if [ -n "$_OPTCLASSPATH" ]; then | |||||
LOCALCLASSPATH="$LOCALCLASSPATH:$_OPTCLASSPATH" | LOCALCLASSPATH="$LOCALCLASSPATH:$_OPTCLASSPATH" | ||||
fi | fi | ||||
fi | fi | ||||
# Explicitly add javac path to classpath, assume JAVA_HOME set | # Explicitly add javac path to classpath, assume JAVA_HOME set | ||||
# properly in rpm mode | # properly in rpm mode | ||||
if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then | |||||
if [ -f "$JAVA_HOME/lib/tools.jar" ]; then | |||||
LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar" | LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar" | ||||
fi | fi | ||||
if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then | |||||
if [ -f "$JAVA_HOME/lib/classes.zip" ]; then | |||||
LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip" | LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip" | ||||
fi | fi | ||||
@@ -251,11 +248,11 @@ if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then | |||||
# | # | ||||
# if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour | # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour | ||||
# with ant-found jars first and user CLASSPATH after | # with ant-found jars first and user CLASSPATH after | ||||
if [ -n "$CLASSPATH" ] ; then | |||||
# merge local and specified classpath | |||||
if [ -z "$LOCALCLASSPATH" ] ; then | |||||
if [ -n "$CLASSPATH" ]; then | |||||
# merge local and specified classpath | |||||
if [ -z "$LOCALCLASSPATH" ]; then | |||||
LOCALCLASSPATH="$CLASSPATH" | LOCALCLASSPATH="$CLASSPATH" | ||||
elif [ -n "$CLASSPATH_OVERRIDE" ] ; then | |||||
elif [ -n "$CLASSPATH_OVERRIDE" ]; then | |||||
LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH" | LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH" | ||||
else | else | ||||
LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH" | LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH" | ||||
@@ -266,20 +263,19 @@ if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then | |||||
fi | fi | ||||
else | else | ||||
# not using rpm_mode; use launcher to determine classpaths | # not using rpm_mode; use launcher to determine classpaths | ||||
if [ -z "$LOCALCLASSPATH" ] ; then | |||||
if [ -z "$LOCALCLASSPATH" ]; then | |||||
LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar | LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar | ||||
else | else | ||||
LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH | LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH | ||||
fi | fi | ||||
fi | fi | ||||
if [ -n "$JAVA_HOME" ] ; then | |||||
if [ -n "$JAVA_HOME" ]; then | |||||
# OSX hack to make Ant work with jikes | # OSX hack to make Ant work with jikes | ||||
if $darwin ; then | |||||
if $darwin; then | |||||
OSXHACK="${JAVA_HOME}/../Classes" | OSXHACK="${JAVA_HOME}/../Classes" | ||||
if [ -d "${OSXHACK}" ] ; then | |||||
for i in "${OSXHACK}"/*.jar | |||||
do | |||||
if [ -d "${OSXHACK}" ]; then | |||||
for i in "${OSXHACK}"/*.jar; do | |||||
JIKESPATH="$JIKESPATH:$i" | JIKESPATH="$JIKESPATH:$i" | ||||
done | done | ||||
fi | fi | ||||
@@ -297,7 +293,7 @@ fi | |||||
# in the name in the path. Let's assume that paths containing ; are more | # in the name in the path. Let's assume that paths containing ; are more | ||||
# rare than windows style paths on cygwin. | # rare than windows style paths on cygwin. | ||||
if $cygwin; then | if $cygwin; then | ||||
if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then | |||||
if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null; then | |||||
format=mixed | format=mixed | ||||
else | else | ||||
format=windows | format=windows | ||||
@@ -307,7 +303,7 @@ if $cygwin; then | |||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --$format "$JAVA_HOME"` | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --$format "$JAVA_HOME"` | ||||
LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"` | LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"` | ||||
LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"` | LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"` | ||||
if [ -n "$CLASSPATH" ] ; then | |||||
if [ -n "$CLASSPATH" ]; then | |||||
CP_TEMP=`cygpath --path --unix "$CLASSPATH"` | CP_TEMP=`cygpath --path --unix "$CLASSPATH"` | ||||
CLASSPATH=`cygpath --path --$format "$CP_TEMP"` | CLASSPATH=`cygpath --path --$format "$CP_TEMP"` | ||||
fi | fi | ||||
@@ -315,7 +311,7 @@ if $cygwin; then | |||||
fi | fi | ||||
# Show script help if requested | # Show script help if requested | ||||
if $show_help ; then | |||||
if $show_help; then | |||||
echo $0 '[script options] [options] [target [target2 [target3] ..]]' | echo $0 '[script options] [options] [target [target2 [target3] ..]]' | ||||
echo 'Script Options:' | echo 'Script Options:' | ||||
echo ' --help, --h print this message and ant help' | echo ' --help, --h print this message and ant help' | ||||
@@ -326,33 +322,33 @@ if $show_help ; then | |||||
echo ' set explicitly in configuration files' | echo ' set explicitly in configuration files' | ||||
echo ' --execdebug print ant exec line generated by this' | echo ' --execdebug print ant exec line generated by this' | ||||
echo ' launch script' | echo ' launch script' | ||||
echo ' ' | |||||
echo '' | |||||
fi | fi | ||||
# add a second backslash to variables terminated by a backslash under cygwin | # add a second backslash to variables terminated by a backslash under cygwin | ||||
if $cygwin; then | if $cygwin; then | ||||
case "$ANT_HOME" in | case "$ANT_HOME" in | ||||
*\\ ) | *\\ ) | ||||
ANT_HOME="$ANT_HOME\\" | |||||
ANT_HOME="$ANT_HOME\\" | |||||
;; | ;; | ||||
esac | esac | ||||
case "$CYGHOME" in | case "$CYGHOME" in | ||||
*\\ ) | *\\ ) | ||||
CYGHOME="$CYGHOME\\" | |||||
CYGHOME="$CYGHOME\\" | |||||
;; | ;; | ||||
esac | esac | ||||
case "$JIKESPATH" in | case "$JIKESPATH" in | ||||
*\\ ) | *\\ ) | ||||
JIKESPATH="$JIKESPATH\\" | |||||
JIKESPATH="$JIKESPATH\\" | |||||
;; | ;; | ||||
esac | esac | ||||
case "$LOCALCLASSPATH" in | case "$LOCALCLASSPATH" in | ||||
*\\ ) | *\\ ) | ||||
LOCALCLASSPATH="$LOCALCLASSPATH\\" | |||||
LOCALCLASSPATH="$LOCALCLASSPATH\\" | |||||
;; | ;; | ||||
esac | esac | ||||
case "$CLASSPATH" in | case "$CLASSPATH" in | ||||
*\\ ) | *\\ ) | ||||
CLASSPATH="$CLASSPATH\\" | |||||
CLASSPATH="$CLASSPATH\\" | |||||
;; | ;; | ||||
esac | esac | ||||
fi | fi | ||||
@@ -371,7 +367,7 @@ else | |||||
fi | fi | ||||
fi | fi | ||||
ant_exec_command="exec \"\$JAVACMD\" $ANT_OPTS -classpath \"\$LOCALCLASSPATH\" -Dant.home=\"\$ANT_HOME\" -Dant.library.dir=\"\$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"\$CLASSPATH\"" | ant_exec_command="exec \"\$JAVACMD\" $ANT_OPTS -classpath \"\$LOCALCLASSPATH\" -Dant.home=\"\$ANT_HOME\" -Dant.library.dir=\"\$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"\$CLASSPATH\"" | ||||
if $ant_exec_debug ; then | |||||
if $ant_exec_debug; then | |||||
# using printf to avoid echo line continuation and escape interpretation confusion | # using printf to avoid echo line continuation and escape interpretation confusion | ||||
printf "%s\n" "$ant_exec_command $ant_exec_args" | printf "%s\n" "$ant_exec_command $ant_exec_args" | ||||
fi | fi | ||||
@@ -6,9 +6,9 @@ REM this work for additional information regarding copyright ownership. | |||||
REM The ASF licenses this file to You under the Apache License, Version 2.0 | REM The ASF licenses this file to You under the Apache License, Version 2.0 | ||||
REM (the "License"); you may not use this file except in compliance with | REM (the "License"); you may not use this file except in compliance with | ||||
REM the License. You may obtain a copy of the License at | REM the License. You may obtain a copy of the License at | ||||
REM | |||||
REM | |||||
REM http://www.apache.org/licenses/LICENSE-2.0 | REM http://www.apache.org/licenses/LICENSE-2.0 | ||||
REM | |||||
REM | |||||
REM Unless required by applicable law or agreed to in writing, software | REM Unless required by applicable law or agreed to in writing, software | ||||
REM distributed under the License is distributed on an "AS IS" BASIS, | REM distributed under the License is distributed on an "AS IS" BASIS, | ||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
@@ -1,4 +1,4 @@ | |||||
/* | |||||
/* | |||||
Licensed to the Apache Software Foundation (ASF) under one or more | Licensed to the Apache Software Foundation (ASF) under one or more | ||||
contributor license agreements. See the NOTICE file distributed with | contributor license agreements. See the NOTICE file distributed with | ||||
this work for additional information regarding copyright ownership. | this work for additional information regarding copyright ownership. | ||||
@@ -13,7 +13,7 @@ | |||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
See the License for the specific language governing permissions and | See the License for the specific language governing permissions and | ||||
limitations under the License. | limitations under the License. | ||||
Run ant | Run ant | ||||
*/ | */ | ||||
@@ -6,9 +6,9 @@ REM this work for additional information regarding copyright ownership. | |||||
REM The ASF licenses this file to You under the Apache License, Version 2.0 | REM The ASF licenses this file to You under the Apache License, Version 2.0 | ||||
REM (the "License"); you may not use this file except in compliance with | REM (the "License"); you may not use this file except in compliance with | ||||
REM the License. You may obtain a copy of the License at | REM the License. You may obtain a copy of the License at | ||||
REM | |||||
REM | |||||
REM http://www.apache.org/licenses/LICENSE-2.0 | REM http://www.apache.org/licenses/LICENSE-2.0 | ||||
REM | |||||
REM | |||||
REM Unless required by applicable law or agreed to in writing, software | REM Unless required by applicable law or agreed to in writing, software | ||||
REM distributed under the License is distributed on an "AS IS" BASIS, | REM distributed under the License is distributed on an "AS IS" BASIS, | ||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
@@ -47,4 +47,3 @@ rem echo %ANT_RUN_CMD% | |||||
if "%OS%"=="Windows_NT" @endlocal | if "%OS%"=="Windows_NT" @endlocal | ||||
if "%OS%"=="WINNT" @endlocal | if "%OS%"=="WINNT" @endlocal | ||||
@@ -20,7 +20,7 @@ | |||||
# antRun.pl | # antRun.pl | ||||
# | # | ||||
# wrapper script for invoking commands on a platform with Perl installed | # wrapper script for invoking commands on a platform with Perl installed | ||||
# this is akin to antRun.bat, and antRun the SH script | |||||
# this is akin to antRun.bat, and antRun the SH script | |||||
####################################################################### | ####################################################################### | ||||
#be fussy about variables | #be fussy about variables | ||||
use strict; | use strict; | ||||
@@ -29,21 +29,20 @@ use strict; | |||||
#use warnings; | #use warnings; | ||||
#and set $debug to 1 to turn on trace info (currently unused) | #and set $debug to 1 to turn on trace info (currently unused) | ||||
my $debug=1; | |||||
my $debug = 1; | |||||
####################################################################### | ####################################################################### | ||||
# change drive and directory to "%1" | # change drive and directory to "%1" | ||||
my $ANT_RUN_CMD = @ARGV[0]; | my $ANT_RUN_CMD = @ARGV[0]; | ||||
# assign current run command to "%2" | # assign current run command to "%2" | ||||
chdir (@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n"; | |||||
chdir(@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n"; | |||||
if ($^O eq "NetWare") { | if ($^O eq "NetWare") { | ||||
# There is a bug in Perl 5 on NetWare, where chdir does not | # There is a bug in Perl 5 on NetWare, where chdir does not | ||||
# do anything. On NetWare, the following path-prefixed form should | |||||
# do anything. On NetWare, the following path-prefixed form should | |||||
# always work. (afaict) | # always work. (afaict) | ||||
$ANT_RUN_CMD .= "/".@ARGV[1]; | |||||
} | |||||
else { | |||||
$ANT_RUN_CMD .= "/" . @ARGV[1]; | |||||
} else { | |||||
$ANT_RUN_CMD = @ARGV[1]; | $ANT_RUN_CMD = @ARGV[1]; | ||||
} | } | ||||
@@ -55,8 +54,7 @@ shift; | |||||
my $returnValue = system $ANT_RUN_CMD, @ARGV; | my $returnValue = system $ANT_RUN_CMD, @ARGV; | ||||
if ($returnValue eq 0) { | if ($returnValue eq 0) { | ||||
exit 0; | exit 0; | ||||
} | |||||
else { | |||||
} else { | |||||
# only 0 and 1 are widely recognized as exit values | # only 0 and 1 are widely recognized as exit values | ||||
# so change the exit value to 1 | # so change the exit value to 1 | ||||
exit 1; | exit 1; | ||||
@@ -1,4 +1,4 @@ | |||||
/* | |||||
/* | |||||
Licensed to the Apache Software Foundation (ASF) under one or more | Licensed to the Apache Software Foundation (ASF) under one or more | ||||
contributor license agreements. See the NOTICE file distributed with | contributor license agreements. See the NOTICE file distributed with | ||||
this work for additional information regarding copyright ownership. | this work for additional information regarding copyright ownership. | ||||
@@ -15,10 +15,10 @@ | |||||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | ||||
# limitations under the License. | # limitations under the License. | ||||
# | # | ||||
# A script to allow Bash or Z-Shell to complete an Ant command-line. | |||||
# A script to allow Bash or Z-Shell to complete an Ant command-line. | |||||
# | # | ||||
# To install for Bash 2.0 or better, add the following to ~/.bashrc: | # To install for Bash 2.0 or better, add the following to ~/.bashrc: | ||||
# | |||||
# | |||||
# complete -C complete-ant-cmd.pl ant build.sh | # complete -C complete-ant-cmd.pl ant build.sh | ||||
# | # | ||||
# To install for Z-Shell 2.5 or better, add the following to ~/.zshrc: | # To install for Z-Shell 2.5 or better, add the following to ~/.zshrc: | ||||
@@ -37,11 +37,11 @@ my $word = $ARGV[1]; | |||||
my @completions; | my @completions; | ||||
if ($word =~ /^-/) { | if ($word =~ /^-/) { | ||||
list( restrict( $word, getArguments() )); | |||||
list(restrict($word, getArguments())); | |||||
} elsif ($cmdLine =~ /-(f|file|buildfile)\s+\S*$/) { | } elsif ($cmdLine =~ /-(f|file|buildfile)\s+\S*$/) { | ||||
list( getBuildFiles($word) ); | |||||
list(getBuildFiles($word)); | |||||
} else { | } else { | ||||
list( restrict( $word, getTargets() )); | |||||
list(restrict($word, getTargets())); | |||||
} | } | ||||
exit(0); | exit(0); | ||||
@@ -54,18 +54,18 @@ sub list { | |||||
sub restrict { | sub restrict { | ||||
my ($word, @completions) = @_; | my ($word, @completions) = @_; | ||||
grep( /^\Q$word\E/, @completions ); | |||||
grep(/^\Q$word\E/, @completions); | |||||
} | } | ||||
sub getArguments { | sub getArguments { | ||||
qw(-buildfile -debug -emacs -f -file -find -help -listener -logfile | |||||
-logger -projecthelp -quiet -verbose -version); | |||||
qw(-buildfile -debug -emacs -f -file -find -help -listener -logfile | |||||
-logger -projecthelp -quiet -verbose -version); | |||||
} | } | ||||
sub getBuildFiles { | sub getBuildFiles { | ||||
my ($word) = @_; | my ($word) = @_; | ||||
grep( /\.xml$/, glob( "$word*" )); | |||||
grep(/\.xml$/, glob("$word*")); | |||||
} | } | ||||
sub getTargets { | sub getTargets { | ||||
@@ -83,10 +83,10 @@ sub getTargets { | |||||
my $cacheFile = $buildFile; | my $cacheFile = $buildFile; | ||||
$cacheFile =~ s|(.*/)?(.*)|${1}.ant-targets-${2}|; | $cacheFile =~ s|(.*/)?(.*)|${1}.ant-targets-${2}|; | ||||
if ((!-e $cacheFile) || (-z $cacheFile) || (-M $buildFile) < (-M $cacheFile)) { | if ((!-e $cacheFile) || (-z $cacheFile) || (-M $buildFile) < (-M $cacheFile)) { | ||||
open( CACHE, '>'.$cacheFile ) || die "can\'t write $cacheFile: $!\n"; | |||||
open( HELP, "$antCmd -projecthelp -debug -buildfile '$buildFile'|" ) || return(); | |||||
open(CACHE, '>'.$cacheFile) || die "can\'t write $cacheFile: $!\n"; | |||||
open(HELP, "$antCmd -projecthelp -debug -buildfile '$buildFile'|") || return(); | |||||
my %targets; | my %targets; | ||||
while( <HELP> ) { | |||||
while (<HELP>) { | |||||
# Exclude target names starting with dash, because they cannot be | # Exclude target names starting with dash, because they cannot be | ||||
# specified on the command line. | # specified on the command line. | ||||
if (/^\s+\+Target:\s+(?!-)(\S+)/) { | if (/^\s+\+Target:\s+(?!-)(\S+)/) { | ||||
@@ -94,22 +94,21 @@ sub getTargets { | |||||
} | } | ||||
} | } | ||||
my @targets = sort keys %targets; | my @targets = sort keys %targets; | ||||
for (@targets) { print CACHE "$_\n"; } | |||||
for (@targets) { | |||||
print CACHE "$_\n"; | |||||
} | |||||
return @targets; | return @targets; | ||||
} | } | ||||
# Read the target-cache | # Read the target-cache | ||||
open( CACHE, $cacheFile ) || die "can\'t read $cacheFile: $!\n"; | |||||
open(CACHE, $cacheFile) || die "can\'t read $cacheFile: $!\n"; | |||||
my @targets; | my @targets; | ||||
while (<CACHE>) { | while (<CACHE>) { | ||||
chop; | chop; | ||||
s/\r$//; # for Cygwin | s/\r$//; # for Cygwin | ||||
push( @targets, $_ ); | |||||
push(@targets, $_); | |||||
} | } | ||||
close( CACHE ); | |||||
close(CACHE); | |||||
@targets; | @targets; | ||||
} | } | ||||
@@ -5,9 +5,9 @@ REM this work for additional information regarding copyright ownership. | |||||
REM The ASF licenses this file to You under the Apache License, Version 2.0 | REM The ASF licenses this file to You under the Apache License, Version 2.0 | ||||
REM (the "License"); you may not use this file except in compliance with | REM (the "License"); you may not use this file except in compliance with | ||||
REM the License. You may obtain a copy of the License at | REM the License. You may obtain a copy of the License at | ||||
REM | |||||
REM | |||||
REM http://www.apache.org/licenses/LICENSE-2.0 | REM http://www.apache.org/licenses/LICENSE-2.0 | ||||
REM | |||||
REM | |||||
REM Unless required by applicable law or agreed to in writing, software | REM Unless required by applicable law or agreed to in writing, software | ||||
REM distributed under the License is distributed on an "AS IS" BASIS, | REM distributed under the License is distributed on an "AS IS" BASIS, | ||||
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
@@ -28,4 +28,3 @@ goto argCheck | |||||
:gotAllArgs | :gotAllArgs | ||||
set LOCALCLASSPATH=%LOCALCLASSPATH%;%_CLASSPATHCOMPONENT% | set LOCALCLASSPATH=%LOCALCLASSPATH%;%_CLASSPATHCOMPONENT% | ||||
@@ -27,7 +27,7 @@ | |||||
# the code is not totally portable due to classpath and directory splitting | # the code is not totally portable due to classpath and directory splitting | ||||
# issues. oops. (NB, use File::Spec::Functions will help and the code is | # issues. oops. (NB, use File::Spec::Functions will help and the code is | ||||
# structured for the catfile() call, but because of perl version funnies | # structured for the catfile() call, but because of perl version funnies | ||||
# the code is not included. | |||||
# the code is not included. | |||||
####################################################################### | ####################################################################### | ||||
# | # | ||||
# Assumptions: | # Assumptions: | ||||
@@ -47,7 +47,7 @@ use strict; | |||||
#use warnings; | #use warnings; | ||||
#and set $debug to 1 to turn on trace info | #and set $debug to 1 to turn on trace info | ||||
my $debug=1; | |||||
my $debug = 1; | |||||
####################################################################### | ####################################################################### | ||||
# | # | ||||
@@ -55,43 +55,34 @@ my $debug=1; | |||||
# | # | ||||
my $HOME = $ENV{ANT_HOME}; | my $HOME = $ENV{ANT_HOME}; | ||||
if ($HOME eq "") | |||||
{ | |||||
if (!$HOME) { | |||||
die "\n\nANT_HOME *MUST* be set!\n\n"; | die "\n\nANT_HOME *MUST* be set!\n\n"; | ||||
} | |||||
} | |||||
my $JAVACMD = $ENV{JAVACMD}; | |||||
$JAVACMD = "java" if $JAVACMD eq ""; | |||||
my $JAVACMD = $ENV{JAVACMD} || "java"; | |||||
my $onnetware = 0; | |||||
if ($^O eq "NetWare") | |||||
{ | |||||
$onnetware = 1; | |||||
} | |||||
my $onnetware = ($^O eq "NetWare"); | |||||
my $oncygwin = ($^O eq "cygwin"); | my $oncygwin = ($^O eq "cygwin"); | ||||
#ISSUE: what java wants to split up classpath varies from platform to platform | |||||
#ISSUE: what java wants to split up classpath varies from platform to platform | |||||
#and perl is not too hot at hinting which box it is on. | #and perl is not too hot at hinting which box it is on. | ||||
#here I assume ":" 'cept on win32, dos, and netware. Add extra tests here as needed. | #here I assume ":" 'cept on win32, dos, and netware. Add extra tests here as needed. | ||||
my $s=":"; | |||||
if(($^O eq "MSWin32") || ($^O eq "dos") || ($^O eq "cygwin") || | |||||
($onnetware == 1)) | |||||
{ | |||||
$s=";"; | |||||
} | |||||
my $s = ":"; | |||||
if (($^O eq "MSWin32") || ($^O eq "dos") || $oncygwin || $onnetware) { | |||||
$s=";"; | |||||
} | |||||
#build up standard classpath | #build up standard classpath | ||||
my $localpath = "$HOME/lib/ant-launcher.jar"; | my $localpath = "$HOME/lib/ant-launcher.jar"; | ||||
#set JVM options and Ant arguments, if any | #set JVM options and Ant arguments, if any | ||||
my @ANT_OPTS=split(" ", $ENV{ANT_OPTS}); | |||||
my @ANT_ARGS=split(" ", $ENV{ANT_ARGS}); | |||||
my @ANT_OPTS = split(" ", $ENV{ANT_OPTS}); | |||||
my @ANT_ARGS = split(" ", $ENV{ANT_ARGS}); | |||||
#jikes | #jikes | ||||
if($ENV{JIKESPATH} ne "") | |||||
{ | |||||
push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}"; | |||||
} | |||||
if ($ENV{JIKESPATH}) { | |||||
push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}"; | |||||
} | |||||
#construct arguments to java | #construct arguments to java | ||||
my @ARGS; | my @ARGS; | ||||
@@ -99,52 +90,43 @@ push @ARGS, @ANT_OPTS; | |||||
my $CYGHOME = ""; | my $CYGHOME = ""; | ||||
my $classpath=$ENV{CLASSPATH}; | |||||
if ($oncygwin == 1) { | |||||
$localpath = `cygpath --path --windows $localpath`; | |||||
chomp ($localpath); | |||||
if (! $classpath eq "") | |||||
{ | |||||
$classpath = `cygpath --path --windows "$classpath"`; | |||||
chomp ($classpath); | |||||
} | |||||
$HOME = `cygpath --path --windows $HOME`; | |||||
chomp ($HOME); | |||||
$CYGHOME = `cygpath --path --windows $ENV{HOME}`; | |||||
chomp ($CYGHOME); | |||||
my $classpath = $ENV{CLASSPATH}; | |||||
if ($oncygwin) { | |||||
$localpath = `cygpath --path --windows $localpath`; | |||||
chomp ($localpath); | |||||
if ($classpath) { | |||||
$classpath = `cygpath --path --windows "$classpath"`; | |||||
chomp ($classpath); | |||||
} | |||||
$HOME = `cygpath --path --windows $HOME`; | |||||
chomp ($HOME); | |||||
$CYGHOME = `cygpath --path --windows $ENV{HOME}`; | |||||
chomp ($CYGHOME); | |||||
} | } | ||||
push @ARGS, "-classpath", "$localpath"; | push @ARGS, "-classpath", "$localpath"; | ||||
push @ARGS, "-Dant.home=$HOME"; | push @ARGS, "-Dant.home=$HOME"; | ||||
if ( ! $CYGHOME eq "" ) | |||||
{ | |||||
push @ARGS, "-Dcygwin.user.home=\"$CYGHOME\"" | |||||
if ($CYGHOME) { | |||||
push @ARGS, "-Dcygwin.user.home=\"$CYGHOME\"" | |||||
} | } | ||||
push @ARGS, "org.apache.tools.ant.launch.Launcher", @ANT_ARGS; | push @ARGS, "org.apache.tools.ant.launch.Launcher", @ANT_ARGS; | ||||
push @ARGS, @ARGV; | push @ARGS, @ARGV; | ||||
if (! $classpath eq "") | |||||
{ | |||||
if ($onnetware == 1) | |||||
{ | |||||
# make classpath literally $CLASSPATH | |||||
# this is to avoid pushing us over the 512 character limit | |||||
# even skip the ; - that is already in $localpath | |||||
push @ARGS, "-lib", "\$CLASSPATH"; | |||||
} | |||||
else | |||||
{ | |||||
push @ARGS, "-lib", "$classpath"; | |||||
} | |||||
if ($classpath) { | |||||
if ($onnetware) { | |||||
# make classpath literally $CLASSPATH | |||||
# this is to avoid pushing us over the 512 character limit | |||||
# even skip the ; - that is already in $localpath | |||||
push @ARGS, "-lib", "\$CLASSPATH"; | |||||
} else { | |||||
push @ARGS, "-lib", "$classpath"; | |||||
} | |||||
} | } | ||||
print "\n $JAVACMD @ARGS\n\n" if ($debug); | print "\n $JAVACMD @ARGS\n\n" if ($debug); | ||||
my $returnValue = system $JAVACMD, @ARGS; | my $returnValue = system $JAVACMD, @ARGS; | ||||
if ($returnValue eq 0) | |||||
{ | |||||
exit 0; | |||||
} | |||||
else | |||||
{ | |||||
# only 0 and 1 are widely recognized as exit values | |||||
# so change the exit value to 1 | |||||
exit 1; | |||||
} | |||||
if ($returnValue eq 0) { | |||||
exit 0; | |||||
} else { | |||||
# only 0 and 1 are widely recognized as exit values | |||||
# so change the exit value to 1 | |||||
exit 1; | |||||
} |
@@ -1,4 +1,4 @@ | |||||
/* | |||||
/* | |||||
Licensed to the Apache Software Foundation (ASF) under one or more | Licensed to the Apache Software Foundation (ASF) under one or more | ||||
contributor license agreements. See the NOTICE file distributed with | contributor license agreements. See the NOTICE file distributed with | ||||
this work for additional information regarding copyright ownership. | this work for additional information regarding copyright ownership. | ||||
@@ -15,7 +15,7 @@ | |||||
limitations under the License. | limitations under the License. | ||||
Run RC file, name is in the first arg, second arg is either PATH | Run RC file, name is in the first arg, second arg is either PATH | ||||
ENV or -r or nothing | |||||
ENV or -r or nothing | |||||
*/ | */ | ||||
parse arg name path rest | parse arg name path rest | ||||