Browse Source

Move the execute related classes into a new package.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270241 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 24 years ago
parent
commit
45989d1efe
20 changed files with 24 additions and 194 deletions
  1. +0
    -84
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Exit.java
  2. +2
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecTask.java
  3. +3
    -3
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java
  4. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecuteStreamHandler.java
  5. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecuteWatchdog.java
  6. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/LogOutputStream.java
  7. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/LogStreamHandler.java
  8. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ProcessDestroyer.java
  9. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/PumpStreamHandler.java
  10. +1
    -1
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/StreamPumper.java
  11. +0
    -84
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Exit.java
  12. +2
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecTask.java
  13. +3
    -3
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/Execute.java
  14. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecuteStreamHandler.java
  15. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecuteWatchdog.java
  16. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/LogOutputStream.java
  17. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/LogStreamHandler.java
  18. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ProcessDestroyer.java
  19. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/PumpStreamHandler.java
  20. +1
    -1
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/StreamPumper.java

+ 0
- 84
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Exit.java View File

@@ -1,84 +0,0 @@
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;

import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;

/**
* Just exit the active build, giving an additional message if available.
*
* @author <a href="mailto:nico@seessle.de">Nico Seessle</a>
*/
public class Exit extends Task
{
private String ifCondition, unlessCondition;
private String message;

public void setIf( String c )
{
ifCondition = c;
}

public void setMessage( String value )
{
this.message = value;
}

public void setUnless( String c )
{
unlessCondition = c;
}

/**
* Set a multiline message.
*
* @param msg The feature to be added to the Text attribute
*/
public void addText( String msg )
throws TaskException
{
message += project.replaceProperties( msg );
}

public void execute()
throws TaskException
{
if( testIfCondition() && testUnlessCondition() )
{
if( message != null && message.length() > 0 )
{
throw new TaskException( message );
}
else
{
throw new TaskException( "No message" );
}
}
}

private boolean testIfCondition()
{
if( ifCondition == null || "".equals( ifCondition ) )
{
return true;
}

return project.getProperty( ifCondition ) != null;
}

private boolean testUnlessCondition()
{
if( unlessCondition == null || "".equals( unlessCondition ) )
{
return true;
}
return project.getProperty( unlessCondition ) == null;
}

}

proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecTask.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecTask.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@@ -31,7 +31,6 @@ import org.apache.tools.ant.types.Environment;
*/ */
public class ExecTask extends Task public class ExecTask extends Task
{ {

private static String lSep = System.getProperty( "line.separator" ); private static String lSep = System.getProperty( "line.separator" );
protected boolean failOnError = false; protected boolean failOnError = false;
protected boolean newEnvironment = false; protected boolean newEnvironment = false;
@@ -370,7 +369,7 @@ public class ExecTask extends Task
* @param result Description of Parameter * @param result Description of Parameter
*/ */
protected void maybeSetResultPropertyValue( int result ) protected void maybeSetResultPropertyValue( int result )
throws TaskException
throws TaskException
{ {
String res = Integer.toString( result ); String res = Integer.toString( result );
if( resultProperty != null ) if( resultProperty != null )

proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Execute.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/Execute.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@@ -239,7 +239,7 @@ public class Execute
// Since we "look ahead" before adding, there's one last env var. // Since we "look ahead" before adding, there's one last env var.
procEnvironment.addElement( var ); procEnvironment.addElement( var );
} }
catch( java.io.IOException exc )
catch( IOException exc )
{ {
exc.printStackTrace(); exc.printStackTrace();
// Just try to see how much we got // Just try to see how much we got
@@ -272,7 +272,7 @@ public class Execute
throw new TaskException( cmdline[ 0 ] + " failed with return code " + retval ); throw new TaskException( cmdline[ 0 ] + " failed with return code " + retval );
} }
} }
catch( java.io.IOException exc )
catch( IOException exc )
{ {
throw new TaskException( "Could not launch " + cmdline[ 0 ] + ": " + exc ); throw new TaskException( "Could not launch " + cmdline[ 0 ] + ": " + exc );
} }

proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecuteStreamHandler.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ExecuteWatchdog.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;



proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/LogOutputStream.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;

proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogStreamHandler.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/LogStreamHandler.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.IOException; import java.io.IOException;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;

proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ProcessDestroyer.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/ProcessDestroyer.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Enumeration; import java.util.Enumeration;

proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PumpStreamHandler.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/PumpStreamHandler.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java → proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/exec/StreamPumper.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

+ 0
- 84
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Exit.java View File

@@ -1,84 +0,0 @@
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;

import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;

/**
* Just exit the active build, giving an additional message if available.
*
* @author <a href="mailto:nico@seessle.de">Nico Seessle</a>
*/
public class Exit extends Task
{
private String ifCondition, unlessCondition;
private String message;

public void setIf( String c )
{
ifCondition = c;
}

public void setMessage( String value )
{
this.message = value;
}

public void setUnless( String c )
{
unlessCondition = c;
}

/**
* Set a multiline message.
*
* @param msg The feature to be added to the Text attribute
*/
public void addText( String msg )
throws TaskException
{
message += project.replaceProperties( msg );
}

public void execute()
throws TaskException
{
if( testIfCondition() && testUnlessCondition() )
{
if( message != null && message.length() > 0 )
{
throw new TaskException( message );
}
else
{
throw new TaskException( "No message" );
}
}
}

private boolean testIfCondition()
{
if( ifCondition == null || "".equals( ifCondition ) )
{
return true;
}

return project.getProperty( ifCondition ) != null;
}

private boolean testUnlessCondition()
{
if( unlessCondition == null || "".equals( unlessCondition ) )
{
return true;
}
return project.getProperty( unlessCondition ) == null;
}

}

proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecTask.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecTask.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@@ -31,7 +31,6 @@ import org.apache.tools.ant.types.Environment;
*/ */
public class ExecTask extends Task public class ExecTask extends Task
{ {

private static String lSep = System.getProperty( "line.separator" ); private static String lSep = System.getProperty( "line.separator" );
protected boolean failOnError = false; protected boolean failOnError = false;
protected boolean newEnvironment = false; protected boolean newEnvironment = false;
@@ -370,7 +369,7 @@ public class ExecTask extends Task
* @param result Description of Parameter * @param result Description of Parameter
*/ */
protected void maybeSetResultPropertyValue( int result ) protected void maybeSetResultPropertyValue( int result )
throws TaskException
throws TaskException
{ {
String res = Integer.toString( result ); String res = Integer.toString( result );
if( resultProperty != null ) if( resultProperty != null )

proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Execute.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/Execute.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@@ -239,7 +239,7 @@ public class Execute
// Since we "look ahead" before adding, there's one last env var. // Since we "look ahead" before adding, there's one last env var.
procEnvironment.addElement( var ); procEnvironment.addElement( var );
} }
catch( java.io.IOException exc )
catch( IOException exc )
{ {
exc.printStackTrace(); exc.printStackTrace();
// Just try to see how much we got // Just try to see how much we got
@@ -272,7 +272,7 @@ public class Execute
throw new TaskException( cmdline[ 0 ] + " failed with return code " + retval ); throw new TaskException( cmdline[ 0 ] + " failed with return code " + retval );
} }
} }
catch( java.io.IOException exc )
catch( IOException exc )
{ {
throw new TaskException( "Could not launch " + cmdline[ 0 ] + ": " + exc ); throw new TaskException( "Could not launch " + cmdline[ 0 ] + ": " + exc );
} }

proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecuteStreamHandler.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ExecuteWatchdog.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;



proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogOutputStream.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/LogOutputStream.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;

proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/LogStreamHandler.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.IOException; import java.io.IOException;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;

proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/ProcessDestroyer.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Enumeration; import java.util.Enumeration;

proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/PumpStreamHandler.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/StreamPumper.java → proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/exec/StreamPumper.java View File

@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in * version 1.1, a copy of which has been included with this distribution in
* the LICENSE file. * the LICENSE file.
*/ */
package org.apache.tools.ant.taskdefs;
package org.apache.tools.ant.taskdefs.exec;


import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;

Loading…
Cancel
Save