ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Haas <thomas.h...@softwired-inc.com>
Subject Proposal: Enhanced Exec and Java tasks
Date Wed, 05 Apr 2000 13:22:40 GMT
Hi

In order to build the JUnit task I felt the need for more flexible Java
and Exec tasks.

Motivation:
The Java and Exec task did not offer everything I wanted/needed.
Extending Java was in one case not possible, as MatchingTask was already
extended. Using Java was not possible, as it class
project.translatePath. project coudl not be set as it is private in
Task. As other Task reimplemented some features of Exec/Java themselves,
I thought a generilzed more feature rich class implementing the features
of Java/Exec are a real added value to ant.


The following features are mostly implemented:


   * Everything implemented as standlone classes. All functionality can
     be reused in every task needing to spwan a process or run a class
     in a seperate VM (remove duplicated code from Jikes, Javadoc,
     Javac).
   * Backwards compatibility with existing Exec/Java task specification
     possible
   * A lot of Copy/Paste reuse of existing code (thanks to the authors
     of Javac/Exec)
   * Nested commandline specification:

<exec executable="myapp" >
    <argument value="argument one for myapp" />
    <argument value="argument two for myapp" />
    <argument line="predefined commandline argument to be split into
arguments" />
    <argument value="last argument for myapp" />
</exec>

   * Use Runtime.exec(String[]) instead of Runtime.exec(String): no need
     for parsing commandline arguments, no problems with arguments
     containing whitespaces.
   * Throws a BuildException, if exit value is non zero (TODO: make this
     feature configurable).
   * Timeout option to kill processes, which do not stop in time.
   * Configurable System.out/System.err redirection: to ANT log, to
     system.out/.err or to file are all implemented. Add your own as
     needed.
   * Does not need external run script, unless different directory to
     run process in is desired.

In addition the Java task features:

   * Nested commandline arguments:

<java vm="myvm" classname="myclass" fork="on" >
    <classpath> ... </classpath>
    <vmarg value="vm arg one" />
    <vmarg value="vm arg two" />
    <vmarg line="vm arguments to be parsed" />
    <argument value="arg one for myclass" />
    <argument line="arguments to be parsed" />
    <argument value="arg two for myclass" />
</java>

   * All vm Parameters only available, if fork is on.

Your vote counts!!
The classes implementing the features can be added to ant without
modifying Java.java or Exec.java, as they are standalone classes.
Therefor I would like to know:

  1. wheter you like the funtionality and that it should be added to
     ant.
  2. what is missing or simply wrong in the above description of the
     features provided.
  3. Exec and Java should be modified to use all this.

Show me the code first!
All above is used in the current JUnit implementation. Preliminary code
will be posted some day this week or upon request immediatly.


Thank you
- tom

--
* Thomas Haas             <mailto:thomas.haas@softwired-inc.com>
* SoftWired AG                   <http://www.softwired-inc.com/>
* Technoparkstr. 1  ***  CH-8005 Zurich  ***  +41-1-4452370



Mime
View raw message