Now that tasks are initialized and executed in one sweep initialize functions could just be done at the start of an execute call. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270210 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -26,16 +26,6 @@ public abstract class Task | |||||
| { | { | ||||
| } | } | ||||
| /** | |||||
| * Called by the project to let the task initialize properly. | |||||
| * | |||||
| * @throws TaskException if someting goes wrong with the build | |||||
| */ | |||||
| public void initialize() | |||||
| throws TaskException | |||||
| { | |||||
| } | |||||
| /** | /** | ||||
| * Log a mesage with the give priority. | * Log a mesage with the give priority. | ||||
| * | * | ||||
| @@ -112,6 +112,10 @@ public class ANTLR extends Task | |||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| //Adds the jars or directories containing Antlr this should make the forked | |||||
| //JVM work without having to specify it directly. | |||||
| addClasspathEntry( "/antlr/Tool.class" ); | |||||
| validateAttributes(); | validateAttributes(); | ||||
| //TODO: use ANTLR to parse the grammer file to do this. | //TODO: use ANTLR to parse the grammer file to do this. | ||||
| @@ -140,18 +144,6 @@ 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. | |||||
| * | |||||
| * @exception TaskException Description of Exception | |||||
| */ | |||||
| public void initialize() | |||||
| throws TaskException | |||||
| { | |||||
| addClasspathEntry( "/antlr/Tool.class" ); | |||||
| } | |||||
| /** | /** | ||||
| * Search for the given resource and add the directory or archive that | * Search for the given resource and add the directory or archive that | ||||
| * contains it to the classpath. <p> | * contains it to the classpath. <p> | ||||
| @@ -379,6 +379,15 @@ public class JUnitTask extends Task | |||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| /* | |||||
| * Adds the jars or directories containing Ant, this task and JUnit to the | |||||
| * classpath - this should make the forked JVM work without having to | |||||
| * specify them directly. | |||||
| */ | |||||
| addClasspathEntry( "/junit/framework/TestCase.class" ); | |||||
| addClasspathEntry( "/org/apache/tools/ant/Task.class" ); | |||||
| addClasspathEntry( "/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class" ); | |||||
| Enumeration list = getIndividualTests(); | Enumeration list = getIndividualTests(); | ||||
| while( list.hasMoreElements() ) | while( list.hasMoreElements() ) | ||||
| { | { | ||||
| @@ -390,18 +399,6 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Adds the jars or directories containing Ant, this task and JUnit to the | |||||
| * classpath - this should make the forked JVM work without having to | |||||
| * specify them directly. | |||||
| */ | |||||
| public void initialize() | |||||
| { | |||||
| addClasspathEntry( "/junit/framework/TestCase.class" ); | |||||
| addClasspathEntry( "/org/apache/tools/ant/Task.class" ); | |||||
| addClasspathEntry( "/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class" ); | |||||
| } | |||||
| /** | /** | ||||
| * Get the default output for a formatter. | * Get the default output for a formatter. | ||||
| * | * | ||||
| @@ -93,9 +93,8 @@ public abstract class P4Base extends org.apache.tools.ant.Task | |||||
| this.P4View = P4View; | this.P4View = P4View; | ||||
| } | } | ||||
| public void initialize() | |||||
| private void prepare() | |||||
| { | { | ||||
| util = new Perl5Util(); | util = new Perl5Util(); | ||||
| //Get default P4 settings from environment - Mark would have done something cool with | //Get default P4 settings from environment - Mark would have done something cool with | ||||
| @@ -115,6 +114,14 @@ public abstract class P4Base extends org.apache.tools.ant.Task | |||||
| execP4Command( command, null ); | execP4Command( command, null ); | ||||
| } | } | ||||
| public void execute() | |||||
| throws TaskException | |||||
| { | |||||
| //Setup task before executing it | |||||
| prepare(); | |||||
| super.execute(); | |||||
| } | |||||
| /** | /** | ||||
| * Execute P4 command assembled by subclasses. | * Execute P4 command assembled by subclasses. | ||||
| * | * | ||||
| @@ -79,15 +79,9 @@ public class SoundTask extends Task | |||||
| } | } | ||||
| public void initialize() | |||||
| { | |||||
| } | |||||
| /** | /** | ||||
| * A class to be extended by any BuildAlert's that require the output of | * A class to be extended by any BuildAlert's that require the output of | ||||
| * sound. | * sound. | ||||
| * | |||||
| * @author RT | |||||
| */ | */ | ||||
| public class BuildAlert | public class BuildAlert | ||||
| { | { | ||||
| @@ -26,16 +26,6 @@ public abstract class Task | |||||
| { | { | ||||
| } | } | ||||
| /** | |||||
| * Called by the project to let the task initialize properly. | |||||
| * | |||||
| * @throws TaskException if someting goes wrong with the build | |||||
| */ | |||||
| public void initialize() | |||||
| throws TaskException | |||||
| { | |||||
| } | |||||
| /** | /** | ||||
| * Log a mesage with the give priority. | * Log a mesage with the give priority. | ||||
| * | * | ||||
| @@ -112,6 +112,10 @@ public class ANTLR extends Task | |||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| //Adds the jars or directories containing Antlr this should make the forked | |||||
| //JVM work without having to specify it directly. | |||||
| addClasspathEntry( "/antlr/Tool.class" ); | |||||
| validateAttributes(); | validateAttributes(); | ||||
| //TODO: use ANTLR to parse the grammer file to do this. | //TODO: use ANTLR to parse the grammer file to do this. | ||||
| @@ -140,18 +144,6 @@ 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. | |||||
| * | |||||
| * @exception TaskException Description of Exception | |||||
| */ | |||||
| public void initialize() | |||||
| throws TaskException | |||||
| { | |||||
| addClasspathEntry( "/antlr/Tool.class" ); | |||||
| } | |||||
| /** | /** | ||||
| * Search for the given resource and add the directory or archive that | * Search for the given resource and add the directory or archive that | ||||
| * contains it to the classpath. <p> | * contains it to the classpath. <p> | ||||
| @@ -379,6 +379,15 @@ public class JUnitTask extends Task | |||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| /* | |||||
| * Adds the jars or directories containing Ant, this task and JUnit to the | |||||
| * classpath - this should make the forked JVM work without having to | |||||
| * specify them directly. | |||||
| */ | |||||
| addClasspathEntry( "/junit/framework/TestCase.class" ); | |||||
| addClasspathEntry( "/org/apache/tools/ant/Task.class" ); | |||||
| addClasspathEntry( "/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class" ); | |||||
| Enumeration list = getIndividualTests(); | Enumeration list = getIndividualTests(); | ||||
| while( list.hasMoreElements() ) | while( list.hasMoreElements() ) | ||||
| { | { | ||||
| @@ -390,18 +399,6 @@ public class JUnitTask extends Task | |||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Adds the jars or directories containing Ant, this task and JUnit to the | |||||
| * classpath - this should make the forked JVM work without having to | |||||
| * specify them directly. | |||||
| */ | |||||
| public void initialize() | |||||
| { | |||||
| addClasspathEntry( "/junit/framework/TestCase.class" ); | |||||
| addClasspathEntry( "/org/apache/tools/ant/Task.class" ); | |||||
| addClasspathEntry( "/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.class" ); | |||||
| } | |||||
| /** | /** | ||||
| * Get the default output for a formatter. | * Get the default output for a formatter. | ||||
| * | * | ||||
| @@ -93,9 +93,8 @@ public abstract class P4Base extends org.apache.tools.ant.Task | |||||
| this.P4View = P4View; | this.P4View = P4View; | ||||
| } | } | ||||
| public void initialize() | |||||
| private void prepare() | |||||
| { | { | ||||
| util = new Perl5Util(); | util = new Perl5Util(); | ||||
| //Get default P4 settings from environment - Mark would have done something cool with | //Get default P4 settings from environment - Mark would have done something cool with | ||||
| @@ -115,6 +114,14 @@ public abstract class P4Base extends org.apache.tools.ant.Task | |||||
| execP4Command( command, null ); | execP4Command( command, null ); | ||||
| } | } | ||||
| public void execute() | |||||
| throws TaskException | |||||
| { | |||||
| //Setup task before executing it | |||||
| prepare(); | |||||
| super.execute(); | |||||
| } | |||||
| /** | /** | ||||
| * Execute P4 command assembled by subclasses. | * Execute P4 command assembled by subclasses. | ||||
| * | * | ||||
| @@ -79,15 +79,9 @@ public class SoundTask extends Task | |||||
| } | } | ||||
| public void initialize() | |||||
| { | |||||
| } | |||||
| /** | /** | ||||
| * A class to be extended by any BuildAlert's that require the output of | * A class to be extended by any BuildAlert's that require the output of | ||||
| * sound. | * sound. | ||||
| * | |||||
| * @author RT | |||||
| */ | */ | ||||
| public class BuildAlert | public class BuildAlert | ||||
| { | { | ||||