Le mar 07/05/2002 à 12:26, Stefan Bodewig a écrit :
> On 06 May 2002, Nicolas Mailhot <Nicolas.Mailhot@laposte.net> wrote:
>
> > * moved user ant conf from ~/.antrc to ~/.ant/etc/ant.conf
>
> -1
>
> Add ~/.ant/etc/conf would be OK, but not completely replacing it.
> Backwards compatibility.
Ok, didn't new ~/.antrc was already in use. Will also source it then
>
> > * added $ANT-HOME/classes to ant classpath à la tomcat did
> > * the logical thing and added ~/.ant/classes and ~/.ant/lib
> > * to ant classpath.
>
> That's OK with me, but then ant.bat will certainly need the same
> magic. What dot the other committers think?
Well, if these folders don't exist they won't be used ; and if they do,
well that's certainly the right thing to do IMHO, I'm not changing
policy just coding some obvious extensions.
Anyway time for a new dump :
* re-started sourcing ~/.antrc
* changed test "rpmmode=true" to "standalone=false" since
jpackage rpms aim at a correct & standard setup, if someone
(like debian) thinks we abuse a standard we should fix the our
rpms and ant scripts, not introduce distro-specific hacks in
original jakarta ant scripts. Ideally standalone=false should
work for all standard packaged ants, be it rpms or debs (cc to
debian-java@lists.debian.org if they want to chime in)
Regards
--
Nicolas Mailhot
--- ant-1.5b1 2002-05-03 13:10:01.000000000 +0200
+++ ant.7 2002-05-07 12:58:00.000000000 +0200
@@ -4,52 +4,38 @@
# 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
-
+[ -r "/etc/ant.conf" ] && . "/etc/ant.conf"
# load user ant configuration
-if [ -f "$HOME/.antrc" ] ; then
- . $HOME/.antrc
-fi
+# Legacy one
+[ -r "$HOME/.antrc" ] && . "$HOME/.antrc"
+# New one
+[ -r "$HOME/.ant/etc/ant.conf" ] && . "$HOME/.ant/etc/ant.conf"
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
- Darwin*) darwin=true
- if [ -z "$JAVA_HOME" ] ; then
- JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
- fi
- ;;
+ Darwin*) darwin=true ;;
esac
+if [ "$standalone" = "false" ] ; then
+ [ -z "$ANT_HOME" ] && ANT_HOME="/usr/share/ant"
+ [ -z "$JAVA_FUNCTIONS" ] && JAVA_FUNCTIONS="/usr/bin/java-functions"
+fi
+
if [ -z "$ANT_HOME" ] ; then
# try to find ANT
- if [ -d /opt/ant ] ; then
- ANT_HOME=/opt/ant
- fi
-
- if [ -d ${HOME}/opt/ant ] ; then
- ANT_HOME=${HOME}/opt/ant
- fi
+ [ -d "/opt/ant" ] && ANT_HOME="/opt/ant"
+ [ -d "$HOME/opt/ant" ] && ANT_HOME="$HOME/opt/ant"
## resolve links - $0 may be a link to ant's home
PRG=$0
progname=`basename $0`
- saveddir=`pwd`
+ saveddir="`pwd`"
# need this for relative symlinks
- cd `dirname $PRG`
+ cd "`dirname $PRG`"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
@@ -61,120 +47,83 @@
fi
done
- ANT_HOME=`dirname "$PRG"`/..
+ ANT_HOME="`dirname '$PRG'`/.."
# make it fully qualified
ANT_HOME=`cd "$ANT_HOME" && pwd`
-
- cd $saveddir
+ cd "$saveddir"
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$ANT_HOME" ] &&
- ANT_HOME=`cygpath --unix "$ANT_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+if [ "$cygwin" = "true" ] ; then
+ [ -n "$ANT_HOME" ] && ANT_HOME=`cygpath --unix "$ANT_HOME"`
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD=java
- fi
+[ -z "$JAVA_FUNCTIONS" ] && $JAVA_FUNCTIONS="$ANT_HOME/bin/java-functions"
+
+if [ -r "$JAVA_FUNCTIONS" ] ; then
+ . "$JAVA_FUNCTIONS"
+ set_jvm
+ set_javacmd
+else
+ echo "No java functions found in $JAVA_FUNCTIONS, operating in dumb mode"
+ [ -z "$JAVA_HOME" ] && JAVA_HOME="/usr/lib/java"
+ [ -z "$JAVACMD" ] && JAVACMD="$JAVA_HOME/bin/java"
fi
-
+
if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly."
- echo " We cannot execute $JAVACMD"
+ echo "Error: we cannot execute $JAVACMD"
+ echo "Please set the JAVACMD environment variable to a correct value"
exit 1
fi
-if [ -n "$CLASSPATH" ] ; then
- LOCALCLASSPATH="$CLASSPATH"
+if [ ! -d "$JAVA_HOME" ] ; then
+ echo "Warning: $JAVA_HOME is not a directory"
+ echo "Please set the JAVA_HOME environment variable to a correct value"
fi
-# 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
- if [ -z "$LOCALCLASSPATH" ] ; then
- LOCALCLASSPATH=$i
- else
- LOCALCLASSPATH="$i":"$LOCALCLASSPATH"
- fi
- fi
- done
+unset LOCALCLASSPATH
+
+[ -f "$JAVA_HOME/lib/tools.jar" ] && LOCALCLASSPATH="$JAVA_HOME/lib/tools.jar:"
+[ -f "$JAVA_HOME/lib/classes.zip" ] && LOCALCLASSPATH="$JAVA_HOME/lib/classes.zip:"
+
+if [ "$darwin" = "true" -a "$usejikes" = "true" ] ; then
+ OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
+ JIKESJARS=`find "$OSXHACK" -name *.jar -maxdepth 1 -printf %p: 2>/dev/null`
+ [ -z "$JIKESPATH" ] && JIKESPATH="$JIKESJARS" || JIKESPATH="$JIKESPATH:$JIKESJARS"
fi
-if [ -n "$JAVA_HOME" ] ; then
- if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
- LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar"
- fi
-
- if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
- LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip"
- fi
-
- # OSX hack to make Ant work with jikes
- if $darwin ; then
- OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
- if [ -d ${OSXHACK} ] ; then
- for i in ${OSXHACK}/*.jar
- do
- JIKESPATH=$JIKESPATH:$i
- done
- fi
- fi
-else
- echo "Warning: JAVA_HOME environment variable is not set."
- echo " If build fails because sun.* classes could not be found"
- echo " you will need to set the JAVA_HOME environment variable"
- echo " to the installation directory of java."
+unset RPMCOREJARS
+
+if [ "$standalone" = "false" ] ; then
+ JAVALIBDIR="/usr/share/java"
+ JARS="ant ant-optional jaxp_parser xml_apis"
+ for jar in $JARS ; do RPMCOREJARS="$RPMCOREJARS$JAVALIBDIR/$jar.jar:" ; done
fi
+
+COREJARS=`find "$ANT_HOME/lib" -name *.jar -maxdepth 1 -printf %p: 2>/dev/null`
+
+LOCALCOREJARS=`find "$HOME/.ant/lib" -name *.jar -maxdepth 1 -printf %p: 2>/dev/null`
+
+LOCALCLASSPATH="$LOCALCLASSPATH$RPMCOREJARS$ANT_HOME/classes:$COREJARS$HOME/.ant/classes:$LOCALCOREJARS$CLASSPATH"
# supply JIKESPATH to Ant as jikes.class.path
if [ -n "$JIKESPATH" ] ; then
- if $cygwin ; then
- JIKESPATH=`cygpath --path --windows "$JIKESPATH"`
- fi
+ [ "$cygwin" = "true" ] && JIKESPATH=`cygpath --path --windows "$JIKESPATH"`
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
+[ "$usejikes" = "true" ] && ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes"
# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
+if [ "$cygwin" = "true" ]; then
ANT_HOME=`cygpath --path --windows "$ANT_HOME"`
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
fi
-"$JAVACMD" -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" $ANT_OPTS org.apache.tools.ant.Main $ANT_ARGS "$@"
+"$JAVACMD" -classpath "$LOCALCLASSPATH" -Dant.home="$ANT_HOME" $ANT_OPTS org.apache.tools.ant.Main $ANT_ARGS "$@"
--- ant.6 2002-05-06 11:46:00.000000000 +0200 +++ ant.7 2002-05-07 12:58:00.000000000 +0200 @@ -6,6 +6,9 @@ # load system-wide ant configuration [ -r "/etc/ant.conf" ] && . "/etc/ant.conf" # load user ant configuration +# Legacy one +[ -r "$HOME/.antrc" ] && . "$HOME/.antrc" +# New one [ -r "$HOME/.ant/etc/ant.conf" ] && . "$HOME/.ant/etc/ant.conf" # OS specific support. $var _must_ be set to either true or false. @@ -16,7 +19,7 @@ Darwin*) darwin=true ;; esac -if [ "$rpmmode" = "true" ] ; then +if [ "$standalone" = "false" ] ; then [ -z "$ANT_HOME" ] && ANT_HOME="/usr/share/ant" [ -z "$JAVA_FUNCTIONS" ] && JAVA_FUNCTIONS="/usr/bin/java-functions" fi @@ -94,7 +97,7 @@ unset RPMCOREJARS -if [ "$rpmmode" = "true" ] ; then +if [ "$standalone" = "false" ] ; then JAVALIBDIR="/usr/share/java" JARS="ant ant-optional jaxp_parser xml_apis" for jar in $JARS ; do RPMCOREJARS="$RPMCOREJARS$JAVALIBDIR/$jar.jar:" ; done
#! /bin/sh
# Copyright (c) 2001-2002 The Apache Software Foundation. All rights
# reserved.
# load system-wide ant configuration
[ -r "/etc/ant.conf" ] && . "/etc/ant.conf"
# load user ant configuration
# Legacy one
[ -r "$HOME/.antrc" ] && . "$HOME/.antrc"
# New one
[ -r "$HOME/.ant/etc/ant.conf" ] && . "$HOME/.ant/etc/ant.conf"
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
Darwin*) darwin=true ;;
esac
if [ "$standalone" = "false" ] ; then
[ -z "$ANT_HOME" ] && ANT_HOME="/usr/share/ant"
[ -z "$JAVA_FUNCTIONS" ] && JAVA_FUNCTIONS="/usr/bin/java-functions"
fi
if [ -z "$ANT_HOME" ] ; then
# try to find ANT
[ -d "/opt/ant" ] && ANT_HOME="/opt/ant"
[ -d "$HOME/opt/ant" ] && ANT_HOME="$HOME/opt/ant"
## resolve links - $0 may be a link to ant's home
PRG=$0
progname=`basename $0`
saveddir="`pwd`"
# need this for relative symlinks
cd "`dirname $PRG`"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname $PRG`/$link"
fi
done
ANT_HOME="`dirname '$PRG'`/.."
# make it fully qualified
ANT_HOME=`cd "$ANT_HOME" && pwd`
cd "$saveddir"
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if [ "$cygwin" = "true" ] ; then
[ -n "$ANT_HOME" ] && ANT_HOME=`cygpath --unix "$ANT_HOME"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
[ -z "$JAVA_FUNCTIONS" ] && $JAVA_FUNCTIONS="$ANT_HOME/bin/java-functions"
if [ -r "$JAVA_FUNCTIONS" ] ; then
. "$JAVA_FUNCTIONS"
set_jvm
set_javacmd
else
echo "No java functions found in $JAVA_FUNCTIONS, operating in dumb mode"
[ -z "$JAVA_HOME" ] && JAVA_HOME="/usr/lib/java"
[ -z "$JAVACMD" ] && JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: we cannot execute $JAVACMD"
echo "Please set the JAVACMD environment variable to a correct value"
exit 1
fi
if [ ! -d "$JAVA_HOME" ] ; then
echo "Warning: $JAVA_HOME is not a directory"
echo "Please set the JAVA_HOME environment variable to a correct value"
fi
unset LOCALCLASSPATH
[ -f "$JAVA_HOME/lib/tools.jar" ] && LOCALCLASSPATH="$JAVA_HOME/lib/tools.jar:"
[ -f "$JAVA_HOME/lib/classes.zip" ] && LOCALCLASSPATH="$JAVA_HOME/lib/classes.zip:"
if [ "$darwin" = "true" -a "$usejikes" = "true" ] ; then
OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes"
JIKESJARS=`find "$OSXHACK" -name *.jar -maxdepth 1 -printf %p: 2>/dev/null`
[ -z "$JIKESPATH" ] && JIKESPATH="$JIKESJARS" || JIKESPATH="$JIKESPATH:$JIKESJARS"
fi
unset RPMCOREJARS
if [ "$standalone" = "false" ] ; then
JAVALIBDIR="/usr/share/java"
JARS="ant ant-optional jaxp_parser xml_apis"
for jar in $JARS ; do RPMCOREJARS="$RPMCOREJARS$JAVALIBDIR/$jar.jar:" ; done
fi
COREJARS=`find "$ANT_HOME/lib" -name *.jar -maxdepth 1 -printf %p: 2>/dev/null`
LOCALCOREJARS=`find "$HOME/.ant/lib" -name *.jar -maxdepth 1 -printf %p: 2>/dev/null`
LOCALCLASSPATH="$LOCALCLASSPATH$RPMCOREJARS$ANT_HOME/classes:$COREJARS$HOME/.ant/classes:$LOCALCOREJARS$CLASSPATH"
# supply JIKESPATH to Ant as jikes.class.path
if [ -n "$JIKESPATH" ] ; then
[ "$cygwin" = "true" ] && JIKESPATH=`cygpath --path --windows "$JIKESPATH"`
ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH"
fi
# Allow Jikes support (off by default)
[ "$usejikes" = "true" ] && ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes"
# For Cygwin, switch paths to Windows format before running java
if [ "$cygwin" = "true" ]; then
ANT_HOME=`cygpath --path --windows "$ANT_HOME"`
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
fi
"$JAVACMD" -classpath "$LOCALCLASSPATH" -Dant.home="$ANT_HOME" $ANT_OPTS org.apache.tools.ant.Main $ANT_ARGS "$@"
Attachment:
signature.asc
Description: PGP signature