From 99f3f52ede04ab40bcbd0d59c405ef443e0f6759 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 19 Oct 2000 14:52:58 +0000 Subject: [PATCH] Ensure the output of the modern compiler is going to be redirected as well. Prepare for a second release candidate build. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268110 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 2 +- docs/index.html | 2 +- src/main/org/apache/tools/ant/taskdefs/Javac.java | 13 +++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/build.xml b/build.xml index 6d72d4dca..f77715cfd 100644 --- a/build.xml +++ b/build.xml @@ -12,7 +12,7 @@ - + diff --git a/docs/index.html b/docs/index.html index 0c532ddd4..7c861cd60 100644 --- a/docs/index.html +++ b/docs/index.html @@ -26,7 +26,7 @@
  • Dave Walend (dwalend@cs.tufts.edu)
  • -

    Version 1.2 - 2000/10/13

    +

    Version 1.2 - 2000/10/19


    Table of Contents

    diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 511e5c066..e1301e741 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -508,13 +508,15 @@ public class Javac extends MatchingTask { log("Using modern compiler", Project.MSG_VERBOSE); Commandline cmd = setupJavacCommand(); - // This won't build under JDK1.2.2 because the new compiler - // doesn't exist there. - //com.sun.tools.javac.Main compiler = new com.sun.tools.javac.Main(); - //if (compiler.compile(args) != 0) { + PrintStream err = System.err; + PrintStream out = System.out; // Use reflection to be able to build on all JDKs >= 1.1: try { + PrintStream logstr = + new PrintStream(new LogOutputStream(this, Project.MSG_WARN)); + System.setErr(logstr); + System.setErr(logstr); Class c = Class.forName ("com.sun.tools.javac.Main"); Object compiler = c.newInstance (); Method compile = c.getMethod ("compile", @@ -530,6 +532,9 @@ public class Javac extends MatchingTask { } else { throw new BuildException("Error starting modern compiler", ex, location); } + } finally { + System.setErr(err); + System.setErr(out); } }