- *
- * In this situation, the if-modified-since header is set so that the file
- * is only fetched if it is newer than the local file (or there is no local
- * file) This flag is only valid on HTTP connections, it is ignored in other
- * cases. When the flag is set, the local copy of the downloaded file will
- * also have its timestamp set to the remote file time.
- * Note that remote files of date 1/1/1970 (GMT) are treated as 'no
- * timestamp', and web servers often serve files with a timestamp in the
- * future by replacing their timestamp with that of the current time. Also,
- * inter-computer clock differences can cause no end of grief.
- *
- * @param v "true" to enable file time fetching
- */
- public void setUseTimestamp( boolean v )
- {
- useTimestamp = v;
- }
-
- /**
- * Username for basic auth.
- *
- * @param u username for authentication
- */
- public void setUsername( String u )
- {
- this.uname = u;
- }
-
- /**
- * Be verbose, if set to "true
".
- *
- * @param v if "true" then be verbose
- */
- public void setVerbose( boolean v )
- {
- verbose = v;
- }
-
- /**
- * Does the work.
- *
- * @exception org.apache.myrmidon.api.TaskException Thrown in unrecoverable error.
- */
- public void execute()
- throws TaskException
- {
- if( source == null )
- {
- throw new TaskException( "src attribute is required" );
- }
-
- if( dest == null )
- {
- throw new TaskException( "dest attribute is required" );
- }
-
- if( dest.exists() && dest.isDirectory() )
- {
- throw new TaskException( "The specified destination is a directory" );
- }
-
- if( dest.exists() && !dest.canWrite() )
- {
- throw new TaskException( "Can't write to " + dest.getAbsolutePath() );
- }
-
- try
- {
- getContext().info( "Getting: " + source );
-
- //set the timestamp to the file date.
- long timestamp = 0;
-
- boolean hasTimestamp = false;
- if( useTimestamp && dest.exists() )
- {
- timestamp = dest.lastModified();
- if( verbose )
- {
- Date t = new Date( timestamp );
- getContext().verbose( "local file date : " + t.toString() );
- }
-
- hasTimestamp = true;
- }
-
- //set up the URL connection
- URLConnection connection = source.openConnection();
- //modify the headers
- //NB: things like user authentication could go in here too.
- if( useTimestamp && hasTimestamp )
- {
- connection.setIfModifiedSince( timestamp );
- }
- // prepare Java 1.1 style credentials
- if( uname != null || pword != null )
- {
- String up = uname + ":" + pword;
- String encoding;
- // check to see if sun's Base64 encoder is available.
- try
- {
- sun.misc.BASE64Encoder encoder =
- (sun.misc.BASE64Encoder)Class.forName( "sun.misc.BASE64Encoder" ).newInstance();
- encoding = encoder.encode( up.getBytes() );
-
- }
- catch( Exception ex )
- {// sun's base64 encoder isn't available
- Base64Converter encoder = new Base64Converter();
- encoding = encoder.encode( up.getBytes() );
- }
- connection.setRequestProperty( "Authorization", "Basic " + encoding );
- }
-
- //connect to the remote site (may take some time)
- connection.connect();
- //next test for a 304 result (HTTP only)
- if( connection instanceof HttpURLConnection )
- {
- HttpURLConnection httpConnection = (HttpURLConnection)connection;
- if( httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED )
- {
- //not modified so no file download. just return instead
- //and trace out something so the user doesn't think that the
- //download happened when it didnt
- getContext().verbose( "Not modified - so not downloaded" );
- return;
- }
- // test for 401 result (HTTP only)
- if( httpConnection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED )
- {
- getContext().info( "Not authorized - check " + dest + " for details" );
- return;
- }
-
- }
-
- //REVISIT: at this point even non HTTP connections may support the if-modified-since
- //behaviour -we just check the date of the content and skip the write if it is not
- //newer. Some protocols (FTP) dont include dates, of course.
-
- FileOutputStream fos = new FileOutputStream( dest );
-
- InputStream is = null;
- for( int i = 0; i < 3; i++ )
- {
- try
- {
- is = connection.getInputStream();
- break;
- }
- catch( IOException ex )
- {
- getContext().info( "Error opening connection " + ex );
- }
- }
- if( is == null )
- {
- getContext().info( "Can't get " + source + " to " + dest );
- if( ignoreErrors )
- {
- return;
- }
- throw new TaskException( "Can't get " + source + " to " + dest );
- }
-
- byte[] buffer = new byte[ 100 * 1024 ];
- int length;
-
- while( ( length = is.read( buffer ) ) >= 0 )
- {
- fos.write( buffer, 0, length );
- if( verbose )
- {
- System.out.print( "." );
- }
- }
- if( verbose )
- {
- System.out.println();
- }
- fos.close();
- is.close();
-
- //if (and only if) the use file time option is set, then the
- //saved file now has its timestamp set to that of the downloaded file
- if( useTimestamp )
- {
- long remoteTimestamp = connection.getLastModified();
- if( verbose )
- {
- Date t = new Date( remoteTimestamp );
- getContext().verbose( "last modified = " + t.toString()
- + ( ( remoteTimestamp == 0 ) ? " - using current time instead" : "" ) );
- }
-
- if( remoteTimestamp != 0 )
- {
- dest.setLastModified( remoteTimestamp );
- }
- }
- }
- catch( IOException ioe )
- {
- getContext().info( "Error getting " + source + " to " + dest );
- if( ignoreErrors )
- {
- return;
- }
- throw new TaskException( "Error", ioe );
- }
- }
-
- /**
- * BASE 64 encoding of a String or an array of bytes. Based on RFC 1421.
- *
- * @author Unknown
- * @author Gautam Guliani
- */
-
- class Base64Converter
- {
-
- public final char[] alphabet = {
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 to 7
- 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 8 to 15
- 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 16 to 23
- 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 24 to 31
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 32 to 39
- 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 40 to 47
- 'w', 'x', 'y', 'z', '0', '1', '2', '3', // 48 to 55
- '4', '5', '6', '7', '8', '9', '+', '/'};// 56 to 63
-
- public String encode( String s )
- {
- return encode( s.getBytes() );
- }
-
- public String encode( byte[] octetString )
- {
- int bits24;
- int bits6;
-
- char[] out
- = new char[ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];
-
- int outIndex = 0;
- int i = 0;
-
- while( ( i + 3 ) <= octetString.length )
- {
- // store the octets
- bits24 = ( octetString[ i++ ] & 0xFF ) << 16;
- bits24 |= ( octetString[ i++ ] & 0xFF ) << 8;
-
- bits6 = ( bits24 & 0x00FC0000 ) >> 18;
- out[ outIndex++ ] = alphabet[ bits6 ];
- bits6 = ( bits24 & 0x0003F000 ) >> 12;
- out[ outIndex++ ] = alphabet[ bits6 ];
- bits6 = ( bits24 & 0x00000FC0 ) >> 6;
- out[ outIndex++ ] = alphabet[ bits6 ];
- bits6 = ( bits24 & 0x0000003F );
- out[ outIndex++ ] = alphabet[ bits6 ];
- }
-
- if( octetString.length - i == 2 )
- {
- // store the octets
- bits24 = ( octetString[ i ] & 0xFF ) << 16;
- bits24 |= ( octetString[ i + 1 ] & 0xFF ) << 8;
- bits6 = ( bits24 & 0x00FC0000 ) >> 18;
- out[ outIndex++ ] = alphabet[ bits6 ];
- bits6 = ( bits24 & 0x0003F000 ) >> 12;
- out[ outIndex++ ] = alphabet[ bits6 ];
- bits6 = ( bits24 & 0x00000FC0 ) >> 6;
- out[ outIndex++ ] = alphabet[ bits6 ];
-
- // padding
- out[ outIndex++ ] = '=';
- }
- else if( octetString.length - i == 1 )
- {
- // store the octets
- bits24 = ( octetString[ i ] & 0xFF ) << 16;
- bits6 = ( bits24 & 0x00FC0000 ) >> 18;
- out[ outIndex++ ] = alphabet[ bits6 ];
- bits6 = ( bits24 & 0x0003F000 ) >> 12;
- out[ outIndex++ ] = alphabet[ bits6 ];
-
- // padding
- out[ outIndex++ ] = '=';
- out[ outIndex++ ] = '=';
- }
-
- return new String( out );
- }
- }
-}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/IContract.java b/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/IContract.java
deleted file mode 100644
index 72805db02..000000000
--- a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/IContract.java
+++ /dev/null
@@ -1,1061 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.tools.todo.taskdefs;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.Date;
-import java.util.Properties;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.listeners.AbstractProjectListener;
-import org.apache.myrmidon.listeners.LogEvent;
-import org.apache.tools.todo.taskdefs.javac.DefaultCompilerAdapter;
-import org.apache.tools.todo.taskdefs.javac.Javac;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.myrmidon.framework.file.Path;
-import org.apache.myrmidon.framework.file.FileListUtil;
-import org.apache.antlib.java.JavaTask;
-
-/**
- * Instruments Java classes with
- * iContract DBC preprocessor.
- * The task can generate a properties file for iControl , a graphical
- * user interface that lets you turn on/off assertions. iControl generates a
- * control file that you can refer to from this task using the controlfile
- * attribute.
- *
- *
- *
- *
- * Attribute
- *
- *
- *
- * Description
- *
- *
- *
- * Required
- *
- *
- *
- *
- *
- *
- *
- * srcdir
- *
- *
- *
- * Location of the java files.
- *
- *
- *
- * Yes
- *
- *
- *
- *
- *
- *
- *
- * instrumentdir
- *
- *
- *
- * Indicates where the instrumented source files should go.
- *
- *
- *
- * Yes
- *
- *
- *
- *
- *
- *
- *
- * repositorydir
- *
- *
- *
- * Indicates where the repository source files should go.
- *
- *
- *
- * Yes
- *
- *
- *
- *
- *
- *
- *
- * builddir
- *
- *
- *
- * Indicates where the compiled instrumented classes should go.
- * Defaults to the value of instrumentdir. NOTE: Don't
- * use the same directory for compiled instrumented classes and
- * uninstrumented classes. It will break the dependency checking.
- * (Classes will not be reinstrumented if you change them).
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * repositorybuilddir
- *
- *
- *
- * Indicates where the compiled repository classes should go.
- * Defaults to the value of repositorydir.
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * pre
- *
- *
- *
- * Indicates whether or not to instrument for preconditions. Defaults
- * to true
unless controlfile is specified, in which
- * case it defaults to false
.
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * post
- *
- *
- *
- * Indicates whether or not to instrument for postconditions.
- * Defaults to true
unless controlfile is specified, in
- * which case it defaults to false
.
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * invariant
- *
- *
- *
- * Indicates whether or not to instrument for invariants. Defaults to
- * true
unless controlfile is specified, in which case
- * it defaults to false
.
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * failthrowable
- *
- *
- *
- * The full name of the Throwable (Exception) that should be thrown
- * when an assertion is violated. Defaults to java.lang.Error
- *
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * verbosity
- *
- *
- *
- * Indicates the verbosity level of iContract. Any combination of
- * error*,warning*,note*,info*,progress*,debug*
(comma
- * separated) can be used. Defaults to error*
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * quiet
- *
- *
- *
- * Indicates if iContract should be quiet. Turn it off if many your
- * classes extend uninstrumented classes and you don't want warnings
- * about this. Defaults to false
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * updateicontrol
- *
- *
- *
- * If set to true, it indicates that the properties file for iControl
- * in the current directory should be updated (or created if it
- * doesn't exist). Defaults to false
.
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * controlfile
- *
- *
- *
- * The name of the control file to pass to iContract. Consider using
- * iControl to generate the file. Default is not to pass a file.
- *
- *
- *
- *
- * Only if updateicontrol=true
- *
- *
- *
- *
- *
- *
- *
- * classdir
- *
- *
- *
- * Indicates where compiled (unistrumented) classes are located. This
- * is required in order to properly update the icontrol.properties
- * file, not for instrumentation.
- *
- *
- *
- * Only if updateicontrol=true
- *
- *
- *
- *
- *
- *
- *
- * targets
- *
- *
- *
- * Name of the file that will be generated by this task, which lists
- * all the classes that iContract will instrument. If specified, the
- * file will not be deleted after execution. If not specified, a file
- * will still be created, but it will be deleted after execution.
- *
- *
- *
- *
- * No
- *
- *
- *
- *
- *
- *
- *
- * Note: iContract will use the java compiler indicated by the
- * project's build.compiler
property. See documentation of the
- * Javac task for more information.
- *
- * Nested includes and excludes are also supported.
- *
- * Example:
- * <icontract
- * srcdir="${build.src}"
- * instrumentdir="${build.instrument}"
- * repositorydir="${build.repository}"
- * builddir="${build.instrclasses}"
- * updateicontrol="true"
- * classdir="${build.classes}"
- * controlfile="control"
- * targets="targets"
- * verbosity="error*,warning*"
- * quiet="true"
- * >
- * <classpath refid="compile-classpath"/>
- * </icontract>
- *
- */
-public class IContract extends MatchingTask
-{
- private final static String ICONTROL_PROPERTIES_HEADER =
- " You might want to set classRoot to point to your normal compilation class root directory.";
-
- /**
- * compiler to use for instrumenation
- */
- private String icCompiler = "javac";
-
- /**
- * temporary file with file names of all java files to be instrumented
- */
- private File targets = null;
-
- /**
- * will be set to true if any of the sourca files are newer than the
- * instrumented files
- */
- private boolean dirty = false;
-
- /**
- * set to true if the iContract jar is missing
- */
- private boolean iContractMissing = false;
-
- /**
- * source file root
- */
- private File srcDir = null;
-
- /**
- * instrumentation src root
- */
- private File instrumentDir = null;
-
- /**
- * instrumentation build root
- */
- private File buildDir = null;
-
- /**
- * repository src root
- */
- private File repositoryDir = null;
-
- /**
- * repository build root
- */
- private File repBuildDir = null;
-
- /**
- * classpath
- */
- private Path classpath = null;
-
- /**
- * The class of the Throwable to be thrown on failed assertions
- */
- private String failThrowable = "java.lang.Error";
-
- /**
- * The -v option
- */
- private String verbosity = "error*";
-
- /**
- * The -q option
- */
- private boolean quiet = false;
-
- /**
- * The -m option
- */
- private File controlFile = null;
-
- /**
- * Indicates whether or not to instrument for preconditions
- */
- private boolean pre = true;
- private boolean preModified = false;
-
- /**
- * Indicates whether or not to instrument for postconditions
- */
- private boolean post = true;
- private boolean postModified = false;
-
- /**
- * Indicates whether or not to instrument for invariants
- */
- private boolean invariant = true;
- private boolean invariantModified = false;
-
- /**
- * Indicates whether or not to instrument all files regardless of timestamp
- */
- // can't be explicitly set, is set if control file exists and is newer than any source file
- private boolean instrumentall = false;
-
- /**
- * Indicates the name of a properties file (intentionally for iControl)
- * where the classpath property should be updated.
- */
- private boolean updateIcontrol = false;
-
- /**
- * Regular compilation class root
- */
- private File classDir = null;
-
- /**
- * Sets the build directory for instrumented classes
- *
- * @param buildDir the build directory
- */
- public void setBuilddir( File buildDir )
- {
- this.buildDir = buildDir;
- }
-
- /**
- * Sets the class directory (uninstrumented classes)
- *
- * @param classDir The new Classdir value
- */
- public void setClassdir( File classDir )
- {
- this.classDir = classDir;
- }
-
- /**
- * Sets the classpath to be used for invocation of iContract.
- *
- * @param path The new Classpath value
- * @path the classpath
- */
- public void setClasspath( final Path path )
- {
- createClasspath().add( path );
- }
-
- /**
- * Sets the control file to pass to iContract.
- *
- * @param controlFile the control file
- */
- public void setControlfile( File controlFile )
- {
- if( !controlFile.exists() )
- {
- getContext().info( "WARNING: Control file " + controlFile.getAbsolutePath() + " doesn't exist. iContract will be run without control file." );
- }
- this.controlFile = controlFile;
- }
-
- /**
- * Sets the Throwable (Exception) to be thrown on assertion violation
- *
- * @param clazz the fully qualified Throwable class name
- */
- public void setFailthrowable( String clazz )
- {
- this.failThrowable = clazz;
- }
-
- /**
- * Sets the instrumentation directory
- *
- * @param instrumentDir the source directory
- */
- public void setInstrumentdir( File instrumentDir )
- {
- this.instrumentDir = instrumentDir;
- if( this.buildDir == null )
- {
- setBuilddir( instrumentDir );
- }
- }
-
- /**
- * Turns on/off invariant instrumentation
- *
- * @param invariant true turns it on
- */
- public void setInvariant( boolean invariant )
- {
- this.invariant = invariant;
- invariantModified = true;
- }
-
- /**
- * Turns on/off postcondition instrumentation
- *
- * @param post true turns it on
- */
- public void setPost( boolean post )
- {
- this.post = post;
- postModified = true;
- }
-
- /**
- * Turns on/off precondition instrumentation
- *
- * @param pre true turns it on
- */
- public void setPre( boolean pre )
- {
- this.pre = pre;
- preModified = true;
- }
-
- /**
- * Tells iContract to be quiet.
- *
- * @param quiet true if iContract should be quiet.
- */
- public void setQuiet( boolean quiet )
- {
- this.quiet = quiet;
- }
-
- /**
- * Sets the build directory for instrumented classes
- *
- * @param repBuildDir The new Repbuilddir value
- */
- public void setRepbuilddir( File repBuildDir )
- {
- this.repBuildDir = repBuildDir;
- }
-
- /**
- * Sets the build directory for repository classes
- *
- * @param repositoryDir the source directory
- */
- public void setRepositorydir( File repositoryDir )
- {
- this.repositoryDir = repositoryDir;
- if( this.repBuildDir == null )
- {
- setRepbuilddir( repositoryDir );
- }
- }
-
- /**
- * Sets the source directory
- *
- * @param srcDir the source directory
- */
- public void setSrcdir( File srcDir )
- {
- this.srcDir = srcDir;
- }
-
- /**
- * Sets the name of the file where targets will be written. That is the file
- * that tells iContract what files to process.
- *
- * @param targets the targets file name
- */
- public void setTargets( File targets )
- {
- this.targets = targets;
- }
-
- /**
- * Decides whether or not to update iControl properties file
- *
- * @param updateIcontrol true if iControl properties file should be updated
- */
- public void setUpdateicontrol( boolean updateIcontrol )
- {
- this.updateIcontrol = updateIcontrol;
- }
-
- /**
- * Sets the verbosity level of iContract. Any combination of
- * error*,warning*,note*,info*,progress*,debug* (comma separated) can be
- * used. Defaults to error*,warning*
- *
- * @param verbosity verbosity level
- */
- public void setVerbosity( String verbosity )
- {
- this.verbosity = verbosity;
- }
-
- /**
- * Creates a nested classpath element
- *
- * @return the nested classpath element
- */
- public Path createClasspath()
- {
- if( classpath == null )
- {
- classpath = new Path();
- }
- return classpath;
- }
-
- /**
- * Executes the task
- *
- * @exception org.apache.myrmidon.api.TaskException if the instrumentation fails
- */
- public void execute()
- throws TaskException
- {
- preconditions();
- scan();
- if( dirty )
- {
-
- // turn off assertions if we're using controlfile, unless they are not explicitly set.
- boolean useControlFile = ( controlFile != null ) && controlFile.exists();
- if( useControlFile && !preModified )
- {
- pre = false;
- }
- if( useControlFile && !postModified )
- {
- post = false;
- }
- if( useControlFile && !invariantModified )
- {
- invariant = false;
- }
- // issue warning if pre,post or invariant is used together with controlfile
- if( ( pre || post || invariant ) && controlFile != null )
- {
- getContext().info( "WARNING: specifying pre,post or invariant will override control file settings" );
- }
-
-
- // We want to be notified if iContract jar is missing. This makes life easier for the user
- // who didn't understand that iContract is a separate library (duh!)
-
- //addProjectListener( new IContractPresenceDetector() );
-
- // Prepare the directories for iContract. iContract will make them if they
- // don't exist, but for some reason I don't know, it will complain about the REP files
- // afterwards
- instrumentDir.mkdirs();
- buildDir.mkdirs();
- repositoryDir.mkdirs();
-
- // Set the classpath that is needed for regular Javac compilation
- Path baseClasspath = createClasspath();
-
- // Might need to add the core classes if we're not using Sun's Javac (like Jikes)
- String compiler = getContext().getProperty( "build.compiler" ).toString();
- ClasspathHelper classpathHelper = new ClasspathHelper( compiler );
- classpathHelper.modify( baseClasspath );
-
- // Create the classpath required to compile the sourcefiles BEFORE instrumentation
- Path beforeInstrumentationClasspath = new Path();
- beforeInstrumentationClasspath.add( baseClasspath );
- beforeInstrumentationClasspath.addLocation( srcDir );
-
- // Create the classpath required to compile the sourcefiles AFTER instrumentation
- Path afterInstrumentationClasspath = new Path();
- afterInstrumentationClasspath.add( baseClasspath );
- afterInstrumentationClasspath.addLocation( instrumentDir );
- afterInstrumentationClasspath.addLocation( repositoryDir );
- afterInstrumentationClasspath.addLocation( srcDir );
- afterInstrumentationClasspath.addLocation( buildDir );
-
- // Create the classpath required to automatically compile the repository files
- Path repositoryClasspath = new Path();
- repositoryClasspath.add( baseClasspath );
- repositoryClasspath.addLocation( instrumentDir );
- repositoryClasspath.addLocation( srcDir );
- repositoryClasspath.addLocation( repositoryDir );
- repositoryClasspath.addLocation( buildDir );
-
- // Create the classpath required for iContract itself
- Path iContractClasspath = new Path();
- iContractClasspath.add( baseClasspath );
- iContractClasspath.addLocation( new File(System.getProperty( "java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar" ) );
- iContractClasspath.addLocation( srcDir );
- iContractClasspath.addLocation( repositoryDir );
- iContractClasspath.addLocation( instrumentDir );
- iContractClasspath.addLocation( buildDir );
-
- // Create a forked java process
- JavaTask iContract = null;//(Java)getProject().createTask( "java" );
- iContract.setFork( true );
- iContract.setClassname( "com.reliablesystems.iContract.Tool" );
- iContract.setClasspath( iContractClasspath );
-
- // Build the arguments to iContract
- StringBuffer args = new StringBuffer();
- args.append( directiveString() );
- args.append( "-v" ).append( verbosity ).append( " " );
- args.append( "-b" ).append( "\"" ).append( icCompiler ).append( " -classpath " ).append( beforeInstrumentationClasspath ).append( "\" " );
- args.append( "-c" ).append( "\"" ).append( icCompiler ).append( " -classpath " ).append( afterInstrumentationClasspath ).append( " -d " ).append( buildDir ).append( "\" " );
- args.append( "-n" ).append( "\"" ).append( icCompiler ).append( " -classpath " ).append( repositoryClasspath ).append( "\" " );
- args.append( "-d" ).append( failThrowable ).append( " " );
- args.append( "-o" ).append( instrumentDir ).append( File.separator ).append( "@p" ).append( File.separator ).append( "@f.@e " );
- args.append( "-k" ).append( repositoryDir ).append( File.separator ).append( "@p " );
- args.append( quiet ? "-q " : "" );
- args.append( instrumentall ? "-a " : "" );// reinstrument everything if controlFile exists and is newer than any class
- args.append( "@" ).append( targets.getAbsolutePath() );
- iContract.createArg().setLine( args.toString() );
-
- //System.out.println( "JAVA -classpath " + iContractClasspath + " com.reliablesystems.iContract.Tool " + args.toString() );
-
- // update iControlProperties if it's set.
- if( updateIcontrol )
- {
- Properties iControlProps = new Properties();
- try
- {// to read existing propertiesfile
- iControlProps.load( new FileInputStream( "icontrol.properties" ) );
- }
- catch( IOException e )
- {
- getContext().info( "File icontrol.properties not found. That's ok. Writing a default one." );
- }
- iControlProps.setProperty( "sourceRoot", srcDir.getAbsolutePath() );
- iControlProps.setProperty( "classRoot", classDir.getAbsolutePath() );
- final String classpath = FileListUtil.formatPath( afterInstrumentationClasspath, getContext() );
- iControlProps.setProperty( "classpath", classpath );
- iControlProps.setProperty( "controlFile", controlFile.getAbsolutePath() );
- iControlProps.setProperty( "targetsFile", targets.getAbsolutePath() );
-
- try
- {// to read existing propertiesfile
- iControlProps.store( new FileOutputStream( "icontrol.properties" ), ICONTROL_PROPERTIES_HEADER );
- getContext().info( "Updated icontrol.properties" );
- }
- catch( IOException e )
- {
- getContext().info( "Couldn't write icontrol.properties." );
- }
- }
-
- // do it!
- iContract.executeJava();
- }
- else
- {// not dirty
- //log( "Nothing to do. Everything up to date." );
- }
- }
-
- /**
- * Creates the -m option based on the values of controlFile, pre, post and
- * invariant.
- *
- * @return Description of the Returned Value
- */
- private final String directiveString()
- {
- StringBuffer sb = new StringBuffer();
- boolean comma = false;
-
- boolean useControlFile = ( controlFile != null ) && controlFile.exists();
- if( useControlFile || pre || post || invariant )
- {
- sb.append( "-m" );
- }
- if( useControlFile )
- {
- sb.append( "@" ).append( controlFile );
- comma = true;
- }
- if( pre )
- {
- if( comma )
- {
- sb.append( "," );
- }
- sb.append( "pre" );
- comma = true;
- }
- if( post )
- {
- if( comma )
- {
- sb.append( "," );
- }
- sb.append( "post" );
- comma = true;
- }
- if( invariant )
- {
- if( comma )
- {
- sb.append( "," );
- }
- sb.append( "inv" );
- }
- sb.append( " " );
- return sb.toString();
- }
-
- /**
- * Checks that the required attributes are set.
- *
- * @exception org.apache.myrmidon.api.TaskException Description of Exception
- */
- private void preconditions()
- throws TaskException
- {
- if( srcDir == null )
- {
- throw new TaskException( "srcdir attribute must be set!" );
- }
- if( !srcDir.exists() )
- {
- throw new TaskException( "srcdir \"" + srcDir.getPath() + "\" does not exist!" );
- }
- if( instrumentDir == null )
- {
- throw new TaskException( "instrumentdir attribute must be set!" );
- }
- if( repositoryDir == null )
- {
- throw new TaskException( "repositorydir attribute must be set!" );
- }
- if( updateIcontrol == true && classDir == null )
- {
- throw new TaskException( "classdir attribute must be specified when updateicontrol=true!" );
- }
- if( updateIcontrol == true && controlFile == null )
- {
- throw new TaskException( "controlfile attribute must be specified when updateicontrol=true!" );
- }
- }
-
- /**
- * Verifies whether any of the source files have changed. Done by comparing
- * date of source/class files. The whole lot is "dirty" if at least one
- * source file or the control file is newer than the instrumented files. If
- * not dirty, iContract will not be executed.
- * Also creates a temporary file with a list of the source files, that will
- * be deleted upon exit.
- *
- * @exception org.apache.myrmidon.api.TaskException Description of Exception
- */
- private void scan()
- throws TaskException
- {
- long now = ( new Date() ).getTime();
-
- DirectoryScanner ds = null;
-
- ds = getDirectoryScanner( srcDir );
- String[] files = ds.getIncludedFiles();
-
- FileOutputStream targetOutputStream = null;
- PrintStream targetPrinter = null;
- boolean writeTargets = false;
- try
- {
- if( targets == null )
- {
- targets = new File( "targets" );
- getContext().info( "Warning: targets file not specified. generating file: " + targets.getName() );
- writeTargets = true;
- }
- else if( !targets.exists() )
- {
- getContext().info( "Specified targets file doesn't exist. generating file: " + targets.getName() );
- writeTargets = true;
- }
- if( writeTargets )
- {
- getContext().info( "You should consider using iControl to create a target file." );
- targetOutputStream = new FileOutputStream( targets );
- targetPrinter = new PrintStream( targetOutputStream );
- }
- for( int i = 0; i < files.length; i++ )
- {
- File srcFile = new File( srcDir, files[ i ] );
- if( files[ i ].endsWith( ".java" ) )
- {
- // print the target, while we're at here. (Only if generatetarget=true).
- if( targetPrinter != null )
- {
- targetPrinter.println( srcFile.getAbsolutePath() );
- }
- File classFile = new File( buildDir, files[ i ].substring( 0, files[ i ].indexOf( ".java" ) ) + ".class" );
-
- if( srcFile.lastModified() > now )
- {
- final String message = "Warning: file modified in the future: " + files[ i ];
- getContext().warn( message );
- }
-
- if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() )
- {
- //log( "Found a file newer than the instrumentDir class file: " + srcFile.getPath() + " newer than " + classFile.getPath() + ". Running iContract again..." );
- dirty = true;
- }
- }
- }
- if( targetPrinter != null )
- {
- targetPrinter.flush();
- targetPrinter.close();
- }
- }
- catch( IOException e )
- {
- throw new TaskException( "Could not create target file:" + e.getMessage() );
- }
-
- // also, check controlFile timestamp
- long controlFileTime = -1;
- try
- {
- if( controlFile != null )
- {
- if( controlFile.exists() && buildDir.exists() )
- {
- controlFileTime = controlFile.lastModified();
- ds = getDirectoryScanner( buildDir );
- files = ds.getIncludedFiles();
- for( int i = 0; i < files.length; i++ )
- {
- File srcFile = new File( srcDir, files[ i ] );
- if( files[ i ].endsWith( ".class" ) )
- {
- if( controlFileTime > srcFile.lastModified() )
- {
- if( !dirty )
- {
- getContext().info( "Control file " + controlFile.getAbsolutePath() + " has been updated. Instrumenting all files..." );
- }
- dirty = true;
- instrumentall = true;
- }
- }
- }
- }
- }
- }
- catch( Throwable t )
- {
- throw new TaskException( "Got an interesting exception:" + t.getMessage() );
- }
- }
-
- /**
- * This class is a helper to set correct classpath for other compilers, like
- * Jikes. It reuses the logic from DefaultCompilerAdapter, which is
- * protected, so we have to subclass it.
- *
- * @author RT
- */
- private class ClasspathHelper extends DefaultCompilerAdapter
- {
- private final String compiler;
-
- public ClasspathHelper( String compiler )
- {
- super();
- this.compiler = compiler;
- }
-
- // dummy implementation. Never called
- public void setJavac( Javac javac )
- {
- }
-
- public boolean execute()
- {
- return true;
- }
-
- // make it public
- public void modify( Path path )
- throws TaskException
- {
- // depending on what compiler to use, set the includeJavaRuntime flag
- if( "jikes".equals( compiler ) )
- {
- icCompiler = compiler;
- m_includeJavaRuntime = true;
- addCompileClasspath( path );
- }
- }
- }
-
- /**
- * BuildListener that sets the iContractMissing flag to true if a message
- * about missing iContract is missing. Used to indicate a more verbose error
- * to the user, with advice about how to solve the problem
- */
- private class IContractPresenceDetector
- extends AbstractProjectListener
- {
- /**
- * Notify listener of log message event.
- */
- public void log( final LogEvent event )
- {
- if( "java.lang.NoClassDefFoundError: com/reliablesystems/iContract/Tool".equals( event.getMessage() ) )
- {
- iContractMissing = true;
- }
- }
- }
-}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/Javah.java b/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/Javah.java
deleted file mode 100644
index 3d7adf4b3..000000000
--- a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/Javah.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.tools.todo.taskdefs;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-import org.apache.avalon.excalibur.util.StringUtil;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.file.FileListUtil;
-import org.apache.myrmidon.framework.file.Path;
-import org.apache.myrmidon.framework.nativelib.ArgumentList;
-import org.apache.tools.todo.util.FileUtils;
-
-/**
- * Task to generate JNI header files using javah. This task can take the
- * following arguments:
- *
- * - classname - the fully-qualified name of a class
- * - outputFile - Concatenates the resulting header or source files for all
- * the classes listed into this file
- * - destdir - Sets the directory where javah saves the header files or the
- * stub files
- * - classpath
- * - bootclasspath
- * - force - Specifies that output files should always be written (JDK1.2
- * only)
- * - old - Specifies that old JDK1.0-style header files should be generated
- * (otherwise output file contain JNI-style native method function prototypes)
- * (JDK1.2 only)
- * - stubs - generate C declarations from the Java object file (used with
- * old)
- * - verbose - causes javah to print a message to stdout concerning the
- * status of the generated files
- * - extdirs - Override location of installed extensions
- *
- * Of these arguments, either outputFile or destdir is required,
- * but not both. More than one classname may be specified, using a
- * comma-separated list or by using <class name="xxx">
- * elements within the task.
- *
- * When this task executes, it will generate C header and source files that are
- * needed to implement native methods.
- *
- * @author Rick Beton
- * richard.beton@physics.org
- */
-
-public class Javah
- extends AbstractTask
-{
- private final static String FAIL_MSG = "Compile failed, messages should have been provided.";
-
- private ArrayList m_classes = new ArrayList( 2 );
- private Path m_classpath;
- private File m_outputFile;
- private boolean m_verbose;
- private boolean m_force;
- private boolean m_old;
- private boolean m_stubs;
- private Path m_bootclasspath;
- private String m_cls;
- private File m_destDir;
-
- /**
- * Adds an element to the bootclasspath.
- */
- public void addBootclasspath( final Path bootclasspath )
- {
- if( m_bootclasspath == null )
- {
- m_bootclasspath = bootclasspath;
- }
- else
- {
- m_bootclasspath.add( bootclasspath );
- }
- }
-
- public void setClass( final String cls )
- {
- m_cls = cls;
- }
-
- /**
- * Adds an element to the classpath.
- */
- public void addClasspath( final Path classpath )
- throws TaskException
- {
- if( m_classpath == null )
- {
- m_classpath = classpath;
- }
- else
- {
- m_classpath.add( classpath );
- }
- }
-
- /**
- * Set the destination directory into which the Java source files should be
- * compiled.
- *
- * @param destDir The new Destdir value
- */
- public void setDestdir( final File destDir )
- {
- m_destDir = destDir;
- }
-
- /**
- * Set the force-write flag.
- */
- public void setForce( final boolean force )
- {
- m_force = force;
- }
-
- /**
- * Set the old flag.
- */
- public void setOld( final boolean old )
- {
- m_old = old;
- }
-
- /**
- * Set the output file name.
- */
- public void setOutputFile( final File outputFile )
- {
- m_outputFile = outputFile;
- }
-
- /**
- * Set the stubs flag.
- */
- public void setStubs( final boolean stubs )
- {
- m_stubs = stubs;
- }
-
- /**
- * Set the verbose flag.
- */
- public void setVerbose( final boolean verbose )
- {
- m_verbose = verbose;
- }
-
- public ClassArgument createClass()
- {
- final ClassArgument ga = new ClassArgument();
- m_classes.add( ga );
- return ga;
- }
-
- /**
- * Executes the task.
- */
- public void execute()
- throws TaskException
- {
- validate();
- doClassicCompile();
- }
-
- private void validate() throws TaskException
- {
- if( ( m_cls == null ) && ( m_classes.size() == 0 ) )
- {
- final String message = "class attribute must be set!";
- throw new TaskException( message );
- }
-
- if( ( m_cls != null ) && ( m_classes.size() > 0 ) )
- {
- final String message = "set class attribute or class element, not both.";
- throw new TaskException( message );
- }
-
- if( m_destDir != null )
- {
- if( !m_destDir.isDirectory() )
- {
- final String message = "destination directory \"" + m_destDir +
- "\" does not exist or is not a directory";
- throw new TaskException( message );
- }
- if( m_outputFile != null )
- {
- final String message = "destdir and outputFile are mutually exclusive";
- throw new TaskException( message );
- }
- }
- }
-
- /**
- * Logs the compilation parameters, adds the files to compile and logs the
- * &qout;niceSourceList"
- */
- private void logAndAddFilesToCompile( final ArgumentList cmd )
- throws TaskException
- {
- final String[] args = cmd.getArguments();
- getContext().debug( "Compilation args: " + FileUtils.formatCommandLine( args ) );
-
- int n = 0;
- StringBuffer niceClassList = new StringBuffer();
- if( m_cls != null )
- {
- final StringTokenizer tok = new StringTokenizer( m_cls, ",", false );
- while( tok.hasMoreTokens() )
- {
- final String aClass = tok.nextToken().trim();
- cmd.addArgument( aClass );
- niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR );
- n++;
- }
- }
-
- final Iterator enum = m_classes.iterator();
- while( enum.hasNext() )
- {
- final ClassArgument arg = (ClassArgument)enum.next();
- final String aClass = arg.getName();
- cmd.addArgument( aClass );
- niceClassList.append( " " + aClass + StringUtil.LINE_SEPARATOR );
- n++;
- }
-
- final StringBuffer prefix = new StringBuffer( "Class" );
- if( n > 1 )
- {
- prefix.append( "es" );
- }
- prefix.append( " to be compiled:" );
- prefix.append( StringUtil.LINE_SEPARATOR );
-
- getContext().debug( prefix.toString() + niceClassList.toString() );
- }
-
- /**
- * Does the command line argument processing common to classic and modern.
- */
- private ArgumentList setupJavahCommand()
- throws TaskException
- {
- final ArgumentList cmd = new ArgumentList();
-
- if( m_destDir != null )
- {
- cmd.addArgument( "-d" );
- cmd.addArgument( m_destDir );
- }
-
- if( m_outputFile != null )
- {
- cmd.addArgument( "-o" );
- cmd.addArgument( m_outputFile );
- }
-
- if( m_classpath != null )
- {
- cmd.addArgument( "-classpath" );
- cmd.addArgument( FileListUtil.formatPath( m_classpath, getContext() ) );
- }
-
- if( m_verbose )
- {
- cmd.addArgument( "-verbose" );
- }
- if( m_old )
- {
- cmd.addArgument( "-old" );
- }
- if( m_force )
- {
- cmd.addArgument( "-force" );
- }
-
- if( m_stubs )
- {
- if( !m_old )
- {
- final String message = "stubs only available in old mode.";
- throw new TaskException( message );
- }
- cmd.addArgument( "-stubs" );
- }
- if( m_bootclasspath != null )
- {
- cmd.addArgument( "-bootclasspath" );
- cmd.addArgument( FileListUtil.formatPath( m_bootclasspath, getContext() ) );
- }
-
- logAndAddFilesToCompile( cmd );
- return cmd;
- }
-
- /**
- * Peforms a compile using the classic compiler that shipped with JDK 1.1
- * and 1.2.
- *
- * @exception org.apache.myrmidon.api.TaskException Description of Exception
- */
-
- private void doClassicCompile()
- throws TaskException
- {
- ArgumentList cmd = setupJavahCommand();
-
- // Use reflection to be able to build on all JDKs
- /*
- * / provide the compiler a different message sink - namely our own
- * sun.tools.javac.Main compiler =
- * new sun.tools.javac.Main(new LogOutputStream(this, Project.MSG_WARN), "javac");
- * if (!compiler.compile(cmd.getArguments())) {
- * throw new TaskException("Compile failed");
- * }
- */
- try
- {
- // Javac uses logstr to change the output stream and calls
- // the constructor's invoke method to create a compiler instance
- // dynamically. However, javah has a different interface and this
- // makes it harder, so here's a simple alternative.
- //------------------------------------------------------------------
- com.sun.tools.javah.Main main = new com.sun.tools.javah.Main( cmd.getArguments() );
- main.run();
- }
- //catch (ClassNotFoundException ex) {
- // throw new TaskException("Cannot use javah because it is not available"+
- // " A common solution is to set the environment variable"+
- // " JAVA_HOME to your jdk directory.", location);
- //}
- catch( Exception ex )
- {
- if( ex instanceof TaskException )
- {
- throw (TaskException)ex;
- }
- else
- {
- throw new TaskException( "Error starting javah: ", ex );
- }
- }
- }
-}
-
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/MatchingTask.java b/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/MatchingTask.java
deleted file mode 100644
index e48a8e937..000000000
--- a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/MatchingTask.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.tools.todo.taskdefs;
-
-import java.io.File;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.Pattern;
-import org.apache.myrmidon.framework.PatternSet;
-import org.apache.myrmidon.framework.FileSet;
-import org.apache.tools.todo.types.DirectoryScanner;
-import org.apache.tools.todo.types.ScannerUtil;
-
-/**
- * This is an abstract task that should be used by all those tasks that require
- * to include or exclude files based on pattern matching.
- *
- * @author Arnout J. Kuiper
- * @author Stefano Mazzocchi
- * @author Sam Ruby
- * @author Jon S. Stevens
- * @author Stefan Bodewig
- */
-public abstract class MatchingTask
- extends AbstractTask
-{
- private FileSet m_fileset = new FileSet();
-
- /**
- * Sets whether default exclusions should be used or not.
- */
- public void setDefaultexcludes( final boolean useDefaultExcludes )
- {
- m_fileset.setDefaultExcludes( useDefaultExcludes );
- }
-
- /**
- * Sets the set of exclude patterns. Patterns may be separated by a comma or
- * a space.
- *
- * @param excludes the string containing the exclude patterns
- */
- public void setExcludes( final String excludes )
- {
- m_fileset.setExcludes( excludes );
- }
-
- /**
- * Sets the set of include patterns. Patterns may be separated by a comma or
- * a space.
- *
- * @param includes the string containing the include patterns
- */
- public void setIncludes( final String includes )
- {
- m_fileset.setIncludes( includes );
- }
-
- /**
- * add a name entry on the exclude list
- */
- public void addExclude( final Pattern pattern )
- {
- m_fileset.addExclude( pattern );
- }
-
- /**
- * add a name entry on the include list
- */
- public void addInclude( final Pattern pattern )
- throws TaskException
- {
- m_fileset.addInclude( pattern );
- }
-
- /**
- * add a set of patterns
- */
- public void addPatternSet( final PatternSet set )
- {
- m_fileset.addPatternSet( set );
- }
-
- /**
- * Returns the directory scanner needed to access the files to process.
- *
- * @param baseDir Description of Parameter
- * @return The DirectoryScanner value
- */
- protected DirectoryScanner getDirectoryScanner( final File baseDir )
- throws TaskException
- {
- m_fileset.setDir( baseDir );
- return ScannerUtil.getDirectoryScanner( m_fileset );
- }
-}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/NetRexxC.java b/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/NetRexxC.java
deleted file mode 100644
index e99b66290..000000000
--- a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/NetRexxC.java
+++ /dev/null
@@ -1,770 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.tools.todo.taskdefs;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import netrexx.lang.Rexx;
-import org.apache.avalon.excalibur.io.FileUtil;
-import org.apache.avalon.excalibur.util.StringUtil;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskContext;
-import org.apache.tools.todo.taskdefs.MatchingTask;
-import org.apache.tools.todo.types.DirectoryScanner;
-
-/**
- * Task to compile NetRexx source files. This task can take the following
- * arguments:
- *
- * - binary
- * - classpath
- * - comments
- * - compile
- * - console
- * - crossref
- * - decimal
- * - destdir
- * - diag
- * - explicit
- * - format
- * - keep
- * - logo
- * - replace
- * - savelog
- * - srcdir
- * - sourcedir
- * - strictargs
- * - strictassign
- * - strictcase
- * - strictimport
- * - symbols
- * - time
- * - trace
- * - utf8
- * - verbose
- *
- * Of these arguments, the srcdir argument is required.
- *
- * When this task executes, it will recursively scan the srcdir looking for
- * NetRexx source files to compile. This task makes its compile decision based
- * on timestamp.
- *
- * Before files are compiled they and any other file in the srcdir will be
- * copied to the destdir allowing support files to be located properly in the
- * classpath. The reason for copying the source files before the compile is that
- * NetRexxC has only two destinations for classfiles:
- *
- * - The current directory, and,
- * - The directory the source is in (see sourcedir option)
- *
- *
- *
- * @author dIon Gillard
- * dion@multitask.com.au
- */
-
-public class NetRexxC extends MatchingTask
-{
- private boolean compile = true;
- private boolean decimal = true;
- private boolean logo = true;
- private boolean sourcedir = true;
- private String trace = "trace2";
- private String verbose = "verbose3";
-
- // other implementation variables
- private ArrayList compileList = new ArrayList();
- private Hashtable filecopyList = new Hashtable();
- private String oldClasspath = System.getProperty( "java.class.path" );
-
- // variables to hold arguments
- private boolean binary;
- private String classpath;
- private boolean comments;
- private boolean compact;
- private boolean console;
- private boolean crossref;
- private File destDir;
- private boolean diag;
- private boolean explicit;
- private boolean format;
- private boolean java;
- private boolean keep;
- private boolean replace;
- private boolean savelog;
- private File srcDir;// ?? Should this be the default for ant?
- private boolean strictargs;
- private boolean strictassign;
- private boolean strictcase;
- private boolean strictimport;
- private boolean strictprops;
- private boolean strictsignal;
- private boolean symbols;
- private boolean time;
- private boolean utf8;
-
- /**
- * Set whether literals are treated as binary, rather than NetRexx types
- *
- * @param binary The new Binary value
- */
- public void setBinary( boolean binary )
- {
- this.binary = binary;
- }
-
- /**
- * Set the classpath used for NetRexx compilation
- *
- * @param classpath The new Classpath value
- */
- public void setClasspath( String classpath )
- {
- this.classpath = classpath;
- }
-
- /**
- * Set whether comments are passed through to the generated java source.
- * Valid true values are "on" or "true". Anything else sets the flag to
- * false. The default value is false
- *
- * @param comments The new Comments value
- */
- public void setComments( boolean comments )
- {
- this.comments = comments;
- }
-
- /**
- * Set whether error messages come out in compact or verbose format. Valid
- * true values are "on" or "true". Anything else sets the flag to false. The
- * default value is false
- *
- * @param compact The new Compact value
- */
- public void setCompact( boolean compact )
- {
- this.compact = compact;
- }
-
- /**
- * Set whether the NetRexx compiler should compile the generated java code
- * Valid true values are "on" or "true". Anything else sets the flag to
- * false. The default value is true. Setting this flag to false, will
- * automatically set the keep flag to true.
- *
- * @param compile The new Compile value
- */
- public void setCompile( boolean compile )
- {
- this.compile = compile;
- if( !this.compile && !this.keep )
- {
- this.keep = true;
- }
- }
-
- /**
- * Set whether or not messages should be displayed on the 'console' Valid
- * true values are "on" or "true". Anything else sets the flag to false. The
- * default value is true.
- *
- * @param console The new Console value
- */
- public void setConsole( boolean console )
- {
- this.console = console;
- }
-
- /**
- * Whether variable cross references are generated
- *
- * @param crossref The new Crossref value
- */
- public void setCrossref( boolean crossref )
- {
- this.crossref = crossref;
- }
-
- /**
- * Set whether decimal arithmetic should be used for the netrexx code.
- * Binary arithmetic is used when this flag is turned off. Valid true values
- * are "on" or "true". Anything else sets the flag to false. The default
- * value is true.
- *
- * @param decimal The new Decimal value
- */
- public void setDecimal( boolean decimal )
- {
- this.decimal = decimal;
- }
-
- /**
- * Set the destination directory into which the NetRexx source files should
- * be copied and then compiled.
- *
- * @param destDirName The new DestDir value
- */
- public void setDestDir( File destDirName )
- {
- destDir = destDirName;
- }
-
- /**
- * Whether diagnostic information about the compile is generated
- *
- * @param diag The new Diag value
- */
- public void setDiag( boolean diag )
- {
- this.diag = diag;
- }
-
- /**
- * Sets whether variables must be declared explicitly before use. Valid true
- * values are "on" or "true". Anything else sets the flag to false. The
- * default value is false.
- *
- * @param explicit The new Explicit value
- */
- public void setExplicit( boolean explicit )
- {
- this.explicit = explicit;
- }
-
- /**
- * Whether the generated java code is formatted nicely or left to match
- * NetRexx line numbers for call stack debugging
- *
- * @param format The new Format value
- */
- public void setFormat( boolean format )
- {
- this.format = format;
- }
-
- /**
- * Whether the generated java code is produced Valid true values are "on" or
- * "true". Anything else sets the flag to false. The default value is false.
- *
- * @param java The new Java value
- */
- public void setJava( boolean java )
- {
- this.java = java;
- }
-
- /**
- * Sets whether the generated java source file should be kept after
- * compilation. The generated files will have an extension of .java.keep,
- * not .java Valid true values are "on" or "true". Anything else sets
- * the flag to false. The default value is false.
- *
- * @param keep The new Keep value
- */
- public void setKeep( boolean keep )
- {
- this.keep = keep;
- }
-
- /**
- * Whether the compiler text logo is displayed when compiling
- *
- * @param logo The new Logo value
- */
- public void setLogo( boolean logo )
- {
- this.logo = logo;
- }
-
- /**
- * Whether the generated .java file should be replaced when compiling Valid
- * true values are "on" or "true". Anything else sets the flag to false. The
- * default value is false.
- *
- * @param replace The new Replace value
- */
- public void setReplace( boolean replace )
- {
- this.replace = replace;
- }
-
- /**
- * Sets whether the compiler messages will be written to NetRexxC.log as
- * well as to the console Valid true values are "on" or "true". Anything
- * else sets the flag to false. The default value is false.
- *
- * @param savelog The new Savelog value
- */
- public void setSavelog( boolean savelog )
- {
- this.savelog = savelog;
- }
-
- /**
- * Tells the NetRexx compiler to store the class files in the same directory
- * as the source files. The alternative is the working directory Valid true
- * values are "on" or "true". Anything else sets the flag to false. The
- * default value is true.
- *
- * @param sourcedir The new Sourcedir value
- */
- public void setSourcedir( boolean sourcedir )
- {
- this.sourcedir = sourcedir;
- }
-
- /**
- * Set the source dir to find the source Java files.
- *
- * @param srcDirName The new SrcDir value
- */
- public void setSrcDir( File srcDirName )
- {
- srcDir = srcDirName;
- }
-
- /**
- * Tells the NetRexx compiler that method calls always need parentheses,
- * even if no arguments are needed, e.g. aStringVar.getBytes
- * vs. aStringVar.getBytes()
Valid true values are "on" or
- * "true". Anything else sets the flag to false. The default value is false.
- *
- * @param strictargs The new Strictargs value
- */
- public void setStrictargs( boolean strictargs )
- {
- this.strictargs = strictargs;
- }
-
- /**
- * Tells the NetRexx compile that assignments must match exactly on type
- *
- * @param strictassign The new Strictassign value
- */
- public void setStrictassign( boolean strictassign )
- {
- this.strictassign = strictassign;
- }
-
- /**
- * Specifies whether the NetRexx compiler should be case sensitive or not
- *
- * @param strictcase The new Strictcase value
- */
- public void setStrictcase( boolean strictcase )
- {
- this.strictcase = strictcase;
- }
-
- /**
- * Sets whether classes need to be imported explicitly using an import
- * statement. By default the NetRexx compiler will import certain packages
- * automatically Valid true values are "on" or "true". Anything else sets
- * the flag to false. The default value is false.
- *
- * @param strictimport The new Strictimport value
- */
- public void setStrictimport( boolean strictimport )
- {
- this.strictimport = strictimport;
- }
-
- /**
- * Sets whether local properties need to be qualified explicitly using
- * this
Valid true values are "on" or "true". Anything else
- * sets the flag to false. The default value is false.
- *
- * @param strictprops The new Strictprops value
- */
- public void setStrictprops( boolean strictprops )
- {
- this.strictprops = strictprops;
- }
-
- /**
- * Whether the compiler should force catching of exceptions by explicitly
- * named types
- *
- * @param strictsignal The new Strictsignal value
- */
- public void setStrictsignal( boolean strictsignal )
- {
- this.strictsignal = strictsignal;
- }
-
- /**
- * Sets whether debug symbols should be generated into the class file Valid
- * true values are "on" or "true". Anything else sets the flag to false. The
- * default value is false.
- *
- * @param symbols The new Symbols value
- */
- public void setSymbols( boolean symbols )
- {
- this.symbols = symbols;
- }
-
- /**
- * Asks the NetRexx compiler to print compilation times to the console Valid
- * true values are "on" or "true". Anything else sets the flag to false. The
- * default value is false.
- *
- * @param time The new Time value
- */
- public void setTime( boolean time )
- {
- this.time = time;
- }
-
- /**
- * Turns on or off tracing and directs the resultant trace output Valid
- * values are: "trace", "trace1", "trace2" and "notrace". "trace" and
- * "trace2"
- *
- * @param trace The new Trace value
- */
- public void setTrace( String trace )
- {
- if( trace.equalsIgnoreCase( "trace" )
- || trace.equalsIgnoreCase( "trace1" )
- || trace.equalsIgnoreCase( "trace2" )
- || trace.equalsIgnoreCase( "notrace" ) )
- {
- this.trace = trace;
- }
- else
- {
- throw new TaskException( "Unknown trace value specified: '" + trace + "'" );
- }
- }
-
- /**
- * Tells the NetRexx compiler that the source is in UTF8 Valid true values
- * are "on" or "true". Anything else sets the flag to false. The default
- * value is false.
- *
- * @param utf8 The new Utf8 value
- */
- public void setUtf8( boolean utf8 )
- {
- this.utf8 = utf8;
- }
-
- /**
- * Whether lots of warnings and error messages should be generated
- *
- * @param verbose The new Verbose value
- */
- public void setVerbose( String verbose )
- {
- this.verbose = verbose;
- }
-
- /**
- * Executes the task, i.e. does the actual compiler call
- *
- * @exception org.apache.myrmidon.api.TaskException Description of Exception
- */
- public void execute()
- throws TaskException
- {
-
- // first off, make sure that we've got a srcdir and destdir
- if( srcDir == null || destDir == null )
- {
- throw new TaskException( "srcDir and destDir attributes must be set!" );
- }
-
- // scan source and dest dirs to build up both copy lists and
- // compile lists
- // scanDir(srcDir, destDir);
- DirectoryScanner ds = getDirectoryScanner( srcDir );
-
- String[] files = ds.getIncludedFiles();
-
- scanDir( srcDir, destDir, files );
-
- // copy the source and support files
- copyFilesToDestination();
-
- // compile the source files
- if( compileList.size() > 0 )
- {
- getContext().info( "Compiling " + compileList.size() + " source file"
- + ( compileList.size() == 1 ? "" : "s" )
- + " to " + destDir );
- doNetRexxCompile();
- }
- }
-
- /**
- * Builds the compilation classpath.
- *
- * @return The CompileClasspath value
- */
- private String getCompileClasspath()
- throws TaskException
- {
- StringBuffer classpath = new StringBuffer();
-
- // add dest dir to classpath so that previously compiled and
- // untouched classes are on classpath
- classpath.append( destDir.getAbsolutePath() );
-
- // add our classpath to the mix
- if( this.classpath != null )
- {
- addExistingToClasspath( classpath, this.classpath );
- }
-
- // add the system classpath
- // addExistingToClasspath(classpath,System.getProperty("java.class.path"));
- return classpath.toString();
- }
-
- /**
- * This
- *
- * @return The CompileOptionsAsArray value
- */
- private String[] getCompileOptionsAsArray()
- {
- ArrayList options = new ArrayList();
- options.add( binary ? "-binary" : "-nobinary" );
- options.add( comments ? "-comments" : "-nocomments" );
- options.add( compile ? "-compile" : "-nocompile" );
- options.add( compact ? "-compact" : "-nocompact" );
- options.add( console ? "-console" : "-noconsole" );
- options.add( crossref ? "-crossref" : "-nocrossref" );
- options.add( decimal ? "-decimal" : "-nodecimal" );
- options.add( diag ? "-diag" : "-nodiag" );
- options.add( explicit ? "-explicit" : "-noexplicit" );
- options.add( format ? "-format" : "-noformat" );
- options.add( keep ? "-keep" : "-nokeep" );
- options.add( logo ? "-logo" : "-nologo" );
- options.add( replace ? "-replace" : "-noreplace" );
- options.add( savelog ? "-savelog" : "-nosavelog" );
- options.add( sourcedir ? "-sourcedir" : "-nosourcedir" );
- options.add( strictargs ? "-strictargs" : "-nostrictargs" );
- options.add( strictassign ? "-strictassign" : "-nostrictassign" );
- options.add( strictcase ? "-strictcase" : "-nostrictcase" );
- options.add( strictimport ? "-strictimport" : "-nostrictimport" );
- options.add( strictprops ? "-strictprops" : "-nostrictprops" );
- options.add( strictsignal ? "-strictsignal" : "-nostrictsignal" );
- options.add( symbols ? "-symbols" : "-nosymbols" );
- options.add( time ? "-time" : "-notime" );
- options.add( "-" + trace );
- options.add( utf8 ? "-utf8" : "-noutf8" );
- options.add( "-" + verbose );
- String[] results = new String[ options.size() ];
- options.copyInto( results );
- return results;
- }
-
- /**
- * Takes a classpath-like string, and adds each element of this string to a
- * new classpath, if the components exist. Components that don't exist,
- * aren't added. We do this, because jikes issues warnings for non-existant
- * files/dirs in his classpath, and these warnings are pretty annoying.
- *
- * @param target - target classpath
- * @param source - source classpath to get file objects.
- */
- private void addExistingToClasspath( StringBuffer target, String source )
- throws TaskException
- {
- final StringTokenizer tok = new StringTokenizer( source,
- System.getProperty( "path.separator" ), false );
- while( tok.hasMoreTokens() )
- {
- File f = getContext().resolveFile( tok.nextToken() );
-
- if( f.exists() )
- {
- target.append( File.pathSeparator );
- target.append( f.getAbsolutePath() );
- }
- else
- {
- getContext().debug( "Dropping from classpath: " + f.getAbsolutePath() );
- }
- }
-
- }
-
- /**
- * Copy eligible files from the srcDir to destDir
- */
- private void copyFilesToDestination()
- {
- //FIXME: This should be zapped no ?
- if( filecopyList.size() > 0 )
- {
- getContext().info( "Copying " + filecopyList.size() + " file"
- + ( filecopyList.size() == 1 ? "" : "s" )
- + " to " + destDir.getAbsolutePath() );
- Iterator enum = filecopyList.keySet().iterator();
- while( enum.hasNext() )
- {
- String fromFile = (String)enum.next();
- String toFile = (String)filecopyList.get( fromFile );
- try
- {
- FileUtil.copyFile( new File( fromFile ), new File( toFile ) );
- }
- catch( IOException ioe )
- {
- String msg = "Failed to copy " + fromFile + " to " + toFile
- + " due to " + ioe.getMessage();
- throw new TaskException( msg, ioe );
- }
- }
- }
- }
-
- /**
- * Peforms a copmile using the NetRexx 1.1.x compiler
- *
- * @exception org.apache.myrmidon.api.TaskException Description of Exception
- */
- private void doNetRexxCompile()
- throws TaskException
- {
- getContext().debug( "Using NetRexx compiler" );
- String classpath = getCompileClasspath();
- StringBuffer compileOptions = new StringBuffer();
- StringBuffer fileList = new StringBuffer();
-
- // create an array of strings for input to the compiler: one array
- // comes from the compile options, the other from the compileList
- String[] compileOptionsArray = getCompileOptionsAsArray();
- String[] fileListArray = new String[ compileList.size() ];
- Iterator e = compileList.iterator();
- int j = 0;
- while( e.hasNext() )
- {
- fileListArray[ j ] = (String)e.next();
- j++;
- }
- // create a single array of arguments for the compiler
- String compileArgs[] = new String[ compileOptionsArray.length + fileListArray.length ];
- for( int i = 0; i < compileOptionsArray.length; i++ )
- {
- compileArgs[ i ] = compileOptionsArray[ i ];
- }
- for( int i = 0; i < fileListArray.length; i++ )
- {
- compileArgs[ i + compileOptionsArray.length ] = fileListArray[ i ];
- }
-
- // print nice output about what we are doing for the log
- compileOptions.append( "Compilation args: " );
- for( int i = 0; i < compileOptionsArray.length; i++ )
- {
- compileOptions.append( compileOptionsArray[ i ] );
- compileOptions.append( " " );
- }
- getContext().debug( compileOptions.toString() );
-
- StringBuffer niceSourceList = new StringBuffer( "Files to be compiled:" + StringUtil.LINE_SEPARATOR );
-
- for( int i = 0; i < compileList.size(); i++ )
- {
- niceSourceList.append( " " );
- niceSourceList.append( compileList.get( i ).toString() );
- niceSourceList.append( StringUtil.LINE_SEPARATOR );
- }
-
- getContext().debug( niceSourceList.toString() );
-
- // need to set java.class.path property and restore it later
- // since the NetRexx compiler has no option for the classpath
- String currentClassPath = System.getProperty( "java.class.path" );
- Properties currentProperties = System.getProperties();
- currentProperties.put( "java.class.path", classpath );
-
- try
- {
- StringWriter out = new StringWriter();
- int rc =
- COM.ibm.netrexx.process.NetRexxC.main( new Rexx( compileArgs ), new PrintWriter( out ) );
-
- if( rc > 1 )
- {// 1 is warnings from real NetRexxC
- getContext().error( out.toString() );
- String msg = "Compile failed, messages should have been provided.";
- throw new TaskException( msg );
- }
- else if( rc == 1 )
- {
- getContext().warn( out.toString() );
- }
- else
- {
- getContext().info( out.toString() );
- }
- }
- finally
- {
- // need to reset java.class.path property
- // since the NetRexx compiler has no option for the classpath
- currentProperties = System.getProperties();
- currentProperties.put( "java.class.path", currentClassPath );
- }
- }
-
- /**
- * Scans the directory looking for source files to be compiled and support
- * files to be copied.
- *
- * @param srcDir Description of Parameter
- * @param destDir Description of Parameter
- * @param files Description of Parameter
- */
- private void scanDir( File srcDir, File destDir, String[] files )
- {
- for( int i = 0; i < files.length; i++ )
- {
- File srcFile = new File( srcDir, files[ i ] );
- File destFile = new File( destDir, files[ i ] );
- String filename = files[ i ];
- // if it's a non source file, copy it if a later date than the
- // dest
- // if it's a source file, see if the destination class file
- // needs to be recreated via compilation
- if( filename.toLowerCase().endsWith( ".nrx" ) )
- {
- File classFile =
- new File( destDir,
- filename.substring( 0, filename.lastIndexOf( '.' ) ) + ".class" );
-
- if( !compile || srcFile.lastModified() > classFile.lastModified() )
- {
- filecopyList.put( srcFile.getAbsolutePath(), destFile.getAbsolutePath() );
- compileList.add( destFile.getAbsolutePath() );
- }
- }
- else
- {
- if( srcFile.lastModified() > destFile.lastModified() )
- {
- filecopyList.put( srcFile.getAbsolutePath(), destFile.getAbsolutePath() );
- }
- }
- }
- }
-}
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/PathConvert.java b/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/PathConvert.java
deleted file mode 100644
index a33997c74..000000000
--- a/proposal/myrmidon/src/todo/org/apache/tools/todo/taskdefs/PathConvert.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Copyright (C) The Apache Software Foundation. All rights reserved.
- *
- * This software is published under the terms of the Apache Software License
- * version 1.1, a copy of which has been included with this distribution in
- * the LICENSE.txt file.
- */
-package org.apache.tools.todo.taskdefs;
-
-import java.io.File;
-import java.util.ArrayList;
-import org.apache.aut.nativelib.Os;
-import org.apache.myrmidon.api.AbstractTask;
-import org.apache.myrmidon.api.TaskException;
-import org.apache.myrmidon.framework.file.Path;
-
-/**
- * This task converts path and classpath information to a specific target OS
- * format. The resulting formatted path is placed into a specified property.
- *
- * LIMITATION: Currently this implementation groups all machines into one of two
- * types: Unix or Windows. Unix is defined as NOT windows.
- *
- * @author Larry Streepy
- * streepy@healthlanguage.com
- */
-public class PathConvert extends AbstractTask
-{
- private Path m_path;// Path to be converted
- private String m_targetOS;// The target OS type
- private boolean m_targetWindows;// Set when targetOS is set
- private boolean m_onWindows;// Set if we're running on windows
- private String m_property;// The property to receive the results
- private ArrayList m_prefixMap = new ArrayList();// Path prefix map
- private String m_pathSep;// User override on path sep char
- private String m_dirSep;
-
- /**
- * Override the default directory separator string for the target os
- */
- public void setDirSep( final String dirSep )
- {
- m_dirSep = dirSep;
- }
-
- /**
- * Override the default path separator string for the target os
- *
- * @param pathSep The new PathSep value
- */
- public void setPathSep( final String pathSep )
- {
- m_pathSep = pathSep;
- }
-
- /**
- * Set the value of the proprty attribute - this is the property into which
- * our converted path will be placed.
- */
- public void setProperty( final String property )
- {
- m_property = property;
- }
-
- /**
- * Set the value of the targetos attribute
- *
- * @param targetOS The new Targetos value
- */
- public void setTargetos( String targetOS )
- throws TaskException
- {
- m_targetOS = targetOS.toLowerCase();
-
- if( !m_targetOS.equals( "windows" ) && !targetOS.equals( "unix" ) &&
- !m_targetOS.equals( "netware" ) )
- {
- throw new TaskException( "targetos must be one of 'unix', 'netware', or 'windows'" );
- }
-
- // Currently, we deal with only two path formats: Unix and Windows
- // And Unix is everything that is not Windows
-
- // for NetWare, piggy-back on Windows, since in the validateSetup code,
- // the same assumptions can be made as with windows -
- // that ; is the path separator
-
- m_targetWindows = ( m_targetOS.equals( "windows" ) || m_targetOS.equals( "netware" ) );
- }
-
- /**
- * Create a nested MAP element
- */
- public void addMap( final MapEntry entry )
- {
- m_prefixMap.add( entry );
- }
-
- /**
- * Adds a PATH element
- */
- public void addPath( Path path )
- throws TaskException
- {
- if( m_path == null )
- {
- m_path = path;
- }
- else
- {
- m_path.add( path );
- }
- }
-
- public void execute()
- throws TaskException
- {
- // If we are a reference, the create a Path from the reference
- validate();// validate our setup
-
- // Currently, we deal with only two path formats: Unix and Windows
- // And Unix is everything that is not Windows
- // (with the exception for NetWare below)
-
- // for NetWare, piggy-back on Windows, since here and in the
- // apply code, the same assumptions can be made as with windows -
- // that \\ is an OK separator, and do comparisons case-insensitive.
- m_onWindows = ( Os.isFamily( Os.OS_FAMILY_WINDOWS ) || Os.isFamily( Os.OS_FAMILY_NETWARE ) );
-
- // Determine the from/to char mappings for dir sep
- char fromDirSep = m_onWindows ? '\\' : '/';
- char toDirSep = m_dirSep.charAt( 0 );
-
- StringBuffer rslt = new StringBuffer( 100 );
-
- // Get the list of path components in canonical form
- String[] elems = m_path.listFiles( getContext() );
-
- for( int i = 0; i < elems.length; i++ )
- {
- String elem = elems[ i ];
-
- elem = mapElement( elem );// Apply the path prefix map
-
- // Now convert the path and file separator characters from the
- // current os to the target os.
-
- elem = elem.replace( fromDirSep, toDirSep );
-
- if( i != 0 )
- {
- rslt.append( m_pathSep );
- }
- rslt.append( elem );
- }
-
- // Place the result into the specified property
- final String value = rslt.toString();
-
- getContext().debug( "Set property " + m_property + " = " + value );
-
- final String name = m_property;
- getContext().setProperty( name, value );
- }
-
- /**
- * Apply the configured map to a path element. The map is used to convert
- * between Windows drive letters and Unix paths. If no map is configured,
- * then the input string is returned unchanged.
- *
- * @param elem The path element to apply the map to
- * @return String Updated element
- */
- private String mapElement( String elem )
- throws TaskException
- {
- int size = m_prefixMap.size();
-
- if( size != 0 )
- {
-
- // Iterate over the map entries and apply each one. Stop when one of the
- // entries actually changes the element
-
- for( int i = 0; i < size; i++ )
- {
- MapEntry entry = (MapEntry)m_prefixMap.get( i );
- String newElem = entry.apply( elem );
-
- // Note I'm using "!=" to see if we got a new object back from
- // the apply method.
-
- if( newElem != elem )
- {
- elem = newElem;
- break;// We applied one, so we're done
- }
- }
- }
-
- return elem;
- }
-
- /**
- * Validate that all our parameters have been properly initialized.
- *
- * @throws org.apache.myrmidon.api.TaskException if something is not setup properly
- */
- private void validate()
- throws TaskException
- {
-
- if( m_path == null )
- {
- throw new TaskException( "You must specify a path to convert" );
- }
-
- if( m_property == null )
- {
- throw new TaskException( "You must specify a property" );
- }
-
- // Must either have a target OS or both a dirSep and pathSep
-
- if( m_targetOS == null && m_pathSep == null && m_dirSep == null )
- {
- throw new TaskException( "You must specify at least one of targetOS, dirSep, or pathSep" );
- }
-
- // Determine the separator strings. The dirsep and pathsep attributes
- // override the targetOS settings.
- String dsep = File.separator;
- String psep = File.pathSeparator;
-
- if( m_targetOS != null )
- {
- psep = m_targetWindows ? ";" : ":";
- dsep = m_targetWindows ? "\\" : "/";
- }
-
- if( m_pathSep != null )
- {// override with pathsep=
- psep = m_pathSep;
- }
-
- if( m_dirSep != null )
- {// override with dirsep=
- dsep = m_dirSep;
- }
-
- m_pathSep = psep;
- m_dirSep = dsep;
- }
-
- /**
- * Helper class, holds the nested