You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Conor MacNeill <co...@cortexebusiness.com.au> on 2001/07/17 14:30:44 UTC

New launcher

I have just committed a new class to launch Ant. It moves some of the
functions currently in the ant scripts into Java code, making the scripts
simpler to maintain (I'm sick of spaces in directory names :-) ). The
functions it provides include determining ant.home, finding tools.jar,
building the classpath to include the optional jar and the parser jars.

This is currently experimental. It uses classloaders to launch the Ant Main
class, which I have modified slightly to allow the new class, Launcher, to
pass some additional information. The current script based launchers should
be unaffected by the changes. One benefit of this change is that when Java
tasks are run in VM, the ant parser classes should not be visible.

If anyone wants to give it a try, please let me know how you go. I'd
especially be interested in situations where people are using JUnit and
getting Linkage errors as I want to investigate that a bit. Any other
feedback is also welcome.

Note that at the moment, the Launcher class prints out debug stuff etc when
it starts up. I haven't included a launch script for this yet, but for
reference the script I am using on NT is

@echo off
@setlocal
set CLASSPATH=%~dp0..\lib\ant.jar;%CLASSPATH%
java org.apache.tools.ant.Launcher %*
@endlocal

A similar script for Unix should be obvious. I haven't tested on Linux yet.

So, give it a whirl and lets see if we can replace the launching scripts
with something a bit simpler.

Cheers
Conor



Re: New launcher

Posted by Stefan Bodewig <bo...@apache.org>.
On 17 Jul 2001, Stefan Bodewig <bo...@apache.org> wrote:

> On Tue, 17 Jul 2001, Conor MacNeill <co...@cortexebusiness.com.au>
> wrote:
> 
>> A similar script for Unix should be obvious.
> 
> I've attached mine.

now, argh.


Re: New launcher

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
From: "Stefan Bodewig" <bo...@apache.org>
>
> JDKs 1.2, 1.3 and 1.4 work.

Thanks for that.

>
> I noticed that the version using Launcher seems to be incredibly slow

Yes, I have noticed it too and have some improvements in mind (Not opening
and closing zip files repeatedly - pretty brain dead currently). I'll do
that in the next few days.

>
> PS: Any idea why I need to bootstrap Ant whenever I change
> AntClassLoader?  Otherwise I'll get
>

No - I haven't any problems on NT/JDK 1.3

Conor



Re: New launcher

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 18 Jul 2001, Conor MacNeill <co...@cortexebusiness.com.au>
wrote:

> I have committed some improvements to the classloader. Can you retry
> and see what is the performance differential? On NT, it is now only
> marginally slower.

On Linux as well, times are about 10% longer than "normal" Ant
invocation (which is a big improvement over yesterday).

>> Removing the xml libs as well as JUnit from the lib dir and putting
>> them into the CLASSPATH (with my patch applied):
>>
>>     [junit] java.lang.ClassNotFoundException: org.apache.tools.ant.ZipTest
> 
> Of course, I can't compile the unit tests unless I make this change

OK, using your patch it works for me as well - so we'd need to
document that the system classpath is not included in the non-fork
mode any longer.

Given that I've changed the task to automatically include junit.jar,
optional.jar and ant.jar for the fork mode, we need to find a way to
fix it.

Stefan

Re: New launcher

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
From: "Stefan Bodewig" <bo...@apache.org>
>
> I noticed that the version using Launcher seems to be incredibly slow
> - 53 seconds compared to 24 for plain Ant when running ZipTest in
> JDK 1.1, full testsuite 82 seconds compared to 46 where
> ExecuteWatchdogTest accounts for about 20 seconds in JDK 1.2, other
> figures are similar (with JDK 1.4 being the slowest by far).

I have committed some improvements to the classloader. Can you retry and
see what is the performance differential? On NT, it is now only marginally
slower.

>
> Removing the xml libs as well as JUnit from the lib dir and putting
> them into the CLASSPATH (with my patch applied):
>
>     [junit] Testsuite: org.apache.tools.ant.ZipTest
>     [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
>     [junit]
>     [junit] Caused an ERROR
>     [junit] org.apache.tools.ant.ZipTest
>     [junit] java.lang.ClassNotFoundException:
org.apache.tools.ant.ZipTest
>     [junit] at
org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.ja
va, Compiled Code)
>
> or whatever testcase I try - seems it doesn't use the user specified
> classpath any longer.  I'll dig a little deeper.
>

I didn't have these problems. I'll try to look into building on my Linux
box. Of course, I can't compile the unit tests unless I make this change

Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/build.xml,v
retrieving revision 1.160
diff -u -w -r1.160 build.xml
--- build.xml   2001/07/12 07:09:08     1.160
+++ build.xml   2001/07/18 10:05:53
@@ -58,6 +58,7 @@
   <path id="tests-classpath">
     <pathelement location="${build.classes}" />
     <pathelement location="${build.tests}" />
+    <pathelement location="lib/optional/junit.jar" />
     <path refid="classpath" />
   </path>


Also, I can't compile many Ant classes using the launcher as they require
the XML classes, and some classes from tools.jar and these are no longer in
the standard classpath. It would probably be good to make the compile
classpath in the Ant build.xml file explicit.

Conor






Re: New launcher

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 17 Jul 2001, Conor MacNeill <co...@cortexebusiness.com.au>
wrote:

> A similar script for Unix should be obvious.

I've attached mine.

> I haven't tested on Linux yet.

Tested with the following JDKs Blackdown's 1.1.8, Sun's 1.2.2 and
1.4beta-b65 and IBM's 1.3.  I've run the test target of Ant's own
build file.

With jaxp 1.1 and crimson in /tmp/ant_home/lib and a clean environment
- no CLASSPATH, no JAVA_HOME, no ANT_HOME):

JDK 1.1 fails, but fails for plain Ant as well, in JUnitTestRunnerTest
(will have to look into this separately) - works fine for ZipTest.

JDKs 1.2, 1.3 and 1.4 work.

I noticed that the version using Launcher seems to be incredibly slow
- 53 seconds compared to 24 for plain Ant when running ZipTest in 
JDK 1.1, full testsuite 82 seconds compared to 46 where
ExecuteWatchdogTest accounts for about 20 seconds in JDK 1.2, other
figures are similar (with JDK 1.4 being the slowest by far).

Removing the xml libs as well as JUnit from the lib dir and putting
them into the CLASSPATH (with my patch applied):

    [junit] Testsuite: org.apache.tools.ant.ZipTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] 
    [junit] 	Caused an ERROR
    [junit] org.apache.tools.ant.ZipTest
    [junit] java.lang.ClassNotFoundException: org.apache.tools.ant.ZipTest
    [junit] 	at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java, Compiled Code)

or whatever testcase I try - seems it doesn't use the user specified
classpath any longer.  I'll dig a little deeper.

Stefan

PS: Any idea why I need to bootstrap Ant whenever I change
AntClassLoader?  Otherwise I'll get

Exception in thread "main" java.lang.VerifyError: (class: org/apache/tools/ant/AntClassLoader, method: findClassInComponents signature: (Ljava/lang/String;)Ljava/lang/Class;) Accessing value from uninitialized register 7
	at org.apache.tools.ant.Launcher.main(Launcher.java, Compiled Code)
 
or

java.lang.VerifyError: (class: org/apache/tools/ant/AntClassLoader, method: findClassInComponents signature: (Ljava/lang/String;)Ljava/lang/Class;) Accessing value from uninitialized localvariable 7
	at org.apache.tools.ant.taskdefs.Available.execute(Available.java:148)