ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Tulley" <JTUL...@novell.com>
Subject Re: Refactor of PathTokenizer - am I missing something?
Date Fri, 04 Jan 2002 01:25:20 GMT
Actually I meant <javac>, sorry.
I've boiled it down to the following XML (pared down from my 2400 line
build file):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>

<project default="main" name="test">
  <target name="main" 
	  depends="compile-classes"
	  description="Compile all source files."/>

  <target name="init" >
    <property name="module.root" value="${basedir}"/>
    <property name="module.source" value="${module.root}/src"/>
    <property name="source.java" value="${module.source}/main"/>
    <property name="module.output" value="${module.root}/output"/>
    <property name="build.classes" value="${module.output}/classes"/>
  </target>

  <!-- Compile all class files -->
  <target name="compile-classes" depends="init">

    <mkdir dir="${build.classes}"/>
    <javac destdir="${build.classes}"
           optimize="${javac.optimize}"
	   target="${javac.target}"
           debug="${javac.debug}"
	   depend="${javac.depend}"
	   verbose="${javac.verbose}"
	   deprecation="${javac.deprecation}"
	   includeAntRuntime="${javac.include.ant.runtime}"
	   includeJavaRuntime="${javac.include.java.runtime}"
	   failonerror="${javac.fail.onerror}">
       <src path="${source.java}"/>
       <classpath refid="javac.classpath"/>
       <include name="${javac.includes}"/>
       <exclude name="${javac.excludes}"/>
    </javac>
  </target>
</project>

Nothing here uses any explicitly defined path, everything is relative
to ${basedir}.
I'm not sure if the UNIX-like path support on NetWare is exposed to the
JVM or not.  It is definitely not a often used feature, and one that you
have to explicitly enable(and I'm not sure at what cost).  

I'm not sure if the explicit search for a semi-colon at class
construction time will do the trick or not.  I have not narrowed down if
there is indeed more than one element in the path at the time or not. 
I'll stick your code in and see how it holds up against the unit tests
(with the additions I made recently).

Jeff Tulley  (jtulley@novell.com)
(801)861-5322
Novell, Inc., the leading provider of Net services software.

>>> billb@progress.com 1/3/02 6:06:34 PM >>>
Hi Jeff,

I think I now have a better understanding of the problem ...

Jeff Tulley wrote:
> 
> Bill,
>     One thing that you are missing here is the fact that it is not a
> build file directly that is triggering this problem, at least not in
the
> sense of the <path>, <classpath>,  and <pathelement> tags.  What is
> actually giving me grief is a <javadoc> task that uses
PathTokenizer.

Okay, I didn't realize <javadoc> was the culprit.

>     It seems that I should support UNIX path names, since our OS has
a
> file mode that would allow you to reference our volumes in a
UNIX-like
> manner.  (instead of sys:/temp, it would be /sys/temp, if I am not
> mistaken).

Okay, I didn't realize you could specify a NetWare volume with
/vol/path
syntax.  I'm assuming that's exposed to the JVM?

Here's another take at the problem.  Both ";" and ":" are supported
depending on whether a ";" is found anywhere in the path but not both
together.  Of course, the one limitation is the assumption that a
filename
or directory can't contain a ";":

    public PathTokenizer(String path) {
        String tokens = ":;";
        // When running under NetWare, look for a ";" anywhere in the
path.  If not
        // found, assume a UNIX style path and use ":", otherwise use
";"
as the
        // delimiter.
        if ( null != path && Os.isFamily("netware") ) {
            tokens = ( path.indexOf(';') == -1 ) ? ":" : ";";
        }
        tokenizer = new StringTokenizer(path, tokens, false);
        dosStyleFilesystem = File.pathSeparatorChar == ';';
    }

All of the following paths should be tokenized properly:
    sys:/temp;sys:\public
    temp;public
    /sys/temp:/sys/public
    ./temp:./public

Hope this helps,
-Bill

--
To unsubscribe, e-mail:  
<mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:ant-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message