can accept any nested FileList implementation, including <path>. * Added <list-path> diagnostic task. * Added test cases for <path>. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271948 13f79535-47bb-0310-9956-ffa450edef68master
@@ -568,8 +568,16 @@ Legal: | |||||
</jar> | </jar> | ||||
<!-- Prepare the project tests --> | <!-- Prepare the project tests --> | ||||
<copy file="${test.working.dir}/org/apache/antlib/core/test/ant-descriptor.xml" | |||||
tofile="${test.classes}/META-INF/ant-descriptor.xml"/> | |||||
<antlib-descriptor libName="unittests" | |||||
destdir="${gen.dir}" | |||||
classpathref="project.class.path"> | |||||
<fileset dir="src/testcases"> | |||||
<include name="org/apache/antlib/**"/> | |||||
<include name="org/apache/myrmidon/framework/**"/> | |||||
</fileset> | |||||
</antlib-descriptor> | |||||
<copy file="${gen.dir}/unittests-ant-descriptor.xml" | |||||
tofile="${test.classes}/META-INF/ant-descriptor.xml"/> | |||||
<!-- Run all the tests --> | <!-- Run all the tests --> | ||||
<junit printsummary="on" fork="true" failureProperty="test.failed"> | <junit printsummary="on" fork="true" failureProperty="test.failed"> | ||||
@@ -33,7 +33,7 @@ public abstract class AbstractAvailableCondition | |||||
public void addClasspath( final Path classpath ) | public void addClasspath( final Path classpath ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
m_classpath.addPath( classpath ); | |||||
m_classpath.add( classpath ); | |||||
} | } | ||||
/** | /** | ||||
@@ -396,7 +396,7 @@ public class CSharp | |||||
{ | { | ||||
m_referenceFiles = new Path(); | m_referenceFiles = new Path(); | ||||
} | } | ||||
m_referenceFiles.addPath( path ); | |||||
m_referenceFiles.add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -0,0 +1,49 @@ | |||||
/* | |||||
* 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.antlib.file; | |||||
import org.apache.myrmidon.api.AbstractTask; | |||||
import org.apache.myrmidon.api.TaskException; | |||||
import org.apache.myrmidon.framework.file.FileList; | |||||
import org.apache.myrmidon.framework.file.Path; | |||||
/** | |||||
* A diagnostic task that lists the contents of a path. | |||||
* | |||||
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | |||||
* @version $Revision$ $Date$ | |||||
* | |||||
* @ant:task name="list-path" | |||||
*/ | |||||
public class ListPathTask | |||||
extends AbstractTask | |||||
{ | |||||
private final Path m_path = new Path(); | |||||
/** | |||||
* Adds a nested path. | |||||
*/ | |||||
public void add( final FileList list ) | |||||
{ | |||||
m_path.add( list ); | |||||
} | |||||
/** | |||||
* Executes the task. | |||||
*/ | |||||
public void execute() | |||||
throws TaskException | |||||
{ | |||||
final String[] files = m_path.listFiles( getContext() ); | |||||
for( int i = 0; i < files.length; i++ ) | |||||
{ | |||||
final String file = files[ i ]; | |||||
getContext().warn( file ); | |||||
} | |||||
} | |||||
} |
@@ -44,7 +44,7 @@ public class JavaTask | |||||
public void addClasspath( final Path classpath ) | public void addClasspath( final Path classpath ) | ||||
throws TaskException | throws TaskException | ||||
{ | { | ||||
m_exec.getClassPath().addPath( classpath ); | |||||
m_exec.getClassPath().add( classpath ); | |||||
} | } | ||||
/** | /** | ||||
@@ -109,7 +109,7 @@ public class XMLValidateTask | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_classpath.addPath( classpath ); | |||||
m_classpath.add( classpath ); | |||||
} | } | ||||
} | } | ||||
@@ -170,7 +170,7 @@ public class XMLValidateTask | |||||
} | } | ||||
Path path1 = m_classpath; | Path path1 = m_classpath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -142,7 +142,7 @@ public class XSLTProcess | |||||
{ | { | ||||
m_classpath = new Path(); | m_classpath = new Path(); | ||||
} | } | ||||
m_classpath.addPath( path ); | |||||
m_classpath.add( path ); | |||||
} | } | ||||
public void addParam( final XSLTParam param ) | public void addParam( final XSLTParam param ) | ||||
@@ -15,6 +15,8 @@ import java.io.File; | |||||
* | * | ||||
* @author <a href="mailto:peter@apache.org">Peter Donald</a> | * @author <a href="mailto:peter@apache.org">Peter Donald</a> | ||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
* | |||||
* @ant:data-type name="fileset" | |||||
*/ | */ | ||||
public class FileSet | public class FileSet | ||||
extends AbstractFileSet | extends AbstractFileSet | ||||
@@ -100,7 +100,8 @@ public class Pattern | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
final boolean result = getCondition().evaluate( context ); | |||||
final Condition condition = getCondition(); | |||||
final boolean result = ( condition == null || condition.evaluate( context ) ); | |||||
if( result ) | if( result ) | ||||
{ | { | ||||
return getName(); | return getName(); | ||||
@@ -15,6 +15,8 @@ import org.apache.myrmidon.api.TaskException; | |||||
* | * | ||||
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | ||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
* | |||||
* @ant:role shorthand="path" | |||||
*/ | */ | ||||
public interface FileList | public interface FileList | ||||
{ | { | ||||
@@ -59,7 +59,7 @@ public class Path | |||||
public Path( final String path ) | public Path( final String path ) | ||||
{ | { | ||||
addPath( path ); | |||||
add( path ); | |||||
} | } | ||||
public Path() | public Path() | ||||
@@ -110,13 +110,13 @@ public class Path | |||||
*/ | */ | ||||
public void setPath( final String path ) | public void setPath( final String path ) | ||||
{ | { | ||||
addPath( path ); | |||||
add( path ); | |||||
} | } | ||||
/** | /** | ||||
* Adds a path. | * Adds a path. | ||||
*/ | */ | ||||
public void addPath( final String path ) | |||||
public void add( final String path ) | |||||
{ | { | ||||
final FileList pathElement = new ParsedPathElement( path ); | final FileList pathElement = new ParsedPathElement( path ); | ||||
m_elements.add( pathElement ); | m_elements.add( pathElement ); | ||||
@@ -125,18 +125,18 @@ public class Path | |||||
/** | /** | ||||
* Adds a path. | * Adds a path. | ||||
*/ | */ | ||||
public void addPath( final String[] path ) | |||||
public void add( final String[] path ) | |||||
{ | { | ||||
final FileList pathElement = new ArrayFileList( path ); | final FileList pathElement = new ArrayFileList( path ); | ||||
m_elements.add( pathElement ); | m_elements.add( pathElement ); | ||||
} | } | ||||
/** | /** | ||||
* Creates a nested <code><path></code> element. | |||||
* Adds a path. | |||||
*/ | */ | ||||
public void addPath( final Path path ) | |||||
public void add( final FileList list ) | |||||
{ | { | ||||
m_elements.add( path ); | |||||
m_elements.add( list ); | |||||
} | } | ||||
/** | /** | ||||
@@ -1,5 +0,0 @@ | |||||
<ant-lib version="1.0"> | |||||
<types> | |||||
<data-type name="property-test-type" classname="org.apache.antlib.core.test.PropertyTestType"/> | |||||
</types> | |||||
</ant-lib> |
@@ -0,0 +1,99 @@ | |||||
/* | |||||
* 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.myrmidon.framework.file.test; | |||||
import java.io.File; | |||||
import org.apache.avalon.excalibur.io.FileUtil; | |||||
import org.apache.myrmidon.AbstractProjectTest; | |||||
import org.apache.myrmidon.LogMessageTracker; | |||||
/** | |||||
* Test-cases for the <path> data type. | |||||
* | |||||
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | |||||
* @version $Revision$ $Date$ | |||||
*/ | |||||
public class PathTestCase | |||||
extends AbstractProjectTest | |||||
{ | |||||
public PathTestCase( final String name ) | |||||
{ | |||||
super( name ); | |||||
} | |||||
/** | |||||
* Tests setting the location attribute. | |||||
*/ | |||||
public void testLocationAttribute() throws Exception | |||||
{ | |||||
testPathContent( "set-location", new String[] { "location" } ); | |||||
} | |||||
/** | |||||
* Tests setting the path attribute. | |||||
*/ | |||||
public void testPathAttribute() throws Exception | |||||
{ | |||||
// Test a path with a single file | |||||
testPathContent( "set-path", new String[] { "single-file" } ); | |||||
// Test a path with several files, using ; separator | |||||
testPathContent( "set-multi-path", new String[] { "file1", "file2", ".." } ); | |||||
// Test a path with several files, using : separator | |||||
testPathContent( "set-multi-path2", new String[] { "file1", "file2", ".." } ); | |||||
} | |||||
/** | |||||
* Test using nested <path> elements. | |||||
*/ | |||||
public void testPathElement() throws Exception | |||||
{ | |||||
testPathContent( "nested-path", new String[] { "some-file" } ); | |||||
testPathContent( "mixed-path", new String[] { "file1", "file2", "file3", "file4", "file5" } ); | |||||
} | |||||
/** | |||||
* Test using nested <fileset> elements. | |||||
*/ | |||||
public void testFilesetElement() throws Exception | |||||
{ | |||||
testPathContent( "set-fileset", new String[] { "path.ant" } ); | |||||
} | |||||
/** | |||||
* Test using a nested custom file list implementation. | |||||
*/ | |||||
public void testCustomFileList() throws Exception | |||||
{ | |||||
testPathContent( "test-custom-file-list", new String[] { "file1" } ); | |||||
} | |||||
/** | |||||
* Executes a target, and asserts that a particular list of file names | |||||
* is logged. | |||||
*/ | |||||
private void testPathContent( final String targetName, | |||||
final String[] files ) throws Exception | |||||
{ | |||||
final File projectFile = getTestResource( "path.ant" ); | |||||
final File baseDir = projectFile.getParentFile(); | |||||
// Add each of the expected file names | |||||
final LogMessageTracker listener = new LogMessageTracker(); | |||||
for( int i = 0; i < files.length; i++ ) | |||||
{ | |||||
final String fileName = files[ i ]; | |||||
final File file = FileUtil.resolveFile( baseDir, fileName ); | |||||
listener.addExpectedMessage( targetName, file.getAbsolutePath() ); | |||||
} | |||||
// Execute the target | |||||
executeTarget( projectFile, targetName, listener ); | |||||
} | |||||
} |
@@ -0,0 +1,42 @@ | |||||
/* | |||||
* 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.myrmidon.framework.file.test; | |||||
import org.apache.myrmidon.framework.file.FileList; | |||||
import org.apache.myrmidon.api.TaskContext; | |||||
import org.apache.myrmidon.api.TaskException; | |||||
import java.io.File; | |||||
/** | |||||
* A test FileList implementation. | |||||
* | |||||
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | |||||
* @version $Revision$ $Date$ | |||||
* | |||||
* @ant:type type="path" name="test-file-list" | |||||
*/ | |||||
public class TestFileList | |||||
implements FileList | |||||
{ | |||||
private String m_name; | |||||
public void setName( final String name ) | |||||
{ | |||||
m_name = name; | |||||
} | |||||
/** | |||||
* Returns the files in this list. | |||||
*/ | |||||
public String[] listFiles( final TaskContext context ) | |||||
throws TaskException | |||||
{ | |||||
final File file = context.resolveFile( m_name ); | |||||
return new String[] { file.getAbsolutePath() }; | |||||
} | |||||
} |
@@ -0,0 +1,67 @@ | |||||
<project version="2.0"> | |||||
<!-- Test setting the location attribute --> | |||||
<target name="set-location"> | |||||
<list-path> | |||||
<path location="location"/> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test setting the path attribute --> | |||||
<target name="set-path"> | |||||
<list-path> | |||||
<path path="single-file"/> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test setting the path attribute --> | |||||
<target name="set-multi-path"> | |||||
<list-path> | |||||
<path path="file1;file2;.."/> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test setting the path attribute --> | |||||
<target name="set-multi-path2"> | |||||
<list-path> | |||||
<path path="file1:file2:.."/> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test using a nested <path> element --> | |||||
<target name="nested-path"> | |||||
<list-path> | |||||
<path> | |||||
<path location="some-file"/> | |||||
</path> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test using a mix of attributes and nested <path> elements --> | |||||
<target name="mixed-path"> | |||||
<list-path> | |||||
<path location="file1" path="file2;file3"> | |||||
<path location="file4"/> | |||||
<path location="file5"/> | |||||
</path> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test using a nested fileset --> | |||||
<target name="set-fileset"> | |||||
<list-path> | |||||
<path> | |||||
<fileset dir="." includes="**/path.ant"/> | |||||
</path> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test using a custom file list implementation --> | |||||
<target name="test-custom-file-list"> | |||||
<list-path> | |||||
<path> | |||||
<test-file-list name="file1"/> | |||||
</path> | |||||
</list-path> | |||||
</target> | |||||
</project> |
@@ -1,5 +0,0 @@ | |||||
<ant-lib version="1.0"> | |||||
<types> | |||||
<data-type name="property-test-type" classname="org.apache.antlib.core.test.PropertyTestType"/> | |||||
</types> | |||||
</ant-lib> |
@@ -0,0 +1,99 @@ | |||||
/* | |||||
* 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.myrmidon.framework.file.test; | |||||
import java.io.File; | |||||
import org.apache.avalon.excalibur.io.FileUtil; | |||||
import org.apache.myrmidon.AbstractProjectTest; | |||||
import org.apache.myrmidon.LogMessageTracker; | |||||
/** | |||||
* Test-cases for the <path> data type. | |||||
* | |||||
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | |||||
* @version $Revision$ $Date$ | |||||
*/ | |||||
public class PathTestCase | |||||
extends AbstractProjectTest | |||||
{ | |||||
public PathTestCase( final String name ) | |||||
{ | |||||
super( name ); | |||||
} | |||||
/** | |||||
* Tests setting the location attribute. | |||||
*/ | |||||
public void testLocationAttribute() throws Exception | |||||
{ | |||||
testPathContent( "set-location", new String[] { "location" } ); | |||||
} | |||||
/** | |||||
* Tests setting the path attribute. | |||||
*/ | |||||
public void testPathAttribute() throws Exception | |||||
{ | |||||
// Test a path with a single file | |||||
testPathContent( "set-path", new String[] { "single-file" } ); | |||||
// Test a path with several files, using ; separator | |||||
testPathContent( "set-multi-path", new String[] { "file1", "file2", ".." } ); | |||||
// Test a path with several files, using : separator | |||||
testPathContent( "set-multi-path2", new String[] { "file1", "file2", ".." } ); | |||||
} | |||||
/** | |||||
* Test using nested <path> elements. | |||||
*/ | |||||
public void testPathElement() throws Exception | |||||
{ | |||||
testPathContent( "nested-path", new String[] { "some-file" } ); | |||||
testPathContent( "mixed-path", new String[] { "file1", "file2", "file3", "file4", "file5" } ); | |||||
} | |||||
/** | |||||
* Test using nested <fileset> elements. | |||||
*/ | |||||
public void testFilesetElement() throws Exception | |||||
{ | |||||
testPathContent( "set-fileset", new String[] { "path.ant" } ); | |||||
} | |||||
/** | |||||
* Test using a nested custom file list implementation. | |||||
*/ | |||||
public void testCustomFileList() throws Exception | |||||
{ | |||||
testPathContent( "test-custom-file-list", new String[] { "file1" } ); | |||||
} | |||||
/** | |||||
* Executes a target, and asserts that a particular list of file names | |||||
* is logged. | |||||
*/ | |||||
private void testPathContent( final String targetName, | |||||
final String[] files ) throws Exception | |||||
{ | |||||
final File projectFile = getTestResource( "path.ant" ); | |||||
final File baseDir = projectFile.getParentFile(); | |||||
// Add each of the expected file names | |||||
final LogMessageTracker listener = new LogMessageTracker(); | |||||
for( int i = 0; i < files.length; i++ ) | |||||
{ | |||||
final String fileName = files[ i ]; | |||||
final File file = FileUtil.resolveFile( baseDir, fileName ); | |||||
listener.addExpectedMessage( targetName, file.getAbsolutePath() ); | |||||
} | |||||
// Execute the target | |||||
executeTarget( projectFile, targetName, listener ); | |||||
} | |||||
} |
@@ -0,0 +1,42 @@ | |||||
/* | |||||
* 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.myrmidon.framework.file.test; | |||||
import org.apache.myrmidon.framework.file.FileList; | |||||
import org.apache.myrmidon.api.TaskContext; | |||||
import org.apache.myrmidon.api.TaskException; | |||||
import java.io.File; | |||||
/** | |||||
* A test FileList implementation. | |||||
* | |||||
* @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a> | |||||
* @version $Revision$ $Date$ | |||||
* | |||||
* @ant:type type="path" name="test-file-list" | |||||
*/ | |||||
public class TestFileList | |||||
implements FileList | |||||
{ | |||||
private String m_name; | |||||
public void setName( final String name ) | |||||
{ | |||||
m_name = name; | |||||
} | |||||
/** | |||||
* Returns the files in this list. | |||||
*/ | |||||
public String[] listFiles( final TaskContext context ) | |||||
throws TaskException | |||||
{ | |||||
final File file = context.resolveFile( m_name ); | |||||
return new String[] { file.getAbsolutePath() }; | |||||
} | |||||
} |
@@ -0,0 +1,67 @@ | |||||
<project version="2.0"> | |||||
<!-- Test setting the location attribute --> | |||||
<target name="set-location"> | |||||
<list-path> | |||||
<path location="location"/> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test setting the path attribute --> | |||||
<target name="set-path"> | |||||
<list-path> | |||||
<path path="single-file"/> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test setting the path attribute --> | |||||
<target name="set-multi-path"> | |||||
<list-path> | |||||
<path path="file1;file2;.."/> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test setting the path attribute --> | |||||
<target name="set-multi-path2"> | |||||
<list-path> | |||||
<path path="file1:file2:.."/> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test using a nested <path> element --> | |||||
<target name="nested-path"> | |||||
<list-path> | |||||
<path> | |||||
<path location="some-file"/> | |||||
</path> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test using a mix of attributes and nested <path> elements --> | |||||
<target name="mixed-path"> | |||||
<list-path> | |||||
<path location="file1" path="file2;file3"> | |||||
<path location="file4"/> | |||||
<path location="file5"/> | |||||
</path> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test using a nested fileset --> | |||||
<target name="set-fileset"> | |||||
<list-path> | |||||
<path> | |||||
<fileset dir="." includes="**/path.ant"/> | |||||
</path> | |||||
</list-path> | |||||
</target> | |||||
<!-- Test using a custom file list implementation --> | |||||
<target name="test-custom-file-list"> | |||||
<list-path> | |||||
<path> | |||||
<test-file-list name="file1"/> | |||||
</path> | |||||
</list-path> | |||||
</target> | |||||
</project> |
@@ -69,7 +69,7 @@ public class ANTLR | |||||
*/ | */ | ||||
public void addClasspath( final Path path ) | public void addClasspath( final Path path ) | ||||
{ | { | ||||
m_exe.getClassPath().addPath( path ); | |||||
m_exe.getClassPath().add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -488,7 +488,7 @@ public class IContract extends MatchingTask | |||||
*/ | */ | ||||
public void setClasspath( final Path path ) | public void setClasspath( final Path path ) | ||||
{ | { | ||||
createClasspath().addPath( path ); | |||||
createClasspath().add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -709,12 +709,12 @@ public class IContract extends MatchingTask | |||||
// Create the classpath required to compile the sourcefiles BEFORE instrumentation | // Create the classpath required to compile the sourcefiles BEFORE instrumentation | ||||
Path beforeInstrumentationClasspath = new Path(); | Path beforeInstrumentationClasspath = new Path(); | ||||
beforeInstrumentationClasspath.addPath( baseClasspath ); | |||||
beforeInstrumentationClasspath.add( baseClasspath ); | |||||
beforeInstrumentationClasspath.addLocation( srcDir ); | beforeInstrumentationClasspath.addLocation( srcDir ); | ||||
// Create the classpath required to compile the sourcefiles AFTER instrumentation | // Create the classpath required to compile the sourcefiles AFTER instrumentation | ||||
Path afterInstrumentationClasspath = new Path(); | Path afterInstrumentationClasspath = new Path(); | ||||
afterInstrumentationClasspath.addPath( baseClasspath ); | |||||
afterInstrumentationClasspath.add( baseClasspath ); | |||||
afterInstrumentationClasspath.addLocation( instrumentDir ); | afterInstrumentationClasspath.addLocation( instrumentDir ); | ||||
afterInstrumentationClasspath.addLocation( repositoryDir ); | afterInstrumentationClasspath.addLocation( repositoryDir ); | ||||
afterInstrumentationClasspath.addLocation( srcDir ); | afterInstrumentationClasspath.addLocation( srcDir ); | ||||
@@ -722,7 +722,7 @@ public class IContract extends MatchingTask | |||||
// Create the classpath required to automatically compile the repository files | // Create the classpath required to automatically compile the repository files | ||||
Path repositoryClasspath = new Path(); | Path repositoryClasspath = new Path(); | ||||
repositoryClasspath.addPath( baseClasspath ); | |||||
repositoryClasspath.add( baseClasspath ); | |||||
repositoryClasspath.addLocation( instrumentDir ); | repositoryClasspath.addLocation( instrumentDir ); | ||||
repositoryClasspath.addLocation( srcDir ); | repositoryClasspath.addLocation( srcDir ); | ||||
repositoryClasspath.addLocation( repositoryDir ); | repositoryClasspath.addLocation( repositoryDir ); | ||||
@@ -730,7 +730,7 @@ public class IContract extends MatchingTask | |||||
// Create the classpath required for iContract itself | // Create the classpath required for iContract itself | ||||
Path iContractClasspath = new Path(); | Path iContractClasspath = new Path(); | ||||
iContractClasspath.addPath( baseClasspath ); | |||||
iContractClasspath.add( baseClasspath ); | |||||
iContractClasspath.addLocation( new File(System.getProperty( "java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar" ) ); | iContractClasspath.addLocation( new File(System.getProperty( "java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar" ) ); | ||||
iContractClasspath.addLocation( srcDir ); | iContractClasspath.addLocation( srcDir ); | ||||
iContractClasspath.addLocation( repositoryDir ); | iContractClasspath.addLocation( repositoryDir ); | ||||
@@ -79,7 +79,7 @@ public class Javah | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_bootclasspath.addPath( bootclasspath ); | |||||
m_bootclasspath.add( bootclasspath ); | |||||
} | } | ||||
} | } | ||||
@@ -100,7 +100,7 @@ public class Javah | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_classpath.addPath( classpath ); | |||||
m_classpath.add( classpath ); | |||||
} | } | ||||
} | } | ||||
@@ -108,7 +108,7 @@ public class PathConvert extends AbstractTask | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_path.addPath( path ); | |||||
m_path.add( path ); | |||||
} | } | ||||
} | } | ||||
@@ -45,7 +45,7 @@ public class Property | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_classpath.addPath( classpath ); | |||||
m_classpath.add( classpath ); | |||||
} | } | ||||
} | } | ||||
@@ -178,7 +178,7 @@ public class SQLExec | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
this.classpath.addPath( classpath ); | |||||
this.classpath.add( classpath ); | |||||
} | } | ||||
} | } | ||||
@@ -295,7 +295,7 @@ public abstract class DefaultCompilerAdapter | |||||
// add the classpath | // add the classpath | ||||
if( m_compileClasspath != null ) | if( m_compileClasspath != null ) | ||||
{ | { | ||||
classpath.addPath( m_compileClasspath ); | |||||
classpath.add( m_compileClasspath ); | |||||
} | } | ||||
} | } | ||||
@@ -50,7 +50,7 @@ public class Gcj extends DefaultCompilerAdapter | |||||
// gcj doesn't support bootclasspath dir (-bootclasspath) | // gcj doesn't support bootclasspath dir (-bootclasspath) | ||||
// so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
final String[] bootclasspath = m_bootclasspath.listFiles( getTaskContext() ); | final String[] bootclasspath = m_bootclasspath.listFiles( getTaskContext() ); | ||||
classpath.addPath( bootclasspath ); | |||||
classpath.add( bootclasspath ); | |||||
// gcj doesn't support an extension dir (-extdir) | // gcj doesn't support an extension dir (-extdir) | ||||
// so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
@@ -66,7 +66,7 @@ public class Gcj extends DefaultCompilerAdapter | |||||
// Gcj has no option for source-path so we | // Gcj has no option for source-path so we | ||||
// will add it to classpath. | // will add it to classpath. | ||||
classpath.addPath( src ); | |||||
classpath.add( src ); | |||||
cmd.setExecutable( "gcj" ); | cmd.setExecutable( "gcj" ); | ||||
@@ -89,7 +89,7 @@ public class Javac | |||||
*/ | */ | ||||
public void addBootclasspath( final Path bootclasspath ) | public void addBootclasspath( final Path bootclasspath ) | ||||
{ | { | ||||
m_bootclasspath.addPath( bootclasspath ); | |||||
m_bootclasspath.add( bootclasspath ); | |||||
} | } | ||||
/** | /** | ||||
@@ -103,7 +103,7 @@ public class Javac | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_compileClasspath.addPath( classpath ); | |||||
m_compileClasspath.add( classpath ); | |||||
} | } | ||||
} | } | ||||
@@ -181,7 +181,7 @@ public class Javac | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_extdirs.addPath( extdirs ); | |||||
m_extdirs.add( extdirs ); | |||||
} | } | ||||
} | } | ||||
@@ -282,7 +282,7 @@ public class Javac | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_src.addPath( srcDir ); | |||||
m_src.add( srcDir ); | |||||
} | } | ||||
} | } | ||||
@@ -47,7 +47,7 @@ public class Jikes | |||||
// Jikes doesn't support bootclasspath dir (-bootclasspath) | // Jikes doesn't support bootclasspath dir (-bootclasspath) | ||||
// so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
final String[] bootclasspath = m_bootclasspath.listFiles( getTaskContext() ); | final String[] bootclasspath = m_bootclasspath.listFiles( getTaskContext() ); | ||||
classpath.addPath( bootclasspath ); | |||||
classpath.add( bootclasspath ); | |||||
// Jikes doesn't support an extension dir (-extdir) | // Jikes doesn't support an extension dir (-extdir) | ||||
// so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
@@ -67,13 +67,13 @@ public class Jikes | |||||
// Jikes has no option for source-path so we | // Jikes has no option for source-path so we | ||||
// will add it to classpath. | // will add it to classpath. | ||||
classpath.addPath( src ); | |||||
classpath.add( src ); | |||||
// if the user has set JIKESPATH we should add the contents as well | // if the user has set JIKESPATH we should add the contents as well | ||||
String jikesPath = System.getProperty( "jikes.class.path" ); | String jikesPath = System.getProperty( "jikes.class.path" ); | ||||
if( jikesPath != null ) | if( jikesPath != null ) | ||||
{ | { | ||||
classpath.addPath( jikesPath ); | |||||
classpath.add( jikesPath ); | |||||
} | } | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
@@ -35,7 +35,7 @@ public class Jvc extends DefaultCompilerAdapter | |||||
// jvc doesn't support bootclasspath dir (-bootclasspath) | // jvc doesn't support bootclasspath dir (-bootclasspath) | ||||
// so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
final String[] bootclasspath = m_bootclasspath.listFiles( getTaskContext() ); | final String[] bootclasspath = m_bootclasspath.listFiles( getTaskContext() ); | ||||
classpath.addPath( bootclasspath ); | |||||
classpath.add( bootclasspath ); | |||||
// jvc doesn't support an extension dir (-extdir) | // jvc doesn't support an extension dir (-extdir) | ||||
// so we'll emulate it for compatibility and convenience. | // so we'll emulate it for compatibility and convenience. | ||||
@@ -55,7 +55,7 @@ public class Jvc extends DefaultCompilerAdapter | |||||
// jvc has no option for source-path so we | // jvc has no option for source-path so we | ||||
// will add it to classpath. | // will add it to classpath. | ||||
classpath.addPath( src ); | |||||
classpath.add( src ); | |||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
cmd.setExecutable( "jvc" ); | cmd.setExecutable( "jvc" ); | ||||
@@ -89,15 +89,15 @@ public class Kjc extends DefaultCompilerAdapter | |||||
Path cp = new Path(); | Path cp = new Path(); | ||||
// kjc don't have bootclasspath option. | // kjc don't have bootclasspath option. | ||||
cp.addPath( m_bootclasspath ); | |||||
cp.add( m_bootclasspath ); | |||||
if( m_extdirs != null ) | if( m_extdirs != null ) | ||||
{ | { | ||||
addExtdirs( cp ); | addExtdirs( cp ); | ||||
} | } | ||||
cp.addPath( classpath ); | |||||
cp.addPath( src ); | |||||
cp.add( classpath ); | |||||
cp.add( src ); | |||||
cmd.addArgument( PathUtil.formatPath( cp, getTaskContext() ) ); | cmd.addArgument( PathUtil.formatPath( cp, getTaskContext() ) ); | ||||
@@ -32,7 +32,7 @@ public class DocletInfo | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_path.addPath( path ); | |||||
m_path.add( path ); | |||||
} | } | ||||
} | } | ||||
@@ -67,7 +67,7 @@ public class DocletInfo | |||||
} | } | ||||
Path path1 = m_path; | Path path1 = m_path; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
} | } |
@@ -114,7 +114,7 @@ public class Javadoc | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_bootclasspath.addPath( src ); | |||||
m_bootclasspath.add( src ); | |||||
} | } | ||||
} | } | ||||
@@ -139,7 +139,7 @@ public class Javadoc | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_classpath.addPath( src ); | |||||
m_classpath.add( src ); | |||||
} | } | ||||
} | } | ||||
@@ -384,7 +384,7 @@ public class Javadoc | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
m_sourcePath.addPath( src ); | |||||
m_sourcePath.add( src ); | |||||
} | } | ||||
} | } | ||||
@@ -475,7 +475,7 @@ public class Javadoc | |||||
} | } | ||||
Path path1 = m_bootclasspath; | Path path1 = m_bootclasspath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -488,7 +488,7 @@ public class Javadoc | |||||
} | } | ||||
Path path1 = m_classpath; | Path path1 = m_classpath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -521,7 +521,7 @@ public class Javadoc | |||||
} | } | ||||
Path path1 = m_sourcePath; | Path path1 = m_sourcePath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -564,10 +564,10 @@ public class Javadoc | |||||
// Build the classpath to pass to Javadoc | // Build the classpath to pass to Javadoc | ||||
Path classpath = new Path(); | Path classpath = new Path(); | ||||
classpath.addPath( m_sourcePath ); | |||||
classpath.add( m_sourcePath ); | |||||
if( m_classpath != null ) | if( m_classpath != null ) | ||||
{ | { | ||||
classpath.addPath( m_classpath ); | |||||
classpath.add( m_classpath ); | |||||
} | } | ||||
cmd.addArgument( "-classpath" ); | cmd.addArgument( "-classpath" ); | ||||
cmd.addArgument( PathUtil.formatPath( classpath, getContext() ) ); | cmd.addArgument( PathUtil.formatPath( classpath, getContext() ) ); | ||||
@@ -105,7 +105,7 @@ public class JDependTask | |||||
*/ | */ | ||||
public void addClasspath( final Path path ) | public void addClasspath( final Path path ) | ||||
{ | { | ||||
m_compileClasspath.addPath( path ); | |||||
m_compileClasspath.add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -119,7 +119,7 @@ public class JDependTask | |||||
} | } | ||||
Path path1 = m_sourcesPath; | Path path1 = m_sourcesPath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -169,7 +169,7 @@ public class JDependTask | |||||
exe.setJvm( m_jvm ); | exe.setJvm( m_jvm ); | ||||
} | } | ||||
exe.getClassPath().addPath( m_compileClasspath ); | |||||
exe.getClassPath().add( m_compileClasspath ); | |||||
if( m_outputFile != null ) | if( m_outputFile != null ) | ||||
{ | { | ||||
@@ -107,7 +107,7 @@ public class JspC extends MatchingTask | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
classpath.addPath( cp ); | |||||
classpath.add( cp ); | |||||
} | } | ||||
} | } | ||||
@@ -185,7 +185,7 @@ public class JspC extends MatchingTask | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
src.addPath( srcDir ); | |||||
src.add( srcDir ); | |||||
} | } | ||||
} | } | ||||
@@ -308,7 +308,7 @@ public class JspC extends MatchingTask | |||||
} | } | ||||
Path path1 = classpath; | Path path1 = classpath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -82,7 +82,7 @@ public class WLJspc extends MatchingTask | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
compileClasspath.addPath( classpath ); | |||||
compileClasspath.add( classpath ); | |||||
} | } | ||||
} | } | ||||
@@ -219,7 +219,7 @@ public class WLJspc extends MatchingTask | |||||
ExecuteJava helperTask = new ExecuteJava(); | ExecuteJava helperTask = new ExecuteJava(); | ||||
helperTask.setClassName( "weblogic.jspc" ); | helperTask.setClassName( "weblogic.jspc" ); | ||||
helperTask.getArguments().addArguments( args ); | helperTask.getArguments().addArguments( args ); | ||||
helperTask.getClassPath().addPath( compileClasspath ); | |||||
helperTask.getClassPath().add( compileClasspath ); | |||||
helperTask.executeForked( getContext() ); | helperTask.executeForked( getContext() ); | ||||
} | } | ||||
} | } | ||||
@@ -331,7 +331,7 @@ public class JUnitTask extends AbstractTask | |||||
*/ | */ | ||||
public void addClasspath( final Path path ) | public void addClasspath( final Path path ) | ||||
{ | { | ||||
classPath.addPath( path ); | |||||
classPath.add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -567,7 +567,7 @@ public class JUnitTask extends AbstractTask | |||||
cmd.setIgnoreReturnCode( true ); | cmd.setIgnoreReturnCode( true ); | ||||
cmd.setWorkingDirectory( dir ); | cmd.setWorkingDirectory( dir ); | ||||
cmd.setMaxMemory( maxMem ); | cmd.setMaxMemory( maxMem ); | ||||
cmd.getClassPath().addPath( classPath ); | |||||
cmd.getClassPath().add( classPath ); | |||||
cmd.getVmArguments().addArguments( vmArgs ); | cmd.getVmArguments().addArguments( vmArgs ); | ||||
cmd.getSysProperties().addVariables( sysProperties ); | cmd.getSysProperties().addVariables( sysProperties ); | ||||
@@ -128,7 +128,7 @@ public abstract class AbstractMetamataTask | |||||
*/ | */ | ||||
public void addClasspath( final Path path ) | public void addClasspath( final Path path ) | ||||
{ | { | ||||
m_exe.getClassPath().addPath( path ); | |||||
m_exe.getClassPath().add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -144,7 +144,7 @@ public abstract class AbstractMetamataTask | |||||
*/ | */ | ||||
public void addSourcepath( final Path path ) | public void addSourcepath( final Path path ) | ||||
{ | { | ||||
m_sourcePath.addPath( path ); | |||||
m_sourcePath.add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -124,10 +124,10 @@ public class MAudit | |||||
// there is a bug in Metamata 2.0 build 37. The sourcepath argument does | // there is a bug in Metamata 2.0 build 37. The sourcepath argument does | ||||
// not work. So we will use the sourcepath prepended to classpath. (order | // not work. So we will use the sourcepath prepended to classpath. (order | ||||
// is important since Metamata looks at .class and .java) | // is important since Metamata looks at .class and .java) | ||||
classpath.addPath( getSourcePath() ); | |||||
classpath.add( getSourcePath() ); | |||||
// don't forget to modify the pattern if you change the options reporting | // don't forget to modify the pattern if you change the options reporting | ||||
classpath.addPath( getClassPath() ); | |||||
classpath.add( getClassPath() ); | |||||
final String formattedClasspath = PathUtil.formatPath( classpath, getContext() ); | final String formattedClasspath = PathUtil.formatPath( classpath, getContext() ); | ||||
if( formattedClasspath.length() > 0 ) | if( formattedClasspath.length() > 0 ) | ||||
@@ -127,10 +127,10 @@ public class MMetrics extends AbstractMetamataTask | |||||
// there is a bug in Metamata 2.0 build 37. The sourcepath argument does | // there is a bug in Metamata 2.0 build 37. The sourcepath argument does | ||||
// not work. So we will use the sourcepath prepended to classpath. (order | // not work. So we will use the sourcepath prepended to classpath. (order | ||||
// is important since Metamata looks at .class and .java) | // is important since Metamata looks at .class and .java) | ||||
classpath.addPath( getSourcePath() ); | |||||
classpath.add( getSourcePath() ); | |||||
// don't forget to modify the pattern if you change the options reporting | // don't forget to modify the pattern if you change the options reporting | ||||
classpath.addPath( getClassPath() ); | |||||
classpath.add( getClassPath() ); | |||||
final String formattedClasspath = PathUtil.formatPath( classpath, getContext() ); | final String formattedClasspath = PathUtil.formatPath( classpath, getContext() ); | ||||
if( formattedClasspath.length() > 0 ) | if( formattedClasspath.length() > 0 ) | ||||
@@ -132,7 +132,7 @@ public class MParse | |||||
*/ | */ | ||||
public void addClasspath( final Path path ) | public void addClasspath( final Path path ) | ||||
{ | { | ||||
m_classpath.addPath( path ); | |||||
m_classpath.add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -148,7 +148,7 @@ public class MParse | |||||
*/ | */ | ||||
public void addSourcepath( final Path path ) | public void addSourcepath( final Path path ) | ||||
{ | { | ||||
m_sourcepath.addPath( path ); | |||||
m_sourcepath.add( path ); | |||||
} | } | ||||
/** | /** | ||||
@@ -195,7 +195,7 @@ public abstract class DefaultRmicAdapter | |||||
// add the classpath | // add the classpath | ||||
if( attributes.getClasspath() != null ) | if( attributes.getClasspath() != null ) | ||||
{ | { | ||||
classpath.addPath( attributes.getClasspath() ); | |||||
classpath.add( attributes.getClasspath() ); | |||||
} | } | ||||
return classpath; | return classpath; | ||||
@@ -116,7 +116,7 @@ public class Rmic extends MatchingTask | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
compileClasspath.addPath( classpath ); | |||||
compileClasspath.add( classpath ); | |||||
} | } | ||||
} | } | ||||
@@ -145,7 +145,7 @@ public class Rmic extends MatchingTask | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
this.extdirs.addPath( extdirs ); | |||||
this.extdirs.add( extdirs ); | |||||
} | } | ||||
} | } | ||||
@@ -206,7 +206,7 @@ public class CovReport | |||||
} | } | ||||
Path path1 = coveragePath; | Path path1 = coveragePath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -227,7 +227,7 @@ public class CovReport | |||||
} | } | ||||
Path path1 = sourcePath; | Path path1 = sourcePath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -292,7 +292,7 @@ public class CovReport | |||||
sourcePath = new Path(); | sourcePath = new Path(); | ||||
Path path1 = sourcePath; | Path path1 = sourcePath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
path.setLocation( getBaseDirectory() ); | path.setLocation( getBaseDirectory() ); | ||||
} | } | ||||
v.add( "-sourcepath=" + sourcePath ); | v.add( "-sourcepath=" + sourcePath ); | ||||
@@ -368,7 +368,7 @@ public class CovReport | |||||
} | } | ||||
Path path1 = classPath; | Path path1 = classPath; | ||||
final Path path = new Path(); | final Path path = new Path(); | ||||
path1.addPath( path ); | |||||
path1.add( path ); | |||||
return path; | return path; | ||||
} | } | ||||
@@ -184,7 +184,7 @@ public class Coverage | |||||
*/ | */ | ||||
public void setClasspath( final Path path ) | public void setClasspath( final Path path ) | ||||
{ | { | ||||
m_classpath.addPath( path ); | |||||
m_classpath.add( path ); | |||||
} | } | ||||
public Filters createFilters() | public Filters createFilters() | ||||