From 9517bc1a98631093adc5af3f62a818b8b0f96f7e Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 29 Apr 2002 11:45:06 +0000 Subject: [PATCH] Help getting the wrapper scripts that ship with Ant's "normal" distributions and the RPMs closer to each other by (1) allowing a system wide configuration file in /etc and (2) using some environment variables to enable RPM specific behavior. Submitted by: Henri GOMEZ git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@272589 13f79535-47bb-0310-9956-ffa450edef68 --- src/script/ant | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/script/ant b/src/script/ant index 94d5a7bfc..449a82279 100644 --- a/src/script/ant +++ b/src/script/ant @@ -3,6 +3,20 @@ # Copyright (c) 2001-2002 The Apache Software Foundation. All rights # reserved. +# load system-wide ant configuration +if [ -f "/etc/ant.conf" ] ; then + . /etc/ant.conf +fi + +# provide default values for people who don't use RPMs +if [ -z "$rpm_mode" ] ; then + rpm_mode=false; +fi +if [ -z "$usejikes" ] ; then + usejikes=false; +fi + +# load user ant configuration if [ -f "$HOME/.antrc" ] ; then . $HOME/.antrc fi @@ -84,10 +98,22 @@ if [ -n "$CLASSPATH" ] ; then LOCALCLASSPATH="$CLASSPATH" fi -# add in the dependency .jar files -DIRLIBS="${ANT_HOME}"/lib -for i in "${DIRLIBS}"/*.jar -do +# in rpm_mode get ant/optional/xml parser&api from JAVALIBDIR +if $rpm_mode; then + JAVALIBDIR=/usr/share/java + for i in ant ant-optional jaxp_parser xml_apis + do + if [ -z "$LOCALCLASSPATH" ] ; then + LOCALCLASSPATH=$JAVALIBDIR/$i.jar + else + LOCALCLASSPATH="$i.jar":"$LOCALCLASSPATH" + fi + done +else + # add in the dependency .jar files in non-RPM mode (the default) + DIRLIBS="${ANT_HOME}"/lib + for i in "${DIRLIBS}"/*.jar + do # if the directory is empty, then it will return the input string # this is stupid, so case for it if [ "$i" != "${DIRLIBS}/*.jar" ] ; then @@ -97,7 +123,8 @@ do LOCALCLASSPATH="$i":"$LOCALCLASSPATH" fi fi -done + done +fi if [ -n "$JAVA_HOME" ] ; then if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then @@ -134,6 +161,11 @@ if [ -n "$JIKESPATH" ] ; then ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH" fi +# Allow Jikes support (off by default) +if $usejikes; then + ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes" +fi + # For Cygwin, switch paths to Windows format before running java if $cygwin; then ANT_HOME=`cygpath --path --windows "$ANT_HOME"`