git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268748 13f79535-47bb-0310-9956-ffa450edef68master
@@ -44,7 +44,7 @@ filtersfile attribute.</p> | |||
<p>* see notes 1 and 2 above parameters table.</p> | |||
<h3>Examples</h3> | |||
<pre> <filter token="year" value="2000"/> | |||
<copy todir="${dest.dir}"> | |||
<copy todir="${dest.dir}" filtering="true"> | |||
<fileset dir="${src.dir}"/> | |||
</copy></pre> | |||
<p>will copy recursively all the files from the <i>src.dir</i> directory into | |||
@@ -339,7 +339,9 @@ instead.</p> | |||
</tr> | |||
<tr> | |||
<td valign="top">additionalparam</td> | |||
<td valign="top">Lets you add additional parameters to the javadoc command line. Useful for doclets</td> | |||
<td valign="top">Lets you add additional parameters to the javadoc | |||
command line. Useful for doclets. Parameters containing | |||
spaces need to be quoted using &quot;.</td> | |||
<td align="center" valign="top">1.2</td> | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
@@ -0,0 +1,117 @@ | |||
<html> | |||
<head> | |||
<meta http-equiv="Content-Language" content="en-us"> | |||
<title>Ant</title> | |||
</head> | |||
<body> | |||
<h2><a name="zip">Javah</a></h2> | |||
<h3>Description</h3> | |||
<p>Generates JNI headers from a Java class.</p> | |||
<p> When this task executes, it will generate the C header and source files that | |||
are needed to implement native methods. JNI operates differently depending on | |||
whether <a href="http://java.sun.com/j2se/1.3/docs/tooldocs/win32/javah.html">JDK1.2</a> | |||
(or later) or <a href="http://java.sun.com/products/jdk/1.1/docs/tooldocs/win32/javah.html">pre-JDK1.2</a> | |||
systems are used.</p> | |||
<h3>Parameters</h3> | |||
<table border="1" cellpadding="2" cellspacing="0"> | |||
<tr> | |||
<td valign="top"><b>Attribute</b></td> | |||
<td valign="top"><b>Description</b></td> | |||
<td valign="top" align="center"><b>Required</b></td> | |||
</tr> | |||
<tr> | |||
<td valign="top">class</td> | |||
<td valign="top">the fully-qualified name of the class (or classes, | |||
separated by commas)</td> | |||
<td align="center" valign="top">Yes</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">outputFile</td> | |||
<td valign="top">concatenates the resulting header or source files for all the classes listed into this file</td> | |||
<td align="center" valign="middle" rowspan="2">Yes</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">destdir</td> | |||
<td valign="top">sets the directory where javah saves the header files or the | |||
stub files.</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">force</td> | |||
<td valign="top">specifies that output files should always be written (JDK1.2 only)</td> | |||
<td valign="top" align="center">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">old</td> | |||
<td valign="top">specifies that old JDK1.0-style header files should be generated | |||
(otherwise output file contain JNI-style native method function prototypes) (JDK1.2 only)</td> | |||
<td valign="top" align="center">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">stubs</td> | |||
<td valign="top">generate C declarations from the Java object file (used with old)</td> | |||
<td valign="top" align="center">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">verbose</td> | |||
<td valign="top">causes Javah to print a message concerning the status of the generated files</td> | |||
<td valign="top" align="center">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">classpath</td> | |||
<td valign="top">the classpath to use.</td> | |||
<td align="center" valign="top">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">bootclasspath</td> | |||
<td valign="top">location of bootstrap class files.</td> | |||
<td valign="top" align="center">No</td> | |||
</tr> | |||
<tr> | |||
<td valign="top">extdirs</td> | |||
<td valign="top"> location of installed extensions.</td> | |||
<td valign="top" align="center">No</td> | |||
</tr> | |||
</table> | |||
<p>Either outputFile or destdir must be supplied, but not both. </p> | |||
<h3>Examples</h3> | |||
<pre> <javah destdir="c" class="org.foo.bar.Wibble" /></pre> | |||
<p>makes a JNI header of the named class, using the JDK1.2 JNI model. Assuming | |||
the directory 'c' already exists, the file <tt>org_foo_bar_Wibble.h</tt> | |||
is created there. If this file already exists, it is left unchanged.</p> | |||
<pre> <javah outputFile="wibble.h"> | |||
<class name="org.foo.bar.Wibble,org.foo.bar.Bobble"/> | |||
</javah></pre> | |||
<p>is similar to the previous example, except the output is written to a file | |||
called <tt>wibble.h</tt> | |||
in the current directory.</p> | |||
<pre> <javah destdir="c" force="yes"> | |||
<class name="org.foo.bar.Wibble"/> | |||
<class name="org.foo.bar.Bobble"/> | |||
<class name="org.foo.bar.Tribble"/> | |||
</javah></pre> | |||
<p>writes three header files, one for each of the classes named. Because the | |||
force option is set, these header files are always written when the Javah task | |||
is invoked, even if they already exist.</p> | |||
<pre> <javah destdir="c" verbose="yes" old="yes" force="yes"> | |||
<class name="org.foo.bar.Wibble"/> | |||
<class name="org.foo.bar.Bobble"/> | |||
<class name="org.foo.bar.Tribble"/> | |||
</javah> | |||
<javah destdir="c" verbose="yes" stubs="yes" old="yes" force="yes"> | |||
<class name="org.foo.bar.Wibble"/> | |||
<class name="org.foo.bar.Bobble"/> | |||
<class name="org.foo.bar.Tribble"/> | |||
</javah></pre> | |||
<p>writes the headers for the three classes using the 'old' JNI format, then | |||
writes the corresponding .c stubs. The verbose option will cause Javah to | |||
describe its progress.</p> | |||
<hr> | |||
</body> | |||
</html> | |||
@@ -15,10 +15,12 @@ | |||
<a href="OptionalTasks/antlr.html">ANTLR</a><br> | |||
<a href="OptionalTasks/cab.html">Cab</a><br> | |||
<a href="OptionalTasks/clearcase.html">Clearcase Tasks</a><br> | |||
<a href="OptionalTasks/depend.html">Depend</a><br> | |||
<a href="OptionalTasks/ejb.html">EJB Tasks</a><br> | |||
<a href="OptionalTasks/ftp.html">FTP</a><br> | |||
<a href="OptionalTasks/javacc.html">JavaCC</a><br> | |||
<a href="OptionalTasks/icontract.html">IContract</a><br> | |||
<a href="OptionalTasks/javacc.html">JavaCC</a><br> | |||
<a href="OptionalTasks/javah.html">Javah</a><br> | |||
<a href="OptionalTasks/jjtree.html">JJTree</a><br> | |||
<a href="OptionalTasks/jlink.html">Jlink</a><br> | |||
<a href="OptionalTasks/junit.html">JUnit</a><br> | |||
@@ -26,15 +28,15 @@ | |||
<a href="OptionalTasks/mparse.html">MParse</a><br> | |||
<a href="OptionalTasks/native2ascii.html">Native2Ascii</a><br> | |||
<a href="OptionalTasks/netrexxc.html">NetRexxC</a><br> | |||
<a href="OptionalTasks/propertyfile.html">PropertyFile</a><br> | |||
<a href="OptionalTasks/perforce.html">Perforce Tasks</a><br> | |||
<a href="OptionalTasks/propertyfile.html">PropertyFile</a><br> | |||
<a href="OptionalTasks/pvcstask.html">Pvcs</a><br> | |||
<a href="OptionalTasks/renameextensions.html"><i>RenameExtensions</i></a><br> | |||
<a href="OptionalTasks/script.html">Script</a><br> | |||
<a href="OptionalTasks/sound.html">Sound</a><br> | |||
<a href="OptionalTasks/stylebook.html">Stylebook</a><br> | |||
<a href="OptionalTasks/test.html">Test</a><br> | |||
<a href="OptionalTasks/telnet.html">Telnet</a><br> | |||
<a href="OptionalTasks/test.html">Test</a><br> | |||
<a href="Integration/VAJAntTool.html#tasks">Visual Age for Java Tasks</a><br> | |||
<a href="OptionalTasks/vssget.html">VssGet</a><br> | |||
<a href="OptionalTasks/vsslabel.html">VssLabel</a><br> | |||
@@ -1,6 +1,6 @@ | |||
<?xml version="1.0"?> | |||
<project name="xxx-test" basedir="." default="test1"> | |||
<project name="tar-test" basedir="." default="test1"> | |||
<target name="test1"> | |||
<tar/> | |||
@@ -14,4 +14,14 @@ | |||
<tar basedir=""/> | |||
</target> | |||
<target name="test4"> | |||
<touch file="test4.tar"/> | |||
<tar tarfile="test4.tar" | |||
basedir="."/> | |||
</target> | |||
<target name="cleanup"> | |||
<delete file="test4.tar"/> | |||
</target> | |||
</project> |
@@ -1,6 +1,6 @@ | |||
<?xml version="1.0"?> | |||
<project name="xxx-test" basedir="." default="test1"> | |||
<project name="zip-test" basedir="." default="test1"> | |||
<target name="test1"> | |||
<zip/> | |||
@@ -10,4 +10,24 @@ | |||
<zip zipfile="zip.tmp"/> | |||
</target> | |||
<!-- Test when the zip file includes itself | |||
when target file exists before the zip task is run --> | |||
<target name="test3"> | |||
<touch file="test3.zip"/> | |||
<zip zipfile="test3.zip" | |||
basedir="."/> | |||
</target> | |||
<!-- Test when the zip file includes itself | |||
when target file does not exist before the zip task is run --> | |||
<target name="test4"> | |||
<zip zipfile="test4.zip" | |||
basedir="."/> | |||
</target> | |||
<target name="cleanup"> | |||
<delete file="test3.zip"/> | |||
<delete file="test4.zip"/> | |||
</target> | |||
</project> |
@@ -0,0 +1,19 @@ | |||
<?xml version="1.0"?> | |||
<project name="copy-test" basedir="." default="test1"> | |||
<target name="test1"> | |||
<delete dir="copytest" /> | |||
<mkdir dir="copytest" /> | |||
<copy todir="copytest"> | |||
<fileset dir="../../../main"> | |||
<include name="**/taskdefs/*.java" /> | |||
</fileset> | |||
<fileset dir="../../../testcases"> | |||
<include name="**/taskdefs/*.java" /> | |||
</fileset> | |||
<mapper type="flatten" /> | |||
</copy> | |||
</target> | |||
</project> |
@@ -736,7 +736,7 @@ strLoop: | |||
* (2) an IO error occurred (why doesn't it throw an exception | |||
* then???) | |||
*/ | |||
throw new BuildException("IO error scanning directory" | |||
throw new BuildException("IO error scanning directory " | |||
+ dir.getAbsolutePath()); | |||
} | |||
@@ -104,12 +104,17 @@ public class ProjectHelper { | |||
try { | |||
SAXParser saxParser = getParserFactory().newSAXParser(); | |||
parser = saxParser.getParser(); | |||
String uri = "file:" + buildFile.getAbsolutePath().replace('\\', '/'); | |||
for (int index = uri.indexOf('#'); index != -1; index = uri.indexOf('#')) { | |||
uri = uri.substring(0, index) + "%23" + uri.substring(index+1); | |||
} | |||
saxParser.parse(uri, new RootHandler()); | |||
inputStream = new FileInputStream(buildFile); | |||
inputSource = new InputSource(inputStream); | |||
inputSource.setSystemId(uri); | |||
project.log("parsing buildfile " + buildFile + " with URI = " + uri, Project.MSG_VERBOSE); | |||
saxParser.parse(inputSource, new RootHandler()); | |||
} | |||
catch(ParserConfigurationException exc) { | |||
throw new BuildException("Parser has not been configured correctly", exc); | |||
@@ -213,6 +218,8 @@ public class ProjectHelper { | |||
public InputSource resolveEntity(String publicId, | |||
String systemId) { | |||
project.log("resolving systemId: " + systemId, Project.MSG_VERBOSE); | |||
if (systemId.startsWith("file:")) { | |||
String path = systemId.substring(5); | |||
int index = path.indexOf("file:"); | |||
@@ -175,6 +175,19 @@ public class Javadoc extends Task { | |||
} | |||
} | |||
private void add12ArgIfNotEmpty(String key, String value) { | |||
if (!javadoc1) { | |||
if (value != null && value.length() != 0) { | |||
cmd.createArgument().setValue(key); | |||
cmd.createArgument().setValue(value); | |||
} else { | |||
project.log(this, | |||
"Warning: Leaving out empty argument '" + key + "'", | |||
Project.MSG_WARN); | |||
} | |||
} | |||
} | |||
private void add11ArgIf(boolean b, String arg) { | |||
if (javadoc1 && b) { | |||
cmd.createArgument().setValue(arg); | |||
@@ -226,7 +239,7 @@ public class Javadoc extends Task { | |||
} | |||
public void setAdditionalparam(String add){ | |||
cmd.createArgument().setValue(add); | |||
cmd.createArgument().setLine(add); | |||
} | |||
public void setSourcepath(Path src) { | |||
@@ -387,35 +400,23 @@ public class Javadoc extends Task { | |||
add12ArgIf(b, "-splitindex"); | |||
} | |||
public void setWindowtitle(String src) { | |||
if (!javadoc1) { | |||
cmd.createArgument().setValue("-windowtitle"); | |||
cmd.createArgument().setValue(src); | |||
} | |||
add12ArgIfNotEmpty("-windowtitle", src); | |||
} | |||
public void setDoctitle(String src) { | |||
if (!javadoc1) { | |||
cmd.createArgument().setValue("-doctitle"); | |||
cmd.createArgument().setValue(src); | |||
} | |||
add12ArgIfNotEmpty("-doctitle", src); | |||
} | |||
public void setHeader(String src) { | |||
if (!javadoc1) { | |||
cmd.createArgument().setValue("-header"); | |||
cmd.createArgument().setValue(src); | |||
} | |||
add12ArgIfNotEmpty("-header", src); | |||
} | |||
public void setFooter(String src) { | |||
if (!javadoc1) { | |||
cmd.createArgument().setValue("-footer"); | |||
cmd.createArgument().setValue(src); | |||
} | |||
add12ArgIfNotEmpty("-footer", src); | |||
} | |||
public void setBottom(String src) { | |||
if (!javadoc1) { | |||
cmd.createArgument().setValue("-bottom"); | |||
cmd.createArgument().setValue(src); | |||
} | |||
add12ArgIfNotEmpty("-bottom", src); | |||
} | |||
public void setLinkoffline(String src) { | |||
if (!javadoc1) { | |||
LinkArgument le = createLink(); | |||
@@ -553,10 +554,7 @@ public class Javadoc extends Task { | |||
} | |||
public void setCharset(String src) { | |||
if (!javadoc1) { | |||
cmd.createArgument().setValue("-charset"); | |||
cmd.createArgument().setValue(src); | |||
} | |||
this.add12ArgIfNotEmpty("-charset", src); | |||
} | |||
/** | |||
@@ -175,7 +175,12 @@ public class Tar extends MatchingTask { | |||
if (!archiveIsUpToDate(files)) { | |||
upToDate = false; | |||
break; | |||
} | |||
for (int i = 0; i < files.length; ++i) { | |||
if (tarFile.equals(new File(fs.getDir(project), files[i]))) { | |||
throw new BuildException("A tar file cannot include itself", location); | |||
} | |||
} | |||
} | |||
@@ -334,6 +334,12 @@ public class Zip extends MatchingTask { | |||
return true; | |||
} | |||
} else { | |||
for (int i = 0; i < files.length; ++i) { | |||
if (files[i].equals(zipFile)) { | |||
throw new BuildException("A zip file cannot include itself", location); | |||
} | |||
} | |||
if (!zipFile.exists()) return false; | |||
SourceFileScanner sfs = new SourceFileScanner(this); | |||
@@ -459,6 +465,10 @@ public class Zip extends MatchingTask { | |||
protected void zipFile(File file, ZipOutputStream zOut, String vPath) | |||
throws IOException | |||
{ | |||
if (file.equals(zipFile)) { | |||
throw new BuildException("A zip file cannot include itself", location); | |||
} | |||
FileInputStream fIn = new FileInputStream(file); | |||
try { | |||
zipFile(fIn, zOut, vPath, file.lastModified()); | |||
@@ -73,31 +73,7 @@ public class ClassFileUtils { | |||
* @return the class name in dot notation (eg. java.lang.Object). | |||
*/ | |||
static public String convertSlashName(String name) { | |||
String dotName = null; | |||
int startIndex = 0; | |||
int sepIndex = 0; | |||
String slashName = name.replace('\\', '/'); | |||
do { | |||
String component = null; | |||
sepIndex = slashName.indexOf('/', startIndex); | |||
if (sepIndex == -1) { | |||
component = slashName.substring(startIndex); | |||
} else { | |||
component = slashName.substring(startIndex, sepIndex); | |||
startIndex = sepIndex + 1; | |||
} | |||
if (dotName == null) { | |||
dotName = component; | |||
} else { | |||
dotName += "." + component; | |||
} | |||
} while (sepIndex != -1); | |||
return dotName; | |||
return name.replace('\\', '.').replace( '/', '.' ); | |||
} | |||
/** | |||
@@ -108,31 +84,7 @@ public class ClassFileUtils { | |||
* @return the class name in slash notation (eg. java/lang/Object). | |||
*/ | |||
static public String convertDotName(String dotName) { | |||
String slashName = null; | |||
int startIndex = 0; | |||
int sepIndex = 0; | |||
do { | |||
String component = null; | |||
sepIndex = dotName.indexOf('.', startIndex); | |||
if (sepIndex == -1) { | |||
component = dotName.substring(startIndex); | |||
} else { | |||
component = dotName.substring(startIndex, sepIndex); | |||
startIndex = sepIndex + 1; | |||
} | |||
if (slashName == null) { | |||
slashName = component; | |||
} else { | |||
slashName += "/" + component; | |||
} | |||
} while (sepIndex != -1); | |||
return slashName; | |||
return dotName.replace( '.', '/'); | |||
} | |||
} | |||
@@ -367,7 +367,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
args += " -compiler " + compiler; | |||
} | |||
args += " -noexit " + sourceJar.getPath() + " " + destJar.getPath(); | |||
args += " " + sourceJar.getPath() + " " + destJar.getPath(); | |||
javaTask = (Java) getTask().getProject().createTask("java"); | |||
javaTask.setTaskName("ejbc"); | |||
@@ -384,7 +384,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool { | |||
javaTask.setFork(true); | |||
} | |||
else { | |||
javaTask.setFork(false); | |||
javaTask.setFork(true); | |||
} | |||
@@ -171,18 +171,22 @@ public class JJTree extends Task { | |||
cmdl.createArgument().setValue("-"+name+":"+value.toString()); | |||
} | |||
// load command line with required attributes | |||
if (outputDirectory != null) { | |||
if (!outputDirectory.isDirectory()) { | |||
throw new BuildException("Outputdir not a directory."); | |||
} | |||
cmdl.createArgument().setValue( | |||
"-OUTPUT_DIRECTORY:"+outputDirectory.getAbsolutePath()); | |||
} | |||
if (target == null || !target.isFile()) { | |||
throw new BuildException("Invalid target: " + target); | |||
} | |||
// use the directory containing the target as the output directory | |||
if (outputDirectory == null) { | |||
outputDirectory = new File(target.getParent()); | |||
} | |||
if (!outputDirectory.isDirectory() ) { | |||
throw new BuildException("'outputdirectory' " + outputDirectory + " is not a directory."); | |||
} | |||
// convert backslashes to slashes, otherwise jjtree will put this as | |||
// comments and this seems to confuse javacc | |||
cmdl.createArgument().setValue( | |||
"-OUTPUT_DIRECTORY:"+outputDirectory.getAbsolutePath().replace('\\', '/')); | |||
final File javaFile = new File( | |||
target.toString().substring(0, target.toString().indexOf(".jjt")) + ".jj"); | |||
if (javaFile.exists() && target.lastModified() < javaFile.lastModified()) { | |||
@@ -281,19 +281,25 @@ public class AggregateTransformer { | |||
} | |||
protected void createCascadingStyleSheet() throws IOException, SAXException { | |||
InputStream in = null; | |||
if (styleDir == null) { | |||
InputStream in = getResourceAsStream("html/stylesheet.css"); | |||
OutputStream out = new FileOutputStream( new File(toDir, "stylesheet.css")); | |||
copy(in, out); | |||
in = getResourceAsStream("html/stylesheet.css"); | |||
} else { | |||
in = new FileInputStream(new File(styleDir, "stylesheet.css")); | |||
} | |||
OutputStream out = new FileOutputStream( new File(toDir, "stylesheet.css")); | |||
copy(in, out); | |||
} | |||
protected void createFrameStructure() throws IOException, SAXException{ | |||
InputStream in = null; | |||
if (styleDir == null) { | |||
InputStream in = getResourceAsStream("html/index.html"); | |||
OutputStream out = new FileOutputStream( new File(toDir, "index.html") ); | |||
copy(in, out); | |||
in = getResourceAsStream("html/index.html"); | |||
} else { | |||
in = new FileInputStream(new File(styleDir, "index.html")); | |||
} | |||
OutputStream out = new FileOutputStream( new File(toDir, "index.html") ); | |||
copy(in, out); | |||
} | |||
/** | |||
@@ -161,15 +161,22 @@ public class JUnitTestRunner implements TestListener { | |||
testClass = loader.loadClass(test.getName()); | |||
} | |||
Method suiteMethod = null; | |||
try { | |||
Method suiteMethod= testClass.getMethod("suite", new Class[0]); | |||
suite = (Test)suiteMethod.invoke(null, new Class[0]); | |||
} catch(NoSuchMethodException e) { | |||
} catch(InvocationTargetException e) { | |||
} catch(IllegalAccessException e) { | |||
// check if there is a suite method | |||
suiteMethod= testClass.getMethod("suite", new Class[0]); | |||
} catch(Exception e) { | |||
// no appropriate suite method found. We don't report any | |||
// error here since it might be perfectly normal. We don't | |||
// know exactly what is the cause, but we're doing exactly | |||
// the same as JUnit TestRunner do. We swallow the exceptions. | |||
} | |||
if (suite == null) { | |||
if (suiteMethod != null){ | |||
// if there is a suite method available, then try | |||
// to extract the suite from it. If there is an error | |||
// here it will be caught below and reported. | |||
suite = (Test)suiteMethod.invoke(null, new Class[0]); | |||
} else { | |||
// try to extract a test suite automatically | |||
// this will generate warnings if the class is no suitable Test | |||
suite= new TestSuite(testClass); | |||
@@ -28,8 +28,11 @@ H6 { | |||
MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica | |||
} | |||
.Error { | |||
font-weight:bold; color:red; | |||
font-weight:bold; background:#EEEEE0; color:purple; | |||
} | |||
.Failure { | |||
font-weight:bold; color:purple; | |||
font-weight:bold; background:#EEEEE0; color:red; | |||
} | |||
.Pass { | |||
background:#EEEEE0; | |||
} |
@@ -1,10 +1,11 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- This style sheet should contain just a named templates that used in the other specific templates --> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |||
<xsl:include href="toolkit.xsl"/> | |||
<!-- | |||
Display the whole list of testsuite | |||
--> | |||
<xsl:template match="testsuites"> | |||
<HTML> | |||
<HEAD> | |||
@@ -23,6 +24,10 @@ | |||
</HTML> | |||
</xsl:template> | |||
<!-- | |||
Display each testsuite name with an hyperlink to the package frame. | |||
The hyperlink is made of the {packagename} + {classname} + "-details.html" | |||
--> | |||
<xsl:template match="testsuite"> | |||
<tr> | |||
<td nowrap="nowrap"> | |||
@@ -37,4 +42,4 @@ | |||
</tr> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</xsl:stylesheet> |
@@ -1,9 +1,6 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- This style sheet should contain just a named templates that used in the other specific templates --> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |||
<!-- import the commun templates --> | |||
<xsl:include href="toolkit.xsl"/> | |||
<xsl:template match="testsuites"> | |||
@@ -39,4 +36,4 @@ | |||
</tr> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</xsl:stylesheet> |
@@ -34,4 +34,4 @@ | |||
</HTML> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</xsl:stylesheet> |
@@ -1,6 +1,4 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- This style sheet should contain just a named templates that used in the other specific templates --> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |||
<!-- import the commun templates --> | |||
@@ -43,4 +41,4 @@ | |||
</tr> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</xsl:stylesheet> |
@@ -1,17 +1,8 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- This style sheet should contain just a named templates that used in the other specific templates --> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |||
<xsl:include href="toolkit.xsl"/> | |||
<!-- Calculate all summary values --> | |||
<xsl:variable name="testCount" select="sum(//testsuite/@tests)"/> | |||
<xsl:variable name="errorCount" select="sum(//testsuite/@errors)"/> | |||
<xsl:variable name="failureCount" select="sum(//testsuite/@failures)"/> | |||
<xsl:variable name="timeCount" select="sum(//testsuite/@time)"/> | |||
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/> | |||
<xsl:template match="testsuites"> | |||
<HTML> | |||
<HEAD> | |||
@@ -59,8 +50,18 @@ | |||
<xsl:template match="testsuite" mode="package"> | |||
<xsl:variable name="isError" select="(sum(//testsuite[@package = current()/@package]/@errors) + sum(//testsuite[@package = current()/@package]/@failures))>0"/> | |||
<!-- write a summary for the package --> | |||
<tr bgcolor="#EEEEE" valign="top"> | |||
<td><xsl:if test="$isError"><xsl:attribute name="class">Error</xsl:attribute></xsl:if><a href="{translate(@package,'.','/')}/package-summary.html"><xsl:value-of select="@package"/></a></td> | |||
<tr valign="top"> | |||
<xsl:attribute name="class"> | |||
<xsl:choose> | |||
<xsl:when test="$isError">Failure</xsl:when> | |||
<xsl:otherwise>Pass</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:attribute> | |||
<td> | |||
<a href="{translate(@package,'.','/')}/package-summary.html"> | |||
<xsl:value-of select="@package"/> | |||
</a> | |||
</td> | |||
<xsl:call-template name="statistics"> | |||
<xsl:with-param name="isError" select="$isError"/> | |||
</xsl:call-template> | |||
@@ -70,8 +71,19 @@ | |||
<xsl:template match="testsuite" mode="class"> | |||
<xsl:variable name="isError" select="(@errors + @failures)>0"/> | |||
<!-- write a summary for the package --> | |||
<tr bgcolor="#EEEEE" valign="top"> | |||
<td><xsl:if test="$isError"><xsl:attribute name="class">Error</xsl:attribute></xsl:if><a href="{translate(@package,'.','/')}/summary.html"><xsl:value-of select="@name"/></a></td> | |||
<tr valign="top"> | |||
<xsl:attribute name="class"> | |||
<xsl:choose> | |||
<xsl:when test="$isError">Failure</xsl:when> | |||
<xsl:otherwise>Pass</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:attribute> | |||
<td> | |||
<a href="{translate(@package,'.','/')}/summary.html"> | |||
<xsl:value-of select="@name"/> | |||
</a> | |||
</td> | |||
<xsl:call-template name="statistics"> | |||
<xsl:with-param name="isError" select="$isError"/> | |||
</xsl:call-template> | |||
@@ -81,10 +93,17 @@ | |||
<xsl:template name="statistics"> | |||
<xsl:variable name="isError"/> | |||
<td><xsl:if test="$isError"><xsl:attribute name="class">Error</xsl:attribute></xsl:if><xsl:value-of select="sum(//testsuite[@package = current()/@package]/@tests)"/></td> | |||
<td><xsl:if test="$isError"><xsl:attribute name="class">Error</xsl:attribute></xsl:if><xsl:value-of select="sum(//testsuite[@package = current()/@package]/@errors)"/></td> | |||
<td><xsl:if test="$isError"><xsl:attribute name="class">Error</xsl:attribute></xsl:if><xsl:value-of select="sum(//testsuite[@package = current()/@package]/@failures)"/></td> | |||
<td><xsl:if test="$isError"><xsl:attribute name="class">Error</xsl:attribute></xsl:if><xsl:value-of select="format-number(sum(//testsuite[@package = current()/@package]/@time),'#,###0.000')"/></td> | |||
<td> | |||
<xsl:value-of select="sum(//testsuite[@package = current()/@package]/@tests)"/></td> | |||
<td> | |||
<xsl:value-of select="sum(//testsuite[@package = current()/@package]/@errors)"/></td> | |||
<td> | |||
<xsl:value-of select="sum(//testsuite[@package = current()/@package]/@failures)"/></td> | |||
<td> | |||
<xsl:call-template name="display-time"> | |||
<xsl:with-param name="value" select="sum(//testsuite[@package = current()/@package]/@time)"/> | |||
</xsl:call-template> | |||
</td> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</xsl:stylesheet> |
@@ -1,5 +1,4 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:html="http://www.w3.org/Profiles/XHTML-transitional"> | |||
<xsl:include href="toolkit.xsl"/> | |||
@@ -43,13 +42,16 @@ | |||
} | |||
H6 { | |||
MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica | |||
} | |||
.Error { | |||
font-weight:bold; color:red; | |||
} | |||
.Failure { | |||
font-weight:bold; color:purple; | |||
} | |||
} | |||
.Error { | |||
font-weight:bold; background:#EEEEE0; color:purple; | |||
} | |||
.Failure { | |||
font-weight:bold; background:#EEEEE0; color:red; | |||
} | |||
.Pass { | |||
background:#EEEEE0; | |||
} | |||
</style> | |||
</HEAD> | |||
<body text="#000000" bgColor="#ffffff"> | |||
@@ -95,19 +97,24 @@ | |||
<xsl:variable name="timeCount" select="sum(../testsuite[./@package = current()/@package]/@time)"/> | |||
<!-- write a summary for the package --> | |||
<tr bgcolor="#EEEEE" valign="top"> | |||
<tr valign="top"> | |||
<!-- set a nice color depending if there is an error/failure --> | |||
<xsl:attribute name="class"> | |||
<xsl:choose> | |||
<xsl:when test="$failureCount > 0">Failure</xsl:when> | |||
<xsl:when test="$errorCount > 0">Error</xsl:when> | |||
<xsl:when test="$failureCount > 0">Failure</xsl:when> | |||
<xsl:otherwise>Pass</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:attribute> | |||
<td><a href="#{@package}"><xsl:value-of select="@package"/></a></td> | |||
<td><xsl:value-of select="$testCount"/></td> | |||
<td><xsl:value-of select="$errorCount"/></td> | |||
<td><xsl:value-of select="$failureCount"/></td> | |||
<td><xsl:value-of select="format-number($timeCount,'#,###0.000')"/></td> | |||
<td> | |||
<xsl:call-template name="display-time"> | |||
<xsl:with-param name="value" select="$timeCount"/> | |||
</xsl:call-template> | |||
</td> | |||
</tr> | |||
</xsl:for-each> | |||
</table> | |||
@@ -145,12 +152,13 @@ | |||
<!-- It must match the table definition at the package level --> | |||
<!-- ================================================================== --> | |||
<xsl:template match="testsuite"> | |||
<tr bgcolor="#EEEEE" valign="top"> | |||
<tr valign="top"> | |||
<!-- set a nice color depending if there is an error/failure --> | |||
<xsl:attribute name="class"> | |||
<xsl:choose> | |||
<xsl:when test="@failures[.> 0]">Failure</xsl:when> | |||
<xsl:when test="@errors[.> 0]">Error</xsl:when> | |||
<xsl:when test="@failures[.> 0]">Failure</xsl:when> | |||
<xsl:otherwise>Pass</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:attribute> | |||
@@ -159,7 +167,11 @@ | |||
<td><xsl:value-of select="@tests"/></td> | |||
<td><xsl:value-of select="@errors"/></td> | |||
<td><xsl:value-of select="@failures"/></td> | |||
<td><xsl:value-of select="format-number(@time,'#,###0.000')"/></td> | |||
<td> | |||
<xsl:call-template name="display-time"> | |||
<xsl:with-param name="value" select="@time"/> | |||
</xsl:call-template> | |||
</td> | |||
</tr> | |||
</xsl:template> | |||
@@ -1,6 +1,4 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- This style sheet should contain just a named templates that used in the other specific templates --> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |||
<!-- import the commun templates --> | |||
@@ -26,7 +24,16 @@ | |||
<xsl:call-template name="packageSummaryHeader"/> | |||
<!-- write a summary for the package --> | |||
<tr bgcolor="#EEEEE" valign="top"> | |||
<tr valign="top"> | |||
<xsl:variable name="errorCount" select="sum(testsuite/@errors)"/> | |||
<xsl:variable name="failureCount" select="sum(testsuite/@failures)"/> | |||
<xsl:attribute name="class"> | |||
<xsl:choose> | |||
<xsl:when test="$failureCount > 0">Failure</xsl:when> | |||
<xsl:when test="$errorCount > 0">Error</xsl:when> | |||
<xsl:otherwise>Pass</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:attribute> | |||
<td><xsl:value-of select="testsuite/@package"/></td> | |||
<td><xsl:value-of select="sum(testsuite/@tests)"/></td> | |||
<td><xsl:value-of select="sum(testsuite/@errors)"/></td> | |||
@@ -52,12 +59,13 @@ | |||
</xsl:template> | |||
<xsl:template match="testsuite"> | |||
<tr bgcolor="#EEEEE" valign="top"> | |||
<tr valign="top"> | |||
<!-- set a nice color depending if there is an error/failure --> | |||
<xsl:attribute name="class"> | |||
<xsl:choose> | |||
<xsl:when test="@failures[.> 0]">Failure</xsl:when> | |||
<xsl:when test="@errors[.> 0]">Error</xsl:when> | |||
<xsl:when test="@failures[.> 0]">Failure</xsl:when> | |||
<xsl:otherwise>Pass</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:attribute> | |||
@@ -66,8 +74,12 @@ | |||
<td><xsl:value-of select="@tests"/></td> | |||
<td><xsl:value-of select="@errors"/></td> | |||
<td><xsl:value-of select="@failures"/></td> | |||
<td><xsl:value-of select="format-number(@time,'#,###0.000')"/></td> | |||
<td> | |||
<xsl:call-template name="display-time"> | |||
<xsl:with-param name="value" select="@time"/> | |||
</xsl:call-template> | |||
</td> | |||
</tr> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</xsl:stylesheet> |
@@ -1,9 +1,28 @@ | |||
<?xml version="1.0" encoding="ISO-8859-1"?> | |||
<!-- This style sheet should contain just a named templates that used in the other specific templates --> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |||
<!-- transform string like a.b.c to ../../../ --> | |||
<!-- | |||
format a number in to display its value in percent | |||
@param value the number to format | |||
--> | |||
<xsl:template name="display-time"> | |||
<xsl:param name="value"/> | |||
<xsl:value-of select="format-number($value,'0.000')"/> | |||
</xsl:template> | |||
<!-- | |||
format a number in to display its value in percent | |||
@param value the number to format | |||
--> | |||
<xsl:template name="display-percent"> | |||
<xsl:param name="value"/> | |||
<xsl:value-of select="format-number($value,'0.00%')"/> | |||
</xsl:template> | |||
<!-- | |||
transform string like a.b.c to ../../../ | |||
@param path the path to transform into a descending directory path | |||
--> | |||
<xsl:template name="path"> | |||
<xsl:param name="path"/> | |||
<xsl:if test="contains($path,'.')"> | |||
@@ -119,18 +138,27 @@ | |||
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/> | |||
<table border="0" cellpadding="5" cellspacing="2" width="95%"> | |||
<xsl:call-template name="summaryHeader"/> | |||
<tr bgcolor="#EEEEE" valign="top"> | |||
<tr valign="top"> | |||
<xsl:attribute name="class"> | |||
<xsl:choose> | |||
<xsl:when test="./failure | ./error">Error</xsl:when> | |||
<xsl:otherwise>TableRowColor</xsl:otherwise> | |||
</xsl:choose> | |||
<xsl:choose> | |||
<xsl:when test="$failureCount > 0">Failure</xsl:when> | |||
<xsl:when test="$errorCount > 0">Error</xsl:when> | |||
<xsl:otherwise>Pass</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:attribute> | |||
<td><xsl:value-of select="$testCount"/></td> | |||
<td><xsl:value-of select="$failureCount"/></td> | |||
<td><xsl:value-of select="$errorCount"/></td> | |||
<td><xsl:value-of select="format-number($successRate,'#,##0.00%')"/></td> | |||
<td><xsl:value-of select="format-number($timeCount,'#,###0.000')"/></td> | |||
<td> | |||
<xsl:call-template name="display-percent"> | |||
<xsl:with-param name="value" select="$successRate"/> | |||
</xsl:call-template> | |||
</td> | |||
<td> | |||
<xsl:call-template name="display-time"> | |||
<xsl:with-param name="value" select="$timeCount"/> | |||
</xsl:call-template> | |||
</td> | |||
</tr> | |||
</table> | |||
Note: <i>failures</i> are anticipated and checked for with assertions while <i>errors</i> are unanticipated. | |||
@@ -142,10 +170,12 @@ | |||
===================================================================== | |||
--> | |||
<xsl:template match="testcase"> | |||
<TR bgcolor="#EEEEE" valign="top"><xsl:attribute name="class"> | |||
<TR valign="top"> | |||
<xsl:attribute name="class"> | |||
<xsl:choose> | |||
<xsl:when test="./failure | ./error">Error</xsl:when> | |||
<xsl:otherwise>TableRowColor</xsl:otherwise> | |||
<xsl:when test="./failure">Failure</xsl:when> | |||
<xsl:when test="./error">Error</xsl:when> | |||
<xsl:otherwise>Pass</xsl:otherwise> | |||
</xsl:choose> | |||
</xsl:attribute> | |||
<TD><xsl:value-of select="./@name"/></TD> | |||
@@ -160,10 +190,14 @@ | |||
</xsl:when> | |||
<xsl:otherwise> | |||
<TD>Success</TD> | |||
<TD></TD> | |||
<TD><xsl:apply-templates select="./pass"/></TD> | |||
</xsl:otherwise> | |||
</xsl:choose> | |||
<td><xsl:value-of select="format-number(@time,'#,###0.000')"/></td> | |||
<td> | |||
<xsl:call-template name="display-time"> | |||
<xsl:with-param name="value" select="@time"/> | |||
</xsl:call-template> | |||
</td> | |||
</TR> | |||
</xsl:template> | |||
@@ -201,4 +235,4 @@ | |||
<xsl:apply-templates/> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
</xsl:stylesheet> |
@@ -189,7 +189,7 @@ public class CommandlineJava implements Cloneable { | |||
result, pos, sysProperties.size()); | |||
pos += sysProperties.size(); | |||
} | |||
if (fullClasspath != null && fullClasspath.size() > 0) { | |||
if (fullClasspath != null && fullClasspath.toString().trim().length() > 0) { | |||
result[pos++] = "-classpath"; | |||
result[pos++] = fullClasspath.toString(); | |||
} | |||
@@ -213,6 +213,10 @@ public class Mapper extends DataType { | |||
throw be; | |||
} catch (Throwable t) { | |||
throw new BuildException(t); | |||
} finally { | |||
if (type != null) { | |||
classname = null; | |||
} | |||
} | |||
} | |||
@@ -79,4 +79,11 @@ public class TarTest extends TaskdefsTest { | |||
expectBuildException("test3", "required argument not specified"); | |||
} | |||
public void test4() { | |||
expectBuildException("test4", "tar cannot include itself"); | |||
} | |||
public void tearDown() { | |||
executeTarget("cleanup"); | |||
} | |||
} |
@@ -74,4 +74,17 @@ public class ZipTest extends TaskdefsTest { | |||
public void test2() { | |||
expectBuildException("test2", "required argument not specified"); | |||
} | |||
public void test3() { | |||
expectBuildException("test3", "zip cannot include itself"); | |||
} | |||
public void test4() { | |||
expectBuildException("test4", "zip cannot include itself"); | |||
} | |||
public void tearDown() { | |||
executeTarget("cleanup"); | |||
} | |||
} |
@@ -57,6 +57,7 @@ package org.apache.tools.ant.types; | |||
import org.apache.tools.ant.BuildException; | |||
import org.apache.tools.ant.Project; | |||
import org.apache.tools.ant.util.*; | |||
import org.apache.tools.ant.taskdefs.TaskdefsTest; | |||
import junit.framework.TestCase; | |||
import junit.framework.AssertionFailedError; | |||
@@ -174,4 +175,24 @@ public class MapperTest extends TestCase { | |||
assertEquals("a.java should match", 1, result.length); | |||
assertEquals("a.class", result[0]); | |||
} | |||
public void testCopyTaskWithTwoFilesets() { | |||
TaskdefForCopyTest t = new TaskdefForCopyTest("test1"); | |||
t.setUp(); | |||
t.test1(); | |||
} | |||
private class TaskdefForCopyTest extends TaskdefsTest { | |||
TaskdefForCopyTest(String name) { | |||
super(name); | |||
} | |||
public void setUp() { | |||
configureProject("src/etc/testcases/types/mapper.xml"); | |||
} | |||
public void test1() { | |||
executeTarget("test1"); | |||
} | |||
} | |||
} |