Browse Source

Added "output" parameter to Ant - it will allow the redirection of output.

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267643 13f79535-47bb-0310-9956-ffa450edef68
master
Costin Manolache 25 years ago
parent
commit
e14600612c
2 changed files with 19 additions and 0 deletions
  1. +4
    -0
      src/main/org/apache/tools/ant/Project.java
  2. +15
    -0
      src/main/org/apache/tools/ant/taskdefs/Ant.java

+ 4
- 0
src/main/org/apache/tools/ant/Project.java View File

@@ -150,6 +150,10 @@ public class Project {
return this.out;
}

public void setOutput(PrintStream out) {
this.out=out;
}

public int getOutputLevel() {
return this.msgOutputLevel;
}


+ 15
- 0
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -82,6 +82,7 @@ public class Ant extends Task {
private String dir = null;
private String antFile = null;
private String target = null;
private String output = null;

Vector properties=new Vector();
Project p1;
@@ -104,6 +105,16 @@ public class Ant extends Task {
*/
public void execute() throws BuildException {
if( dir==null) dir=".";
if( output != null ) {
try {
PrintStream out=new PrintStream(new FileOutputStream(output));
p1.setOutput( out );
} catch( IOException ex ) {
project.log( "Ant: Can't set output to " + output );
}
}

p1.setBasedir(dir);
p1.setUserProperty("basedir" , dir);

@@ -139,6 +150,10 @@ public class Ant extends Task {
this.target = s;
}

public void setOutput(String s) {
this.output = s;
}

// XXX replace with createProperty!!
public Task createProperty() {
Property p=(Property)p1.createTask("property");


Loading…
Cancel
Save