Browse Source

No need for there to be a initialize method.

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-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
8bf664b1c5
10 changed files with 44 additions and 84 deletions
  1. +0
    -10
      proposal/myrmidon/src/main/org/apache/tools/ant/Task.java
  2. +4
    -12
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  3. +9
    -12
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  4. +9
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
  5. +0
    -6
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java
  6. +0
    -10
      proposal/myrmidon/src/todo/org/apache/tools/ant/Task.java
  7. +4
    -12
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  8. +9
    -12
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  9. +9
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
  10. +0
    -6
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java

+ 0
- 10
proposal/myrmidon/src/main/org/apache/tools/ant/Task.java View File

@@ -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.
* *


+ 4
- 12
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -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>


+ 9
- 12
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -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.
* *


+ 9
- 2
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java View File

@@ -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.
* *


+ 0
- 6
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java View File

@@ -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
{ {


+ 0
- 10
proposal/myrmidon/src/todo/org/apache/tools/ant/Task.java View File

@@ -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.
* *


+ 4
- 12
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java View File

@@ -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>


+ 9
- 12
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -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.
* *


+ 9
- 2
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java View File

@@ -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.
* *


+ 0
- 6
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java View File

@@ -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
{ {


Loading…
Cancel
Save