git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277948 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -61,7 +61,10 @@ public class IsSigned extends DataType implements Condition { | |||
| * Returns <code>true</code> if the file exists and is signed with | |||
| * the signature specified, or, if <code>name</code> wasn't | |||
| * specified, if the file contains a signature. | |||
| * @param zipFile the zipfile to check | |||
| * @param name the signature to check (may be killed) | |||
| * @return true if the file is signed. | |||
| * @throws IOException on error | |||
| */ | |||
| public static boolean isSigned(File zipFile, String name) | |||
| throws IOException { | |||
| @@ -86,6 +86,7 @@ public class ANTLR extends Task { | |||
| /** Instance of a utility class to use for file operations. */ | |||
| private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); | |||
| /** Constructor for ANTLR task. */ | |||
| public ANTLR() { | |||
| commandline.setVm(JavaEnvUtils.getJreExecutable("java")); | |||
| commandline.setClassname("antlr.Tool"); | |||
| @@ -93,6 +94,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * The grammar file to process. | |||
| * @param target the gramer file | |||
| */ | |||
| public void setTarget(File target) { | |||
| log("Setting target to: " + target.toString(), Project.MSG_VERBOSE); | |||
| @@ -101,6 +103,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * The directory to write the generated files to. | |||
| * @param outputDirectory the output directory | |||
| */ | |||
| public void setOutputdirectory(File outputDirectory) { | |||
| log("Setting output directory to: " + outputDirectory.toString(), Project.MSG_VERBOSE); | |||
| @@ -110,6 +113,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * Sets an optional super grammar file. | |||
| * Use setGlib(File superGrammar) instead. | |||
| * @param superGrammar the super grammar filename | |||
| * @deprecated since ant 1.6 | |||
| */ | |||
| public void setGlib(String superGrammar) { | |||
| @@ -123,6 +127,7 @@ public class ANTLR extends Task { | |||
| } | |||
| /** | |||
| * Sets an optional super grammar file | |||
| * @param superGrammar the super grammar file | |||
| * @since ant 1.6 | |||
| */ | |||
| public void setGlib(File superGrammar) { | |||
| @@ -130,6 +135,7 @@ public class ANTLR extends Task { | |||
| } | |||
| /** | |||
| * Sets a flag to enable ParseView debugging | |||
| * @param enable a <code>boolean</code> value | |||
| */ | |||
| public void setDebug(boolean enable) { | |||
| this.debug = enable; | |||
| @@ -137,6 +143,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * If true, emit html | |||
| * @param enable a <code>boolean</code> value | |||
| */ | |||
| public void setHtml(boolean enable) { | |||
| html = enable; | |||
| @@ -144,6 +151,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * Sets a flag to emit diagnostic text | |||
| * @param enable a <code>boolean</code> value | |||
| */ | |||
| public void setDiagnostic(boolean enable) { | |||
| diagnostic = enable; | |||
| @@ -151,6 +159,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * If true, enables all tracing. | |||
| * @param enable a <code>boolean</code> value | |||
| */ | |||
| public void setTrace(boolean enable) { | |||
| trace = enable; | |||
| @@ -158,6 +167,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * If true, enables parser tracing. | |||
| * @param enable a <code>boolean</code> value | |||
| */ | |||
| public void setTraceParser(boolean enable) { | |||
| traceParser = enable; | |||
| @@ -165,6 +175,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * If true, enables lexer tracing. | |||
| * @param enable a <code>boolean</code> value | |||
| */ | |||
| public void setTraceLexer(boolean enable) { | |||
| traceLexer = enable; | |||
| @@ -172,6 +183,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * Sets a flag to allow the user to enable tree walker tracing | |||
| * @param enable a <code>boolean</code> value | |||
| */ | |||
| public void setTraceTreeWalker(boolean enable) { | |||
| traceTreeWalker = enable; | |||
| @@ -183,6 +195,7 @@ public class ANTLR extends Task { | |||
| // I'm not removing this method to keep backward compatibility | |||
| /** | |||
| * @ant.attribute ignore="true" | |||
| * @param s a <code>boolean</code> value | |||
| */ | |||
| public void setFork(boolean s) { | |||
| //this.fork = s; | |||
| @@ -190,6 +203,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * The working directory of the process | |||
| * @param d the working directory | |||
| */ | |||
| public void setDir(File d) { | |||
| this.workingdir = d; | |||
| @@ -198,6 +212,7 @@ public class ANTLR extends Task { | |||
| /** | |||
| * Adds a classpath to be set | |||
| * because a directory might be given for Antlr debug. | |||
| * @return a path to be configured | |||
| */ | |||
| public Path createClasspath() { | |||
| return commandline.createClasspath(getProject()).createPath(); | |||
| @@ -216,6 +231,7 @@ public class ANTLR extends Task { | |||
| * Adds the jars or directories containing Antlr | |||
| * this should make the forked JVM work without having to | |||
| * specify it directly. | |||
| * @throws BuildException on error | |||
| */ | |||
| public void init() throws BuildException { | |||
| addClasspathEntry("/antlr/ANTLRGrammarParseBehavior.class"); | |||
| @@ -227,6 +243,7 @@ public class ANTLR extends Task { | |||
| * | |||
| * <p>Doesn't work for archives in JDK 1.1 as the URL returned by | |||
| * getResource doesn't contain the name of the archive.</p> | |||
| * @param resource the resource name to search for | |||
| */ | |||
| protected void addClasspathEntry(String resource) { | |||
| /* | |||
| @@ -255,6 +272,10 @@ public class ANTLR extends Task { | |||
| } | |||
| } | |||
| /** | |||
| * Execute the task. | |||
| * @throws BuildException on error | |||
| */ | |||
| public void execute() throws BuildException { | |||
| validateAttributes(); | |||
| @@ -177,20 +177,31 @@ public class EchoProperties extends Task { | |||
| /** | |||
| * A set of properties to write. | |||
| * | |||
| * @param ps the property set to write | |||
| * @since Ant 1.6 | |||
| */ | |||
| public void addPropertyset(PropertySet ps) { | |||
| propertySets.addElement(ps); | |||
| } | |||
| /** | |||
| * Set the output format - xml or text. | |||
| * @param ea an enumerated <code>FormatAttribute</code> value | |||
| */ | |||
| public void setFormat(FormatAttribute ea) { | |||
| format = ea.getValue(); | |||
| } | |||
| /** | |||
| * A enumerated type for the format attribute. | |||
| * The values are "xml" and "text". | |||
| */ | |||
| public static class FormatAttribute extends EnumeratedAttribute { | |||
| private String [] formats = new String[]{"xml", "text"}; | |||
| /** | |||
| * @see EnumeratedAttribute#getValues() | |||
| */ | |||
| public String[] getValues() { | |||
| return formats; | |||
| } | |||
| @@ -320,9 +331,10 @@ public class EchoProperties extends Task { | |||
| * sent to the output stream. | |||
| * The output stream will be closed when this method returns. | |||
| * | |||
| *@param allProps propfile to save | |||
| *@param os output stream | |||
| *@exception IOException trouble | |||
| * @param allProps propfile to save | |||
| * @param os output stream | |||
| * @throws IOException on output errors | |||
| * @throws BuildException on other errors | |||
| */ | |||
| protected void saveProperties(Hashtable allProps, OutputStream os) | |||
| throws IOException, BuildException { | |||
| @@ -383,6 +395,12 @@ public class EchoProperties extends Task { | |||
| return sorted; | |||
| } | |||
| /** | |||
| * Output the properties as xml output. | |||
| * @param props the properties to save | |||
| * @param os the output stream to write to (Note this gets closed) | |||
| * @throws IOException on error in writing to the stream | |||
| */ | |||
| protected void xmlSaveProperties(Properties props, | |||
| OutputStream os) throws IOException { | |||
| // create XML document | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright 2000,2002-2004 The Apache Software Foundation | |||
| * Copyright 2000,2002-2005 The Apache Software Foundation | |||
| * | |||
| * Licensed under the Apache License, Version 2.0 (the "License"); | |||
| * you may not use this file except in compliance with the License. | |||
| @@ -42,18 +42,26 @@ public class Test extends Java { | |||
| protected String m_testname = ""; | |||
| /** name of test. No property expansion takes place here */ | |||
| /** | |||
| * name of test. No property expansion takes place here | |||
| * @param testname the test name | |||
| */ | |||
| public void addText(final String testname) { | |||
| m_testname += testname; | |||
| } | |||
| /** | |||
| * Get the test name | |||
| * @return the test name | |||
| */ | |||
| public String toString() { | |||
| return m_testname; | |||
| } | |||
| } | |||
| /** Constructor for the Test task. */ | |||
| public Test() { | |||
| setClassname("org.apache.testlet.engine.TextTestEngine"); | |||
| } | |||
| @@ -61,6 +69,7 @@ public class Test extends Java { | |||
| /** | |||
| * add a declaration of a testlet to run | |||
| * @return a <code>TestletEntry</code> to configure | |||
| */ | |||
| public TestletEntry createTestlet() { | |||
| final TestletEntry entry = new TestletEntry(); | |||
| @@ -73,6 +82,7 @@ public class Test extends Java { | |||
| /** | |||
| * a boolean value indicating whether tests should display a | |||
| * message on success; optional | |||
| * @param showSuccess a <code>boolean</code> value | |||
| */ | |||
| public void setShowSuccess(final boolean showSuccess) { | |||
| @@ -83,6 +93,7 @@ public class Test extends Java { | |||
| /** | |||
| * a boolean value indicating whether a banner should be displayed | |||
| * when starting testlet engine; optional. | |||
| * @param showBanner a <code>String</code> value | |||
| */ | |||
| public void setShowBanner(final String showBanner) { | |||
| createArg().setValue("-b=" + showBanner); | |||
| @@ -92,17 +103,26 @@ public class Test extends Java { | |||
| /** | |||
| * a boolean indicating that a stack trace is displayed on | |||
| * error (but not normal failure); optional. | |||
| * @param showTrace a <code>boolean</code> value | |||
| */ | |||
| public void setShowTrace(final boolean showTrace) { | |||
| createArg().setValue("-t=" + showTrace); | |||
| } | |||
| /** | |||
| * a boolean indicating that a stack trace is to be displayed always. | |||
| * @param forceShowTrace a <code>boolean</code> value | |||
| */ | |||
| public void setForceShowTrace(final boolean forceShowTrace) { | |||
| createArg().setValue("-f=" + forceShowTrace); | |||
| } | |||
| /** | |||
| * Execute the task. | |||
| * @throws BuildException on error | |||
| */ | |||
| public void execute() | |||
| throws BuildException { | |||