diff options
| author | Antoine Levy-Lambert <antoine@apache.org> | 2003-09-22 21:10:10 +0000 |
|---|---|---|
| committer | Antoine Levy-Lambert <antoine@apache.org> | 2003-09-22 21:10:10 +0000 |
| commit | 24a5f03a90e6931dd280031f226b76bfe971193e (patch) | |
| tree | d70ddf57d02ca3242975ab26816a6bb14390524b /src/script | |
| parent | 1ca4fd877177c9619e7c8d9c6e5bb3c606ac4546 (diff) | |
| download | ant-24a5f03a90e6931dd280031f226b76bfe971193e.tar.gz | |
adding a new supported command line argument -lib
this command line argument is eaten by Launcher
shell scripts reworked to pass the classpath in the right location
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275286 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/script')
| -rw-r--r-- | src/script/ant | 12 | ||||
| -rwxr-xr-x | src/script/ant.bat | 12 | ||||
| -rw-r--r-- | src/script/runant.pl | 56 |
3 files changed, 38 insertions, 42 deletions
diff --git a/src/script/ant b/src/script/ant index b383d44cc..794523d9f 100644 --- a/src/script/ant +++ b/src/script/ant @@ -100,10 +100,6 @@ if [ ! -x "$JAVACMD" ] ; then exit 1 fi -if [ -n "$CLASSPATH" ] ; then - LOCALCLASSPATH="$CLASSPATH" -fi - # in rpm_mode get ant/optional/xml parser&api from JAVALIBDIR if $rpm_mode; then JAVALIBDIR=/usr/share/java @@ -156,14 +152,14 @@ fi if [ -n "$CYGHOME" ]; then if [ -n "$JIKESPATH" ]; then - exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" -Djikes.class.path="$JIKESPATH" -Dcygwin.user.home="$CYGHOME" org.apache.tools.ant.launch.Launcher $ANT_ARGS "$@" + exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" -Djikes.class.path="$JIKESPATH" -Dcygwin.user.home="$CYGHOME" org.apache.tools.ant.launch.Launcher $ANT_ARGS "$@" -lib "$CLASSPATH" else - exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" -Dcygwin.user.home="$CYGHOME" org.apache.tools.ant.launch.Launcher $ANT_ARGS "$@" + exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" -Dcygwin.user.home="$CYGHOME" org.apache.tools.ant.launch.Launcher $ANT_ARGS "$@" -lib "$CLASSPATH" fi else if [ -n "$JIKESPATH" ]; then - exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" -Djikes.class.path="$JIKESPATH" org.apache.tools.ant.launch.Launcher $ANT_ARGS "$@" + exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" -Djikes.class.path="$JIKESPATH" org.apache.tools.ant.launch.Launcher $ANT_ARGS "$@" -lib "$CLASSPATH" else - exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" org.apache.tools.ant.launch.Launcher $ANT_ARGS "$@" + exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" org.apache.tools.ant.launch.Launcher $ANT_ARGS "$@" -lib "$CLASSPATH" fi fi diff --git a/src/script/ant.bat b/src/script/ant.bat index 6075466d9..8660f9f02 100755 --- a/src/script/ant.bat +++ b/src/script/ant.bat @@ -54,7 +54,7 @@ goto end :checkJava set _JAVACMD=%JAVACMD% -set LOCALCLASSPATH=%ANT_HOME%\lib\ant-launcher.jar;%CLASSPATH% +set LOCALCLASSPATH=%ANT_HOME%\lib\ant-launcher.jar if "%JAVA_HOME%" == "" goto noJavaHome if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome @@ -68,13 +68,23 @@ if "%_JAVACMD%" == "" set _JAVACMD=java.exe if not "%JIKESPATH%"=="" goto runAntWithJikes :runAnt +if not "%CLASSPATH%"=="" goto runAntWithClasspath "%_JAVACMD%" %ANT_OPTS% -classpath "%LOCALCLASSPATH%" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% goto end +:runAntWithClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%LOCALCLASSPATH%" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% -lib "%CLASSPATH%" +goto end + :runAntWithJikes +if not "%CLASSPATH%"=="" goto runAntWithJikesAndClasspath "%_JAVACMD%" %ANT_OPTS% -classpath "%LOCALCLASSPATH%" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% goto end +:runAntWithJikesAndClasspath +"%_JAVACMD%" %ANT_OPTS% -classpath "%LOCALCLASSPATH%" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% -lib "%CLASSPATH%" +goto end + :end set LOCALCLASSPATH= set _JAVACMD= diff --git a/src/script/runant.pl b/src/script/runant.pl index 80fb2b10b..5232a9db5 100644 --- a/src/script/runant.pl +++ b/src/script/runant.pl @@ -39,7 +39,7 @@ use strict; #use warnings; #and set $debug to 1 to turn on trace info -my $debug=0; +my $debug=1; ####################################################################### # @@ -74,26 +74,7 @@ if(($^O eq "MSWin32") || ($^O eq "dos") || ($^O eq "cygwin") || } #build up standard classpath -my $localpath=$ENV{CLASSPATH}; -if ($localpath eq "") - { - print "warning: no initial classpath\n" if ($debug); - $localpath=""; - } -if ($onnetware == 1) -{ -# avoid building a command line bigger than 512 characters - make localpath -# only include the "extra" stuff, and add in the system classpath as an expanded -# variable. - $localpath=""; -} - -if ($localpath eq "") { - $localpath = "$HOME/lib/ant-launcher.jar"; -} else { - $localpath = "$HOME/lib/ant-launcher.jar$s$localpath"; -} - +my $localpath = "$HOME/lib/ant-launcher.jar"; #set JVM options and Ant arguments, if any my @ANT_OPTS=split(" ", $ENV{ANT_OPTS}); my @ANT_ARGS=split(" ", $ENV{ANT_ARGS}); @@ -110,25 +91,21 @@ push @ARGS, @ANT_OPTS; 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); } -if ($onnetware == 1) -{ -# make classpath literally $CLASSPATH; and then the contents of $localpath -# this is to avoid pushing us over the 512 character limit -# even skip the ; - that is already in $localpath - push @ARGS, "-classpath", "\$CLASSPATH$localpath"; -} -else -{ - push @ARGS, "-classpath", "$localpath"; -} +push @ARGS, "-classpath", "$localpath"; push @ARGS, "-Dant.home=$HOME"; if ( ! $CYGHOME eq "" ) { @@ -136,7 +113,20 @@ if ( ! $CYGHOME eq "" ) } push @ARGS, "org.apache.tools.ant.launch.Launcher", @ANT_ARGS; 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"; + } +} print "\n $JAVACMD @ARGS\n\n" if ($debug); my $returnValue = system $JAVACMD, @ARGS; |
