|
|
@@ -21,6 +21,7 @@ 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.tools.todo.types.Path; |
|
|
|
import org.apache.tools.todo.types.PathUtil; |
|
|
|
|
|
|
|
/** |
|
|
|
* Instruments Java classes with <a href="http://www.reliable-systems.com/tools/"> |
|
|
@@ -484,9 +485,9 @@ public class IContract extends MatchingTask |
|
|
|
* @param path The new Classpath value |
|
|
|
* @path the classpath |
|
|
|
*/ |
|
|
|
public void setClasspath( Path path ) |
|
|
|
public void setClasspath( final Path path ) |
|
|
|
{ |
|
|
|
createClasspath().append( path ); |
|
|
|
createClasspath().addPath( path ); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@@ -706,30 +707,34 @@ public class IContract extends MatchingTask |
|
|
|
classpathHelper.modify( baseClasspath ); |
|
|
|
|
|
|
|
// Create the classpath required to compile the sourcefiles BEFORE instrumentation |
|
|
|
Path beforeInstrumentationClasspath = ( (Path)baseClasspath.clone() ); |
|
|
|
beforeInstrumentationClasspath.append( new Path( srcDir.getAbsolutePath() ) ); |
|
|
|
Path beforeInstrumentationClasspath = new Path(); |
|
|
|
beforeInstrumentationClasspath.addPath( baseClasspath ); |
|
|
|
beforeInstrumentationClasspath.addLocation( srcDir ); |
|
|
|
|
|
|
|
// Create the classpath required to compile the sourcefiles AFTER instrumentation |
|
|
|
Path afterInstrumentationClasspath = ( (Path)baseClasspath.clone() ); |
|
|
|
afterInstrumentationClasspath.append( new Path( instrumentDir.getAbsolutePath() ) ); |
|
|
|
afterInstrumentationClasspath.append( new Path( repositoryDir.getAbsolutePath() ) ); |
|
|
|
afterInstrumentationClasspath.append( new Path( srcDir.getAbsolutePath() ) ); |
|
|
|
afterInstrumentationClasspath.append( new Path( buildDir.getAbsolutePath() ) ); |
|
|
|
Path afterInstrumentationClasspath = new Path(); |
|
|
|
afterInstrumentationClasspath.addPath( 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 = ( (Path)baseClasspath.clone() ); |
|
|
|
repositoryClasspath.append( new Path( instrumentDir.getAbsolutePath() ) ); |
|
|
|
repositoryClasspath.append( new Path( srcDir.getAbsolutePath() ) ); |
|
|
|
repositoryClasspath.append( new Path( repositoryDir.getAbsolutePath() ) ); |
|
|
|
repositoryClasspath.append( new Path( buildDir.getAbsolutePath() ) ); |
|
|
|
Path repositoryClasspath = new Path(); |
|
|
|
repositoryClasspath.addPath( baseClasspath ); |
|
|
|
repositoryClasspath.addLocation( instrumentDir ); |
|
|
|
repositoryClasspath.addLocation( srcDir ); |
|
|
|
repositoryClasspath.addLocation( repositoryDir ); |
|
|
|
repositoryClasspath.addLocation( buildDir ); |
|
|
|
|
|
|
|
// Create the classpath required for iContract itself |
|
|
|
Path iContractClasspath = ( (Path)baseClasspath.clone() ); |
|
|
|
iContractClasspath.append( new Path( System.getProperty( "java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar" ) ); |
|
|
|
iContractClasspath.append( new Path( srcDir.getAbsolutePath() ) ); |
|
|
|
iContractClasspath.append( new Path( repositoryDir.getAbsolutePath() ) ); |
|
|
|
iContractClasspath.append( new Path( instrumentDir.getAbsolutePath() ) ); |
|
|
|
iContractClasspath.append( new Path( buildDir.getAbsolutePath() ) ); |
|
|
|
Path iContractClasspath = new Path(); |
|
|
|
iContractClasspath.addPath( 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 |
|
|
|
Java iContract = null;//(Java)getProject().createTask( "java" ); |
|
|
@@ -768,7 +773,7 @@ public class IContract extends MatchingTask |
|
|
|
} |
|
|
|
iControlProps.setProperty( "sourceRoot", srcDir.getAbsolutePath() ); |
|
|
|
iControlProps.setProperty( "classRoot", classDir.getAbsolutePath() ); |
|
|
|
iControlProps.setProperty( "classpath", afterInstrumentationClasspath.toString() ); |
|
|
|
iControlProps.setProperty( "classpath", PathUtil.formatPath( afterInstrumentationClasspath ) ); |
|
|
|
iControlProps.setProperty( "controlFile", controlFile.getAbsolutePath() ); |
|
|
|
iControlProps.setProperty( "targetsFile", targets.getAbsolutePath() ); |
|
|
|
|
|
|
@@ -1027,7 +1032,7 @@ public class IContract extends MatchingTask |
|
|
|
{ |
|
|
|
icCompiler = compiler; |
|
|
|
m_includeJavaRuntime = true; |
|
|
|
path.append( getCompileClasspath() ); |
|
|
|
addCompileClasspath( path ); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|