You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Thomas Haas <th...@softwired-inc.com> on 2000/04/05 13:38:20 UTC

[PATCH]: nested Classpath definitions

Dear Committer

The nested classpath definition got votes. My response to one question
asked did not get any follow ups, therefor I beleive it is time to
include this into ANT. Below you find a description what this patch is
all about.

After this patch has been commited, I hope some volunters will help
adding the feature to the tasks using classpath definitions. I'll
certainly help, but the JUnit task got higher priority right now.

Thank you

- tom

DESCRPTION
==========


What
===
An XML definiton using nested classpath definitions looks like the
following:

<sometask>
    <somepath>
        <path defintion="/some/dir;/some/fil.jar:/some/other/path" />
        <element location="/a/file.jar" />
        <element location="/a/path" />
        <path
definition="/another/path/classes:/mor/classes;/another/file.jar" />
    </somepath>
</sometask>

In a task "sometask" define a classpath callled "somepath". A classpath
consists of any numbers of "element" and "path" element definitions. An
element adds a single location either file or directory. A path adds a
list of locations described by a string using the separators ";" and
":". Path definitions use th code from Project.translatePath to parse
and split the definitions. There primary use is the inclusion of some
predefined classpath property (like the CLASSPATH environment variable
or other).

Elements and Pathes are distinguished to allow the developer clearly
express, if she adds a single location or a predefined and to be parsed
list of locations to the classpath defintion in any sequence she may
wishes.


Why
===
Stefan Bodewig <bo...@bost.de> and I are currently developing a target
to run unit tests using the JUnit framework. We wanted to provide nested
classpath definitions. As other task could reuse our work, I want first
to make shure, everyone agrees on how it is done, so it can go in
together with the JUnit task.

The JavaC, Javadoc and Java task would profit immediatly from this work.


How
===
Sometask must provide a method creatSomepath which returns an instance
of Path. The Path object implements the createPath (whic returns this),
setLocation and createElement methods.
setLocation uses Path.translatePath to parse the given argument.
createElement returns an instance of PathElement, which provides the
setLocation method to add a location to the classpath definition.
The classpath definition is stored as a list of File objects, which is
build by the setLocation and SetDefintion methods.


- tom

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