conor 2003/09/24 07:52:47 Modified: . build.bat build.sh src/main/org/apache/tools/ant/launch Launcher.java src/script ant ant.bat Log: merge Revision Changes Path 1.39 +3 -10 ant/build.bat Index: build.bat =================================================================== RCS file: /home/cvs/ant/build.bat,v retrieving revision 1.38 retrieving revision 1.39 diff -u -w -u -r1.38 -r1.39 --- build.bat 11 Aug 2003 13:18:19 -0000 1.38 +++ build.bat 24 Sep 2003 14:52:47 -0000 1.39 @@ -3,7 +3,6 @@ REM Copyright (c) 2000-2002 The Apache Software Foundation. All rights REM reserved. -set OLDCLASSPATH=%CLASSPATH% set REAL_ANT_HOME=%ANT_HOME% set ANT_HOME=bootstrap if exist bootstrap\lib\ant.jar if exist bootstrap\bin\ant.bat if exist bootstrap\bin\lcp.bat if exist bootstrap\bin\antRun.bat goto runAnt @@ -13,21 +12,15 @@ goto cleanup :runAnt -set LOCALCLASSPATH= -for %%i in (lib\optional\*.jar) do call bootstrap\bin\lcp.bat %%i -set CLASSPATH=lib\optional\xalanj1compat.jar;%LOCALCLASSPATH%;%CLASSPATH% -set LOCALCLASSPATH= - if not "%REAL_ANT_HOME%" == "" goto install_ant -call bootstrap\bin\ant.bat -emacs %1 %2 %3 %4 %5 %6 %7 %8 %9 +call bootstrap\bin\ant.bat -lib lib/optional %1 %2 %3 %4 %5 %6 %7 %8 %9 goto cleanup :install_ant -call bootstrap\bin\ant.bat -emacs -Dant.install="%REAL_ANT_HOME%" %1 %2 %3 %4 %5 %6 %7 %8 %9 +call bootstrap\bin\ant.bat -lib lib/optional -Dant.install="%REAL_ANT_HOME%" %1 %2 %3 %4 %5 %6 %7 %8 %9 rem clean up :cleanup set ANT_HOME=%REAL_ANT_HOME% set REAL_ANT_HOME= -set CLASSPATH=%OLDCLASSPATH% -set OLDCLASSPATH= + 1.36 +1 -26 ant/build.sh Index: build.sh =================================================================== RCS file: /home/cvs/ant/build.sh,v retrieving revision 1.35 retrieving revision 1.36 diff -u -w -u -r1.35 -r1.36 --- build.sh 11 Aug 2003 13:18:19 -0000 1.35 +++ build.sh 24 Sep 2003 14:52:47 -0000 1.36 @@ -28,31 +28,6 @@ exit fi -LOCALCLASSPATH= -# add in the dependency .jar files -DIRLIBS=lib/optional/*.jar -for i in ${DIRLIBS} -do - if [ "$i" != "${DIRLIBS}" ] ; then - LOCALCLASSPATH=$LOCALCLASSPATH:"$i" - fi -done - -# make sure the classpath is in unix format -if $cygwin ; then - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -CLASSPATH=$LOCALCLASSPATH:$CLASSPATH - -# switch back to Windows format -if $cygwin ; then - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` -fi - -export CLASSPATH - - if [ "$REALANTHOME" != "" ] ; then if $cygwin; then REALANTHOME=`cygpath --path --windows "$REALANTHOME"` @@ -62,5 +37,5 @@ ANT_INSTALL="-emacs" fi -bootstrap/bin/ant "$ANT_INSTALL" $* +bootstrap/bin/ant -lib lib/optional "$ANT_INSTALL" $* 1.8 +50 -37 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.7 retrieving revision 1.8 diff -u -w -u -r1.7 -r1.8 --- Launcher.java 23 Sep 2003 22:42:23 -0000 1.7 +++ Launcher.java 24 Sep 2003 14:52:47 -0000 1.8 @@ -58,6 +58,10 @@ import java.net.MalformedURLException; import java.io.File; import java.util.StringTokenizer; +import java.util.List; +import java.util.ArrayList; +import java.util.Iterator; + /** * This is a launcher for Ant. @@ -118,43 +122,48 @@ 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 (args.length > 0 && args[args.length -1].equals("-lib")) { - // if the last argument is -lib - // remove it from the arguments passed to Launcher - // - newargs = new String[args.length - 1]; - System.arraycopy(args, 0, newargs, 0, args.length -1); - } else if (libPath.equals("")) { - newargs = new String[args.length]; - System.arraycopy(args, 0, newargs, 0, args.length); + + List libPaths = new ArrayList(); + List argList = new ArrayList(); + String[] newArgs; + + for (int i = 0; i < args.length; ++i) { + if (args[i].equals("-lib")) { + if (i == args.length - 1) { + throw new IllegalStateException("The -lib argument must " + + "be followed by a library location"); + } + libPaths.add(args[++i]); } 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)); + argList.add(args[i]); } } - StringTokenizer myTokenizer = new StringTokenizer(libPath, System.getProperty("path.separator")); - URL[] classPathJars = new URL[myTokenizer.countTokens()]; - int classPathJarCount = 0; + + if (libPaths.size() == 0) { + newArgs = args; + } else { + newArgs = (String[]) argList.toArray(new String[0]); + } + + List libPathURLs = new ArrayList(); + for (Iterator i = libPaths.iterator(); i.hasNext();) { + String libPath = (String) i.next(); + StringTokenizer myTokenizer + = new StringTokenizer(libPath, System.getProperty("path.separator")); while (myTokenizer.hasMoreElements()) { - String token = myTokenizer.nextToken(); - classPathJars[classPathJarCount++] = new File(token).toURL(); + File element = new File(myTokenizer.nextToken()); + if (element.isDirectory()) { + // add any jars in the directory + URL[] dirURLs = Locator.getLocationURLs(element); + for (int j = 0; j < dirURLs.length; ++j) { + libPathURLs.add(dirURLs[j]); + } + } + libPathURLs.add(element.toURL()); + } } + URL[] libJars = (URL[])libPathURLs.toArray(new URL[0]); // Now try and find JAVA_HOME File toolsJar = Locator.getToolsJar(); @@ -166,14 +175,14 @@ URL[] userJars = Locator.getLocationURLs(userLibDir); - int numJars = classPathJars.length + userJars.length + systemJars.length; + int numJars = libJars.length + userJars.length + systemJars.length; if (toolsJar != null) { numJars++; } URL[] jars = new URL[numJars]; - 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, + System.arraycopy(libJars, 0, jars, 0, libJars.length); + System.arraycopy(userJars, 0, jars, libJars.length, userJars.length); + System.arraycopy(systemJars, 0, jars, userJars.length + libJars.length, systemJars.length); if (toolsJar != null) { @@ -184,6 +193,10 @@ // now update the class.path property StringBuffer baseClassPath = new StringBuffer(System.getProperty("java.class.path")); + if (baseClassPath.charAt(baseClassPath.length() - 1) + == File.pathSeparatorChar) { + baseClassPath.setLength(baseClassPath.length() - 1); + } for (int i = 0; i < jars.length; ++i) { baseClassPath.append(File.pathSeparatorChar); @@ -197,7 +210,7 @@ try { Class mainClass = loader.loadClass(MAIN_CLASS); AntMain main = (AntMain) mainClass.newInstance(); - main.startAnt(newargs, null, null); + main.startAnt(newArgs, null, null); } catch (Throwable t) { t.printStackTrace(); } 1.40 +4 -7 ant/src/script/ant Index: ant =================================================================== RCS file: /home/cvs/ant/src/script/ant,v retrieving revision 1.39 retrieving revision 1.40 diff -u -w -u -r1.39 -r1.40 --- ant 22 Sep 2003 21:10:10 -0000 1.39 +++ ant 24 Sep 2003 14:52:47 -0000 1.40 @@ -71,8 +71,6 @@ ANT_HOME=`cygpath --unix "$ANT_HOME"` [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` fi # set ANT_LIB location @@ -145,21 +143,20 @@ if $cygwin; then ANT_HOME=`cygpath --windows "$ANT_HOME"` JAVA_HOME=`cygpath --windows "$JAVA_HOME"` - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"` CYGHOME=`cygpath --windows "$HOME"` 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 "$@" -lib "$CLASSPATH" + 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 "$@" -lib "$CLASSPATH" + 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 "$@" -lib "$CLASSPATH" + 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 "$@" -lib "$CLASSPATH" + exec "$JAVACMD" $ANT_OPTS -classpath "$LOCALCLASSPATH" -Dant.home="${ANT_HOME}" org.apache.tools.ant.launch.Launcher $ANT_ARGS -lib "$CLASSPATH" "$@" fi fi 1.34 +4 -6 ant/src/script/ant.bat Index: ant.bat =================================================================== RCS file: /home/cvs/ant/src/script/ant.bat,v retrieving revision 1.33 retrieving revision 1.34 diff -u -w -u -r1.33 -r1.34 --- ant.bat 22 Sep 2003 21:10:10 -0000 1.33 +++ ant.bat 24 Sep 2003 14:52:47 -0000 1.34 @@ -54,7 +54,6 @@ :checkJava set _JAVACMD=%JAVACMD% -set LOCALCLASSPATH=%ANT_HOME%\lib\ant-launcher.jar if "%JAVA_HOME%" == "" goto noJavaHome if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome @@ -69,24 +68,23 @@ :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% +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-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%" +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -lib "%CLASSPATH%" %ANT_CMD_LINE_ARGS% 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% +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-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%" +"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -lib "%CLASSPATH%" %ANT_CMD_LINE_ARGS% goto end :end -set LOCALCLASSPATH= set _JAVACMD= set ANT_CMD_LINE_ARGS=
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]