antoine     2003/09/22 14:15:41

  Modified:    src/script Tag: ANT_16_BRANCH ant ant.bat runant.pl
               src/main/org/apache/tools/ant/launch Tag: ANT_16_BRANCH
                        Launcher.java
               src/main/org/apache/tools/ant Tag: ANT_16_BRANCH Main.java
  Log:
  Merge last changes from HEAD
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.38.2.1  +4 -8      ant/src/script/ant
  
  Index: ant
  ===================================================================
  RCS file: /home/cvs/ant/src/script/ant,v
  retrieving revision 1.38
  retrieving revision 1.38.2.1
  diff -u -r1.38 -r1.38.2.1
  --- ant       10 Jul 2003 11:29:38 -0000      1.38
  +++ ant       22 Sep 2003 21:15:41 -0000      1.38.2.1
  @@ -100,10 +100,6 @@
     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 @@
   
   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
  
  
  
  1.32.2.1  +11 -1     ant/src/script/ant.bat
  
  Index: ant.bat
  ===================================================================
  RCS file: /home/cvs/ant/src/script/ant.bat,v
  retrieving revision 1.32
  retrieving revision 1.32.2.1
  diff -u -r1.32 -r1.32.2.1
  --- ant.bat   10 Jul 2003 11:49:08 -0000      1.32
  +++ ant.bat   22 Sep 2003 21:15:41 -0000      1.32.2.1
  @@ -54,7 +54,7 @@
   
   :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,11 +68,21 @@
   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
  
  
  
  1.7.2.1   +24 -34    ant/src/script/runant.pl
  
  Index: runant.pl
  ===================================================================
  RCS file: /home/cvs/ant/src/script/runant.pl,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- runant.pl 1 Sep 2003 10:52:43 -0000       1.7
  +++ runant.pl 22 Sep 2003 21:15:41 -0000      1.7.2.1
  @@ -39,7 +39,7 @@
   #use warnings;
   
   #and set $debug to 1 to turn on trace info
  -my $debug=0;
  +my $debug=1;
   
   #######################################################################
   #
  @@ -74,26 +74,7 @@
           }
   
   #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 @@
   
   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 @@
   }
   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;
  
  
  
  No                   revision
  No                   revision
  1.5.2.1   +36 -4     ant/src/main/org/apache/tools/ant/launch/Launcher.java
  
  Index: Launcher.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/launch/Launcher.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- Launcher.java     14 Jul 2003 12:07:22 -0000      1.5
  +++ Launcher.java     22 Sep 2003 21:15:41 -0000      1.5.2.1
  @@ -57,6 +57,7 @@
   import java.net.URLClassLoader;
   import java.net.MalformedURLException;
   import java.io.File;
  +import java.util.StringTokenizer;
   
   /**
    *  This is a launcher for Ant.
  @@ -117,6 +118,36 @@
               throw new IllegalStateException("Ant home is set incorrectly or "
                   + "ant could not be located");
           }
  +        String libPath = "";
  +        String[] newargs = null;
  +        int argcount = -1;
  +        for (argcount = 0; argcount < args.length -1; argcount++) {
  +            if (args[argcount].equals("-lib")) {
  +                libPath = args[argcount + 1];
  +                break;
  +            }
  +        }
  +        if (libPath.equals("")) {
  +           newargs = new String[args.length];
  +           System.arraycopy(args, 0, newargs, 0, args.length);
  +        } else {
  +            newargs = new String[args.length - 2];
  +            // copy the beginning of the args array
  +            if (argcount > 0 ) {
  +                System.arraycopy(args, 0, newargs, 0 ,argcount);
  +            }
  +            // copy the end of the args array
  +            if ((argcount + 2 < args.length) && argcount > 0) {
  +                System.arraycopy(args, argcount + 2, newargs, argcount, 
args.length - (argcount + 2));
  +            }
  +        }
  +        StringTokenizer myTokenizer = new StringTokenizer(libPath, 
System.getProperty("path.separator"));
  +        URL[] classPathJars = new URL[myTokenizer.countTokens()];
  +        int classPathJarCount = 0;
  +        while (myTokenizer.hasMoreElements()) {
  +            String token = myTokenizer.nextToken();
  +            classPathJars[classPathJarCount++] = new File(token).toURL();
  +        }
   
   
           // Now try and find JAVA_HOME
  @@ -129,13 +160,14 @@
           URL[] userJars = Locator.getLocationURLs(userLibDir);
   
   
  -        int numJars = userJars.length + systemJars.length;
  +        int numJars = classPathJars.length + userJars.length + 
systemJars.length;
           if (toolsJar != null) {
               numJars++;
           }
           URL[] jars = new URL[numJars];
  -        System.arraycopy(userJars, 0, jars, 0, userJars.length);
  -        System.arraycopy(systemJars, 0, jars, userJars.length,
  +        System.arraycopy(classPathJars, 0, jars, 0, classPathJars.length);
  +        System.arraycopy(userJars, 0, jars, classPathJars.length, 
userJars.length);
  +        System.arraycopy(systemJars, 0, jars, userJars.length + 
classPathJars.length,
               systemJars.length);
   
           if (toolsJar != null) {
  @@ -159,7 +191,7 @@
           try {
               Class mainClass = loader.loadClass(MAIN_CLASS);
               AntMain main = (AntMain) mainClass.newInstance();
  -            main.startAnt(args, null, null);
  +            main.startAnt(newargs, null, null);
           } catch (Throwable t) {
               t.printStackTrace();
           }
  
  
  
  No                   revision
  No                   revision
  1.95.2.1  +2 -1      ant/src/main/org/apache/tools/ant/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Main.java,v
  retrieving revision 1.95
  retrieving revision 1.95.2.1
  diff -u -r1.95 -r1.95.2.1
  --- Main.java 12 Sep 2003 20:56:45 -0000      1.95
  +++ Main.java 22 Sep 2003 21:15:41 -0000      1.95.2.1
  @@ -290,7 +290,8 @@
       }
   
       /**
  -     * Process command line arguments
  +     * Process command line arguments.
  +     * When ant is started from Launcher, the -lib argument does not get 
passed through to this routine.
        *
        * @param args the command line arguments.
        *
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to