From e14600612cbc7cabbd93720c0cfbe01f413e70c7 Mon Sep 17 00:00:00 2001 From: Costin Manolache Date: Tue, 28 Mar 2000 20:40:18 +0000 Subject: [PATCH] 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 --- src/main/org/apache/tools/ant/Project.java | 4 ++++ src/main/org/apache/tools/ant/taskdefs/Ant.java | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 5f291283a..c2edceac5 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -150,6 +150,10 @@ public class Project { return this.out; } + public void setOutput(PrintStream out) { + this.out=out; + } + public int getOutputLevel() { return this.msgOutputLevel; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index 19b7a2234..68a0ef893 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -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");