git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270582 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -15,8 +15,7 @@ import java.net.URL; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.ExecuteJava; | import org.apache.tools.ant.taskdefs.ExecuteJava; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -93,7 +92,7 @@ public class ANTLR extends Task | |||||
| */ | */ | ||||
| public Path createClasspath() | public Path createClasspath() | ||||
| { | { | ||||
| return commandline.createClasspath( getProject() ).createPath(); | |||||
| return commandline.createClasspath().createPath(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -223,9 +222,8 @@ public class ANTLR extends Task | |||||
| private int run( String[] command ) | private int run( String[] command ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| final Execute exe = new Execute(); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| if( workingdir != null ) | if( workingdir != null ) | ||||
| { | { | ||||
| @@ -16,8 +16,7 @@ import java.util.Random; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -114,9 +113,8 @@ public class CovMerge extends Task | |||||
| } | } | ||||
| cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | ||||
| final Execute exe = new Execute(); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| @@ -164,9 +162,7 @@ public class CovMerge extends Task | |||||
| } | } | ||||
| } | } | ||||
| File[] files = new File[ v.size() ]; | |||||
| v.copyInto( files ); | |||||
| return files; | |||||
| return (File[])v.toArray( new File[ v.size() ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -19,8 +19,7 @@ import javax.xml.transform.dom.DOMSource; | |||||
| import javax.xml.transform.stream.StreamResult; | import javax.xml.transform.stream.StreamResult; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -241,9 +240,8 @@ public class CovReport extends Task | |||||
| } | } | ||||
| // use the custom handler for stdin issues | // use the custom handler for stdin issues | ||||
| final Execute exe = new Execute(); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| int exitValue = exe.execute(); | int exitValue = exe.execute(); | ||||
| @@ -15,9 +15,7 @@ import java.io.StringWriter; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -189,7 +187,7 @@ public class Coverage | |||||
| */ | */ | ||||
| public Path createClasspath() | public Path createClasspath() | ||||
| { | { | ||||
| return cmdlJava.createClasspath( getProject() ).createPath(); | |||||
| return cmdlJava.createClasspath().createPath(); | |||||
| } | } | ||||
| public Filters createFilters() | public Filters createFilters() | ||||
| @@ -251,13 +249,11 @@ public class Coverage | |||||
| cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | ||||
| // use the custom handler for stdin issues | // use the custom handler for stdin issues | ||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), true ); | |||||
| final LogStreamHandler handler = new CoverageStreamHandler( output, error ); | |||||
| Execute exec = new Execute( handler ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exec.setCommandline( cmdl.getCommandline() ); | |||||
| int exitValue = exec.execute(); | |||||
| exe.setCommandline( cmdl.getCommandline() ); | |||||
| int exitValue = exe.execute(); | |||||
| if( exitValue != 0 ) | if( exitValue != 0 ) | ||||
| { | { | ||||
| throw new TaskException( "JProbe Coverage failed (" + exitValue + ")" ); | throw new TaskException( "JProbe Coverage failed (" + exitValue + ")" ); | ||||
| @@ -1,43 +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.txt file. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sitraka; | |||||
| import java.io.IOException; | |||||
| import java.io.OutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | |||||
| /** | |||||
| * specific pumper to avoid those nasty stdin issues | |||||
| */ | |||||
| class CoverageStreamHandler | |||||
| extends LogStreamHandler | |||||
| { | |||||
| CoverageStreamHandler( OutputStream output, OutputStream error ) | |||||
| { | |||||
| super( output, error ); | |||||
| } | |||||
| /** | |||||
| * there are some issues concerning all JProbe executable In our case a | |||||
| * 'Press ENTER to close this window..." will be displayed in the | |||||
| * current window waiting for enter. So I'm closing the stream right | |||||
| * away to avoid problems. | |||||
| * | |||||
| * @param os The new ProcessInputStream value | |||||
| */ | |||||
| public void setProcessInputStream( OutputStream os ) | |||||
| { | |||||
| try | |||||
| { | |||||
| os.close(); | |||||
| } | |||||
| catch( IOException ignored ) | |||||
| { | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -12,8 +12,7 @@ import java.io.IOException; | |||||
| 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.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -205,9 +204,8 @@ public abstract class MSVSS extends Task | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| // If location of ss.ini is specified we need to set the | // If location of ss.ini is specified we need to set the | ||||
| // environment-variable SSDIR to this value | // environment-variable SSDIR to this value | ||||
| @@ -15,8 +15,7 @@ import java.net.URL; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.ExecuteJava; | import org.apache.tools.ant.taskdefs.ExecuteJava; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -93,7 +92,7 @@ public class ANTLR extends Task | |||||
| */ | */ | ||||
| public Path createClasspath() | public Path createClasspath() | ||||
| { | { | ||||
| return commandline.createClasspath( getProject() ).createPath(); | |||||
| return commandline.createClasspath().createPath(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -223,9 +222,8 @@ public class ANTLR extends Task | |||||
| private int run( String[] command ) | private int run( String[] command ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| final Execute exe = new Execute(); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| if( workingdir != null ) | if( workingdir != null ) | ||||
| { | { | ||||
| @@ -16,8 +16,7 @@ import java.util.Random; | |||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.DirectoryScanner; | import org.apache.tools.ant.DirectoryScanner; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| @@ -114,9 +113,8 @@ public class CovMerge extends Task | |||||
| } | } | ||||
| cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | cmdl.createArgument().setValue( "-jp_paramfile=" + paramfile.getAbsolutePath() ); | ||||
| final Execute exe = new Execute(); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| @@ -164,9 +162,7 @@ public class CovMerge extends Task | |||||
| } | } | ||||
| } | } | ||||
| File[] files = new File[ v.size() ]; | |||||
| v.copyInto( files ); | |||||
| return files; | |||||
| return (File[])v.toArray( new File[ v.size() ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -19,8 +19,7 @@ import javax.xml.transform.dom.DOMSource; | |||||
| import javax.xml.transform.stream.StreamResult; | import javax.xml.transform.stream.StreamResult; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.EnumeratedAttribute; | import org.apache.tools.ant.types.EnumeratedAttribute; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| @@ -241,9 +240,8 @@ public class CovReport extends Task | |||||
| } | } | ||||
| // use the custom handler for stdin issues | // use the custom handler for stdin issues | ||||
| final Execute exe = new Execute(); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exe.setCommandline( cmdl.getCommandline() ); | exe.setCommandline( cmdl.getCommandline() ); | ||||
| int exitValue = exe.execute(); | int exitValue = exe.execute(); | ||||
| @@ -15,9 +15,7 @@ import java.io.StringWriter; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Argument; | import org.apache.tools.ant.types.Argument; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.CommandlineJava; | import org.apache.tools.ant.types.CommandlineJava; | ||||
| @@ -189,7 +187,7 @@ public class Coverage | |||||
| */ | */ | ||||
| public Path createClasspath() | public Path createClasspath() | ||||
| { | { | ||||
| return cmdlJava.createClasspath( getProject() ).createPath(); | |||||
| return cmdlJava.createClasspath().createPath(); | |||||
| } | } | ||||
| public Filters createFilters() | public Filters createFilters() | ||||
| @@ -251,13 +249,11 @@ public class Coverage | |||||
| cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | cmdl.createArgument().setValue( "-jp_input=" + paramfile.getAbsolutePath() ); | ||||
| // use the custom handler for stdin issues | // use the custom handler for stdin issues | ||||
| final LogOutputStream output = new LogOutputStream( getLogger(), false ); | |||||
| final LogOutputStream error = new LogOutputStream( getLogger(), true ); | |||||
| final LogStreamHandler handler = new CoverageStreamHandler( output, error ); | |||||
| Execute exec = new Execute( handler ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| getLogger().debug( cmdl.toString() ); | getLogger().debug( cmdl.toString() ); | ||||
| exec.setCommandline( cmdl.getCommandline() ); | |||||
| int exitValue = exec.execute(); | |||||
| exe.setCommandline( cmdl.getCommandline() ); | |||||
| int exitValue = exe.execute(); | |||||
| if( exitValue != 0 ) | if( exitValue != 0 ) | ||||
| { | { | ||||
| throw new TaskException( "JProbe Coverage failed (" + exitValue + ")" ); | throw new TaskException( "JProbe Coverage failed (" + exitValue + ")" ); | ||||
| @@ -1,43 +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.txt file. | |||||
| */ | |||||
| package org.apache.tools.ant.taskdefs.optional.sitraka; | |||||
| import java.io.IOException; | |||||
| import java.io.OutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogStreamHandler; | |||||
| /** | |||||
| * specific pumper to avoid those nasty stdin issues | |||||
| */ | |||||
| class CoverageStreamHandler | |||||
| extends LogStreamHandler | |||||
| { | |||||
| CoverageStreamHandler( OutputStream output, OutputStream error ) | |||||
| { | |||||
| super( output, error ); | |||||
| } | |||||
| /** | |||||
| * there are some issues concerning all JProbe executable In our case a | |||||
| * 'Press ENTER to close this window..." will be displayed in the | |||||
| * current window waiting for enter. So I'm closing the stream right | |||||
| * away to avoid problems. | |||||
| * | |||||
| * @param os The new ProcessInputStream value | |||||
| */ | |||||
| public void setProcessInputStream( OutputStream os ) | |||||
| { | |||||
| try | |||||
| { | |||||
| os.close(); | |||||
| } | |||||
| catch( IOException ignored ) | |||||
| { | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -12,8 +12,7 @@ import java.io.IOException; | |||||
| 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.Task; | import org.apache.tools.ant.Task; | ||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | |||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| /** | /** | ||||
| @@ -205,9 +204,8 @@ public abstract class MSVSS extends Task | |||||
| { | { | ||||
| try | try | ||||
| { | { | ||||
| final Execute exe = new Execute(); | |||||
| exe.setOutput( new LogOutputStream( getLogger(), false ) ); | |||||
| exe.setError( new LogOutputStream( getLogger(), true ) ); | |||||
| final Execute2 exe = new Execute2(); | |||||
| setupLogger( exe ); | |||||
| // If location of ss.ini is specified we need to set the | // If location of ss.ini is specified we need to set the | ||||
| // environment-variable SSDIR to this value | // environment-variable SSDIR to this value | ||||