User: user57
Date: 01/08/26 00:00:33
Added: bin ant ant.bat antRun antRun.bat antx.bat lcp.bat
runant.pl runant.py
Log:
o consolidated all tools/* stuff into tools/bin and tools/lib
o upgraded ant to 1.4beta2
o consolidated config.xml into build.xml
o using path to generate absolute paths to project.root
o changed project.config to control.root
o removed classpath fluff for extra tasks & the taskdefs for them
currently every support lib is in ANT_HOME/lib, so there is no need for
specific classpaths. May change that for ejbdoclet and such later.
o updated build.sh to look for tools/ too (will get the a win32 script soon
... really)
o removed bootstrap & configure targets, the just added complexity and
slowed down the build
NOTE: All modules will read ${config.root}/local.properties
(or build/local.properties). Modules still can read a local.properties
(when they don't care about the control module, but this file will
no loger be placed here automatically)
Revision Changes Path
1.1 tools/bin/ant
Index: ant
===================================================================
#! /bin/sh
if [ -f $HOME/.antrc ] ; then
. $HOME/.antrc
fi
# 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 [ -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
## resolve links - $0 may be a link to ant's home
PRG=$0
progname=`basename $0`
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"`/..
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"`
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
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " We cannot execute $JAVACMD"
exit
fi
if [ -n "$CLASSPATH" ] ; then
LOCALCLASSPATH=$CLASSPATH
fi
# add in the dependency .jar files
DIRLIBS=${ANT_HOME}/lib/*.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
if [ -z "$LOCALCLASSPATH" ] ; then
LOCALCLASSPATH=$i
else
LOCALCLASSPATH="$i":$LOCALCLASSPATH
fi
fi
done
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."
fi
# supply JIKESPATH to Ant as jikes.class.path
if [ -n "$JIKESPATH" ] ; then
if [ -n "$ANT_OPTS" ] ; then
ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH"
else
ANT_OPTS=-Djikes.class.path=$JIKESPATH
fi
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
ANT_HOME=`cygpath --path --windows "$ANT_HOME"`
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
fi
$JAVACMD -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" $ANT_OPTS
org.apache.tools.ant.Main "$@"
1.1 tools/bin/ant.bat
Index: ant.bat
===================================================================
@echo off
if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal
rem %~dp0 is name of current script under NT
set DEFAULT_ANT_HOME=%~dp0
rem : operator works similar to make : operator
set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME%\..
if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME%
set DEFAULT_ANT_HOME=
rem Need to check if we are using the 4NT shell...
if "%eval[2+2]" == "4" goto setup4NT
rem On NT/2K grab all arguments at once
set ANT_CMD_LINE_ARGS=%*
goto doneStart
:setup4NT
set ANT_CMD_LINE_ARGS=%$
goto doneStart
:win9xStart
rem Slurp the command line arguments. This loop allows for an unlimited number of
rem agruments (up to the command line limit, anyway).
set ANT_CMD_LINE_ARGS=
:setupArgs
if %1a==a goto doneStart
set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
shift
goto setupArgs
:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.
rem find ANT_HOME
if not "%ANT_HOME%"=="" goto checkJava
rem check for ant in Program Files on system drive
if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive
set ANT_HOME=%SystemDrive%\Program Files\ant
goto checkJava
:checkSystemDrive
rem check for ant in root directory of system drive
if not exist %SystemDrive%\ant\nul goto checkCDrive
set ANT_HOME=%SystemDrive%\ant
goto checkJava
:checkCDrive
rem check for ant in C:\ant for Win9X users
if not exist C:\ant\nul goto noAntHome
set ANT_HOME=C:\ant
goto checkJava
:noAntHome
echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
goto end
:checkJava
set _JAVACMD=%JAVACMD%
set LOCALCLASSPATH=%CLASSPATH%
for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" %%i
if "%JAVA_HOME%" == "" goto noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java
if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat"
%JAVA_HOME%\lib\tools.jar
if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat"
%JAVA_HOME%\lib\classes.zip
goto checkJikes
:noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=java
echo.
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.
echo.
:checkJikes
if not "%JIKESPATH%" == "" goto runAntWithJikes
:runAnt
"%_JAVACMD%" -classpath "%LOCALCLASSPATH%" -Dant.home="%ANT_HOME%" %ANT_OPTS%
org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
goto end
:runAntWithJikes
"%_JAVACMD%" -classpath "%LOCALCLASSPATH%" -Dant.home="%ANT_HOME%"
-Djikes.class.path="%JIKESPATH%" %ANT_OPTS% org.apache.tools.ant.Main
%ANT_CMD_LINE_ARGS%
:end
set LOCALCLASSPATH=
set _JAVACMD=
set ANT_CMD_LINE_ARGS=
if not "%OS%"=="Windows_NT" goto mainEnd
:winNTend
@endlocal
:mainEnd
if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
1.1 tools/bin/antRun
Index: antRun
===================================================================
#! /bin/sh
# Args: DIR command
cd "$1"
CMD="$2"
shift
shift
exec $CMD "$@"
1.1 tools/bin/antRun.bat
Index: antRun.bat
===================================================================
@echo off
rem Change drive and directory to %1 (Win9X only for NT/2K use "cd /d")
cd %1
%1\
set ANT_RUN_CMD=%2
shift
shift
set PARAMS=
:loop
if ""%1 == "" goto runCommand
set PARAMS=%PARAMS% %1
shift
goto loop
:runCommand
rem echo %ANT_RUN_CMD% %PARAMS%
%ANT_RUN_CMD% %PARAMS%
1.1 tools/bin/antx.bat
Index: antx.bat
===================================================================
@echo off
@setlocal
set CLASSPATH=%~dp0..\lib\ant.jar;%CLASSPATH%
java org.apache.tools.ant.Launcher %*
rem java -jar %ANT_HOME%\lib\ant.jar org.apache.tools.ant.Launcher
@endlocal
1.1 tools/bin/lcp.bat
Index: lcp.bat
===================================================================
set _CLASSPATHCOMPONENT=%1
:argCheck
if %2a==a goto gotAllArgs
shift
set _CLASSPATHCOMPONENT=%_CLASSPATHCOMPONENT% %1
goto argCheck
:gotAllArgs
set LOCALCLASSPATH=%_CLASSPATHCOMPONENT%;%LOCALCLASSPATH%
1.1 tools/bin/runant.pl
Index: runant.pl
===================================================================
#!/usr/bin/perl
#######################################################################
#
# runant.pl
#
# wrapper script for invoking ant in a platform with Perl installed
# this may include cgi-bin invocation, which is considered somewhat daft.
# (slo: that should be a separate file which can be derived from this
# and returns the XML formatted output)
#
# 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
# structured for the catfile() call, but because of perl version funnies
# the code is not included.
#
# created: 2000-8-24
# last modified: 2000-8-24
# author: Steve Loughran [EMAIL PROTECTED]
#######################################################################
#
# Assumptions:
#
# - the "java" executable/script is on the command path
# - ANT_HOME has been set
# - target platform uses ":" as classpath separator or perl indicates it is dos/win32
# - target platform uses "/" as directory separator.
#be fussy about variables
use strict;
#platform specifics (disabled)
#use File::Spec::Functions;
#turn warnings on during dev; generates a few spurious uninitialised var access
warnings
#use warnings;
#and set $debug to 1 to turn on trace info
my $debug=0;
#######################################################################
#
# check to make sure environment is setup
#
my $HOME = $ENV{ANT_HOME};
if ($HOME eq "")
{
die "\n\nANT_HOME *MUST* be set!\n\n";
}
my $JAVACMD = $ENV{JAVACMD};
$JAVACMD = "java" if $JAVACMD eq "";
#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.
#here I assume ":" 'cept on win32 and dos. Add extra tests here as needed.
my $s=":";
if(($^O eq "MSWin32") || ($^O eq "dos"))
{
$s=";";
}
#build up standard classpath
my $localpath=$ENV{CLASSPATH};
if ($localpath eq "")
{
print "warning: no initial classpath\n" if ($debug);
$localpath="";
}
#add jar files. I am sure there is a perl one liner to do this.
my $jarpattern="$HOME/lib/*.jar";
my @jarfiles =glob($jarpattern);
print "jarfiles=@jarfiles\n" if ($debug);
my $jar;
foreach $jar (@jarfiles )
{
$localpath.="$s$jar";
}
#if Java home is defined, look for tools.jar & classes.zip and add to classpath
my $JAVA_HOME = $ENV{JAVA_HOME};
if ($JAVA_HOME ne "")
{
my $tools="$JAVA_HOME/lib/tools.jar";
if (-e "$tools")
{
$localpath .= "$s$tools";
}
my $classes="$JAVA_HOME/lib/classes.zip";
if (-e $classes)
{
$localpath .= "$s$classes";
}
}
else
{
print "\n\nWarning: JAVA_HOME environment variable is not set.\n".
"If the build fails because sun.* classes could not be found\n".
"you will need to set the JAVA_HOME environment variable\n".
"to the installation directory of java\n";
}
#jikes
my @ANT_OPTS=split $ENV{ANT_OPTS};
if($ENV{JIKESPATH} ne "")
{
push @ANT_OPTS, "-Djikes.class.path=$ENV{JIKESPATH}";
}
#construct arguments to java
my @ARGS;
push @ARGS, "-classpath", "$localpath", "-Dant.home=$HOME";
push @ARGS, @ANT_OPTS;
push @ARGS, "org.apache.tools.ant.Main";
push @ARGS, @ARGV;
print "\n $JAVACMD @ARGS\n\n" if ($debug);
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;
}
1.1 tools/bin/runant.py
Index: runant.py
===================================================================
#!/usr/bin/python
"""
runant.py
This script is a translation of the runant.pl written by Steve Loughran.
It runs ant with/out arguments, it should be quite portable (thanks to
the python os library)
This script has been tested with Python2.0/Win2K
created: 2001-04-11
author: Pierre Dittgen [EMAIL PROTECTED]
Assumptions:
- the "java" executable/script is on the command path
- ANT_HOME has been set
"""
import os, os.path, string, sys
# Change it to 1 to get extra debug information
debug = 0
#######################################################################
#
# check to make sure environment is setup
#
if not os.environ.has_key('ANT_HOME'):
print '\n\nANT_HOME *MUST* be set!\n\n'
sys.exit(1)
else:
ANT_HOME = os.environ['ANT_HOME']
if not os.environ.has_key('JAVACMD'):
JAVACMD = 'java'
else:
JAVACMD = os.environ['JAVACMD']
# Sets the separator char for CLASSPATH
SEPARATOR = ':'
if os.name == 'dos' or os.name == 'nt':
SEPARATOR = ';'
# Build up standard classpath
localpath = ''
if os.environ.has_key('CLASSPATH'):
localpath = os.environ['CLASSPATH']
else:
if debug:
print 'Warning: no initial classpath\n'
# Add jar files
LIBDIR = os.path.join(ANT_HOME, 'lib')
jarfiles = []
for file in os.listdir(LIBDIR):
if file[-4:] == '.jar':
jarfiles.append(os.path.join(LIBDIR,file))
if debug:
print 'Jar files:'
for jar in jarfiles:
print jar
localpath = localpath + SEPARATOR + string.join(jarfiles, SEPARATOR)
# If JAVA_HOME is defined, look for tools.jar & classes.zip
# and add to classpath
if os.environ.has_key('JAVA_HOME') and os.environ['JAVA_HOME'] != '':
JAVA_HOME = os.environ['JAVA_HOME']
TOOLS = os.path.join(JAVA_HOME, os.path.join('lib', 'tools.jar'))
if os.path.exists(TOOLS):
localpath = localpath + SEPARATOR + TOOLS
CLASSES = os.path.join(JAVA_HOME, os.path.join('lib', 'classes.zip'))
if os.path.exists(CLASSES):
localpath = localpath + SEPARATOR + CLASSES
else:
print '\n\nWarning: JAVA_HOME environment variable is not set.\n', \
'If the build fails because sun.* classes could not be found\n', \
'you will need to set the JAVA_HOME environment variable\n', \
'to the installation directory of java\n'
# Jikes
ANT_OPTS = []
if os.environ.has_key('ANT_OPTS'):
ANT_OPTS = string.split(os.environ['ANT_OPTS'])
if os.environ.has_key('JIKESPATH'):
ANT_OPTS.append('-Djikes.class.path=' + os.environ['JIKESPATH'])
# Builds the commandline
cmdline = '%s -classpath %s -Dant.home=%s %s org.apache.tools.ant.Main %s' \
% (JAVACMD, localpath, ANT_HOME, string.join(ANT_OPTS,' '), \
string.join(sys.argv[1:], ' '))
if debug:
print '\n%s\n\n' % (cmdline)
# Run the biniou!
os.system(cmdline)
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development