[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ant-dev
Subject:    RE: Platform independend classpath in build.xml?
From:       Jean-Noel Gadreau <jngadreau () activcard ! com>
Date:       2000-05-31 16:13:49
[Download RAW message or body]

I am still new to Ant, so I did not know about these classes. Sounds good. I
will try to have a look at it when I have some more time.

Thanks
Jean-Noel

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@bost.de]
Sent: Wednesday, May 31, 2000 6:11 AM
To: ant-dev@jakarta.apache.org
Subject: Re: Platform independend classpath in build.xml?


>>>>> "JG" == Jean-Noel Gadreau <jngadreau@activcard.com> writes:

 JG> Moreover, I think the same problem will arise for other path
 JG> (like for .DLL or .so needed by some JNI classes for
 JG> instance). How about defining a task that is able to add path to
 JG> a list in a crossplatform way, which would not be limited just to
 JG> CLASSPATH. This way, if you need to specify PATH (to find a tool
 JG> or something), we could use the same class.

Please let's not reinvent the wheel. Thomas Haas has built what you're
describing and has sent it as part of our JUnit task.

The current implementation consists of two classes Path and
PathElement. Citing from his javadocs - deHTMLed for readability:

/**
 * This object represents a path as used by CLASSPATH or PATH
 * environment variable.
 *
 * It consists of a list of <code>PathElement</code> and <code>Path</code>
 * objects. It is used to represent a classpath or path like nested
parameters
 * in task definitions:
 *
 * <code>
 * <sometask><br>
 *   <somepath>
 *     <element location="/path/to/file.jar" />
 *     <element path="/path/to/file2.jar:/path/to/class2;/path/to/class3" />
 *     <element location="/path/to/file3.jar" />
 *     <element location="/path/to/file4.jar" />
 *   </somepath>
 * </sometask><br>
 * </code> 
 *
 * The object implemention <code>sometask</code> must provide a method
called
 * <code>createSomepath</code> which returns an instance of
<code>Path</code>.
 * Nested path definitions are handled by the Path object and must be
labeled
 * <code>path</code>.<p>
 *
 * The path element takes a parameter <code>path</code> which will be parsed
 * and split into <code>PathElement</code> objects. It will usually be used
 * to define a path from an environment variable.
 *
 * @author Thomas.Haas@softwired-inc.com
 */

This class takes care of all the platform dependent stuff.

using this and nested elements wherever path like structures are
needed should suffice.

Thomas is on vacation AFAIK but I hope he will get back to this
soon. Thomas is a commiter so he can make these changes quicker than I
could put together the necessary patch.

Stefan

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2448.0">
<TITLE>RE: Platform independend classpath in build.xml?</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>I am still new to Ant, so I did not know about these classes. Sounds \
good. I will try to have a look at it when I have some more time.</FONT></P>

<P><FONT SIZE=2>Thanks</FONT>
<BR><FONT SIZE=2>Jean-Noel</FONT>
</P>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Stefan Bodewig [<A \
HREF="mailto:bodewig@bost.de">mailto:bodewig@bost.de</A>]</FONT> <BR><FONT \
SIZE=2>Sent: Wednesday, May 31, 2000 6:11 AM</FONT> <BR><FONT SIZE=2>To: \
ant-dev@jakarta.apache.org</FONT> <BR><FONT SIZE=2>Subject: Re: Platform independend \
classpath in build.xml?</FONT> </P>
<BR>

<P><FONT SIZE=2>&gt;&gt;&gt;&gt;&gt; &quot;JG&quot; == Jean-Noel Gadreau \
&lt;jngadreau@activcard.com&gt; writes:</FONT> </P>

<P><FONT SIZE=2>&nbsp;JG&gt; Moreover, I think the same problem will arise for other \
path</FONT> <BR><FONT SIZE=2>&nbsp;JG&gt; (like for .DLL or .so needed by some JNI \
classes for</FONT> <BR><FONT SIZE=2>&nbsp;JG&gt; instance). How about defining a task \
that is able to add path to</FONT> <BR><FONT SIZE=2>&nbsp;JG&gt; a list in a \
crossplatform way, which would not be limited just to</FONT> <BR><FONT \
SIZE=2>&nbsp;JG&gt; CLASSPATH. This way, if you need to specify PATH (to find a \
tool</FONT> <BR><FONT SIZE=2>&nbsp;JG&gt; or something), we could use the same \
class.</FONT> </P>

<P><FONT SIZE=2>Please let's not reinvent the wheel. Thomas Haas has built what \
you're</FONT> <BR><FONT SIZE=2>describing and has sent it as part of our JUnit \
task.</FONT> </P>

<P><FONT SIZE=2>The current implementation consists of two classes Path and</FONT>
<BR><FONT SIZE=2>PathElement. Citing from his javadocs - deHTMLed for \
readability:</FONT> </P>

<P><FONT SIZE=2>/**</FONT>
<BR><FONT SIZE=2>&nbsp;* This object represents a path as used by CLASSPATH or \
PATH</FONT> <BR><FONT SIZE=2>&nbsp;* environment variable.</FONT>
<BR><FONT SIZE=2>&nbsp;*</FONT>
<BR><FONT SIZE=2>&nbsp;* It consists of a list of \
&lt;code&gt;PathElement&lt;/code&gt; and &lt;code&gt;Path&lt;/code&gt;</FONT> \
<BR><FONT SIZE=2>&nbsp;* objects. It is used to represent a classpath or path like \
nested parameters</FONT> <BR><FONT SIZE=2>&nbsp;* in task definitions:</FONT>
<BR><FONT SIZE=2>&nbsp;*</FONT>
<BR><FONT SIZE=2>&nbsp;* &lt;code&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;* &lt;sometask&gt;&lt;br&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;*&nbsp;&nbsp; &lt;somepath&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; &lt;element \
location=&quot;/path/to/file.jar&quot; /&gt;</FONT> <BR><FONT \
SIZE=2>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; &lt;element \
path=&quot;/path/to/file2.jar:/path/to/class2;/path/to/class3&quot; /&gt;</FONT> \
<BR><FONT SIZE=2>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; &lt;element \
location=&quot;/path/to/file3.jar&quot; /&gt;</FONT> <BR><FONT \
SIZE=2>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; &lt;element \
location=&quot;/path/to/file4.jar&quot; /&gt;</FONT> <BR><FONT \
SIZE=2>&nbsp;*&nbsp;&nbsp; &lt;/somepath&gt;</FONT> <BR><FONT SIZE=2>&nbsp;* \
&lt;/sometask&gt;&lt;br&gt;</FONT> <BR><FONT SIZE=2>&nbsp;* &lt;/code&gt; </FONT>
<BR><FONT SIZE=2>&nbsp;*</FONT>
<BR><FONT SIZE=2>&nbsp;* The object implemention &lt;code&gt;sometask&lt;/code&gt; \
must provide a method called</FONT> <BR><FONT SIZE=2>&nbsp;* \
&lt;code&gt;createSomepath&lt;/code&gt; which returns an instance of \
&lt;code&gt;Path&lt;/code&gt;.</FONT> <BR><FONT SIZE=2>&nbsp;* Nested path \
definitions are handled by the Path object and must be labeled</FONT> <BR><FONT \
SIZE=2>&nbsp;* &lt;code&gt;path&lt;/code&gt;.&lt;p&gt;</FONT> <BR><FONT \
SIZE=2>&nbsp;*</FONT> <BR><FONT SIZE=2>&nbsp;* The path element takes a parameter \
&lt;code&gt;path&lt;/code&gt; which will be parsed</FONT> <BR><FONT SIZE=2>&nbsp;* \
and split into &lt;code&gt;PathElement&lt;/code&gt; objects. It will usually be \
used</FONT> <BR><FONT SIZE=2>&nbsp;* to define a path from an environment \
variable.</FONT> <BR><FONT SIZE=2>&nbsp;*</FONT>
<BR><FONT SIZE=2>&nbsp;* @author Thomas.Haas@softwired-inc.com</FONT>
<BR><FONT SIZE=2>&nbsp;*/</FONT>
</P>

<P><FONT SIZE=2>This class takes care of all the platform dependent stuff.</FONT>
</P>

<P><FONT SIZE=2>using this and nested elements wherever path like structures \
are</FONT> <BR><FONT SIZE=2>needed should suffice.</FONT>
</P>

<P><FONT SIZE=2>Thomas is on vacation AFAIK but I hope he will get back to \
this</FONT> <BR><FONT SIZE=2>soon. Thomas is a commiter so he can make these changes \
quicker than I</FONT> <BR><FONT SIZE=2>could put together the necessary patch.</FONT>
</P>

<P><FONT SIZE=2>Stefan</FONT>
</P>

</BODY>
</HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic