Browse Source

Made into a ProjectListener rather than a BuildListener

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270472 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
f151280e40
2 changed files with 20 additions and 58 deletions
  1. +10
    -29
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
  2. +10
    -29
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java

+ 10
- 29
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java View File

@@ -15,8 +15,7 @@ import java.io.PrintStream;
import java.util.Date; import java.util.Date;
import java.util.Properties; import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.BuildEvent; import org.apache.myrmidon.listeners.AbstractProjectListener;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Javac;
@@ -715,7 +714,7 @@ public class IContract extends MatchingTask


// We want to be notified if iContract jar is missing. This makes life easier for the user // We want to be notified if iContract jar is missing. This makes life easier for the user
// who didn't understand that iContract is a separate library (duh!) // who didn't understand that iContract is a separate library (duh!)
getProject().addBuildListener( new IContractPresenceDetector() ); getProject().addProjectListener( new IContractPresenceDetector() );


// Prepare the directories for iContract. iContract will make them if they // Prepare the directories for iContract. iContract will make them if they
// don't exist, but for some reason I don't know, it will complain about the REP files // don't exist, but for some reason I don't know, it will complain about the REP files
@@ -1079,38 +1078,20 @@ public class IContract extends MatchingTask
* about missing iContract is missing. Used to indicate a more verbose error * about missing iContract is missing. Used to indicate a more verbose error
* to the user, with advice about how to solve the problem * to the user, with advice about how to solve the problem
*/ */
private class IContractPresenceDetector implements BuildListener private class IContractPresenceDetector
extends AbstractProjectListener
{ {
public void buildFinished( BuildEvent event ) /**
{ * Notify listener of log message event.
} *

* @param message the message
public void buildStarted( BuildEvent event ) */
{ public void log( final String message )
}

public void messageLogged( BuildEvent event )
{ {
if( "java.lang.NoClassDefFoundError: com/reliablesystems/iContract/Tool".equals( event.getMessage() ) ) if( "java.lang.NoClassDefFoundError: com/reliablesystems/iContract/Tool".equals( event.getMessage() ) )
{ {
iContractMissing = true; iContractMissing = true;
} }
} }

public void targetFinished( BuildEvent event )
{
}

public void targetStarted( BuildEvent event )
{
}

public void taskFinished( BuildEvent event )
{
}

public void taskStarted( BuildEvent event )
{
}
} }
} }

+ 10
- 29
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java View File

@@ -15,8 +15,7 @@ import java.io.PrintStream;
import java.util.Date; import java.util.Date;
import java.util.Properties; import java.util.Properties;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.BuildEvent; import org.apache.myrmidon.listeners.AbstractProjectListener;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Javac;
@@ -715,7 +714,7 @@ public class IContract extends MatchingTask


// We want to be notified if iContract jar is missing. This makes life easier for the user // We want to be notified if iContract jar is missing. This makes life easier for the user
// who didn't understand that iContract is a separate library (duh!) // who didn't understand that iContract is a separate library (duh!)
getProject().addBuildListener( new IContractPresenceDetector() ); getProject().addProjectListener( new IContractPresenceDetector() );


// Prepare the directories for iContract. iContract will make them if they // Prepare the directories for iContract. iContract will make them if they
// don't exist, but for some reason I don't know, it will complain about the REP files // don't exist, but for some reason I don't know, it will complain about the REP files
@@ -1079,38 +1078,20 @@ public class IContract extends MatchingTask
* about missing iContract is missing. Used to indicate a more verbose error * about missing iContract is missing. Used to indicate a more verbose error
* to the user, with advice about how to solve the problem * to the user, with advice about how to solve the problem
*/ */
private class IContractPresenceDetector implements BuildListener private class IContractPresenceDetector
extends AbstractProjectListener
{ {
public void buildFinished( BuildEvent event ) /**
{ * Notify listener of log message event.
} *

* @param message the message
public void buildStarted( BuildEvent event ) */
{ public void log( final String message )
}

public void messageLogged( BuildEvent event )
{ {
if( "java.lang.NoClassDefFoundError: com/reliablesystems/iContract/Tool".equals( event.getMessage() ) ) if( "java.lang.NoClassDefFoundError: com/reliablesystems/iContract/Tool".equals( event.getMessage() ) )
{ {
iContractMissing = true; iContractMissing = true;
} }
} }

public void targetFinished( BuildEvent event )
{
}

public void targetStarted( BuildEvent event )
{
}

public void taskFinished( BuildEvent event )
{
}

public void taskStarted( BuildEvent event )
{
}
} }
} }

||||||
x
 
000:0
Loading…
Cancel
Save