Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 32251 invoked from network); 4 May 2005 19:05:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 May 2005 19:05:33 -0000 Received: (qmail 92935 invoked by uid 500); 4 May 2005 19:07:27 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 92859 invoked by uid 500); 4 May 2005 19:07:25 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 92741 invoked by uid 500); 4 May 2005 19:07:24 -0000 Received: (qmail 92675 invoked by uid 99); 4 May 2005 19:07:23 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 04 May 2005 12:07:17 -0700 Received: (qmail 31482 invoked by uid 1365); 4 May 2005 19:04:59 -0000 Date: 4 May 2005 19:04:59 -0000 Message-ID: <20050504190459.31481.qmail@minotaur.apache.org> From: stevel@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs AptTest.java X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N stevel 2005/05/04 12:04:59 Modified: docs/manual/CoreTasks apt.html src/etc/testcases/taskdefs apt.xml src/main/org/apache/tools/ant/taskdefs Apt.java src/main/org/apache/tools/ant/taskdefs/compilers AptCompilerAdapter.java src/testcases/org/apache/tools/ant/taskdefs AptTest.java Log: removes fork option from Apt, in code, in docs. Revision Changes Path 1.10 +15 -3 ant/docs/manual/CoreTasks/apt.html Index: apt.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTasks/apt.html,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- apt.html 29 Apr 2005 18:58:13 -0000 1.9 +++ apt.html 4 May 2005 19:04:59 -0000 1.10 @@ -7,11 +7,23 @@

Apt

Description

Runs the annotation processor tool (apt), and then optionally compiles - the original code, and any generated source code. This task requires Java1.5 or later.

+ the original code, and any generated source code. This task requires Java 1.5. + It may work on later versions, but this cannot be confirmed until those + versions ship. Be advised that the Apt tool does appear to be an unstable + part of the JDK framework, so may change radically in future versions. + If the <apt> task does break when upgrading JVM, please + check to see if there is a more recent version of Ant that tracks + any changes.

This task inherits from the Javac Task, and thus - supports all of the same attributes, and subelements. In addition, it supports + supports nearly all of the same attributes, and subelements. + There is one special case, the fork attribute, which is present + but which can only be set to true. That is, apt only works as + a forked process. +

+

+ In addition, it supports the following addition items:

Parameters

@@ -109,7 +121,7 @@

Notes

-The inherited "fork" attribute is set to true by default. +The inherited "fork" attribute is set to true by default; please do not change it.

1.3 +13 -0 ant/src/etc/testcases/taskdefs/apt.xml Index: apt.xml =================================================================== RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/apt.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- apt.xml 24 Mar 2005 22:55:05 -0000 1.2 +++ apt.xml 4 May 2005 19:04:59 -0000 1.3 @@ -59,6 +59,18 @@ + + + + + + + 1.9 +14 -10 ant/src/main/org/apache/tools/ant/taskdefs/Apt.java Index: Apt.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Apt.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Apt.java 10 Mar 2005 13:05:03 -0000 1.8 +++ Apt.java 4 May 2005 19:04:59 -0000 1.9 @@ -51,6 +51,12 @@ /** A warning message if used with java < 1.5. */ public static final String ERROR_WRONG_JAVA_VERSION = "Apt task requires Java 1.5+"; + + /** + * exposed for debug messages + */ + public static final String WARNING_IGNORING_FORK = + "Apt only runs in its own JVM; fork=false option ignored"; /** * The nested option element. @@ -103,7 +109,7 @@ */ public Apt() { super(); - super.setCompiler(AptCompilerAdapter.class.getName()); + super.setCompiler(AptExternalCompilerAdapter.class.getName()); setFork(true); } @@ -126,16 +132,15 @@ } /** - * Set the fork attribute (optional, default=true). - * If fork is true run the external apt command. - * If fork is false run the apt compiler in the same jvm as the task. - * @param fork if true use the external command. + * Set the fork attribute. + * Non-forking APT is highly classpath dependent and appears to be too + * brittle to work. The sole reason this attribute is retained + * is the superclass does it + * @param fork if false; warn the option is ignored. */ public void setFork(boolean fork) { - if (fork) { - super.setCompiler(AptExternalCompilerAdapter.class.getName()); - } else { - super.setCompiler(AptCompilerAdapter.class.getName()); + if (!fork) { + log(WARNING_IGNORING_FORK,Project.MSG_WARN); } } @@ -258,7 +263,6 @@ if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_5)) { throw new BuildException(ERROR_WRONG_JAVA_VERSION); } - super.execute(); } } 1.4 +6 -0 ant/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java Index: AptCompilerAdapter.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AptCompilerAdapter.java 7 Mar 2005 12:22:52 -0000 1.3 +++ AptCompilerAdapter.java 4 May 2005 19:04:59 -0000 1.4 @@ -60,6 +60,12 @@ * } * * + * This Adapter is designed to run Apt in-JVM, an option that is not actually + * exposed to end-users, because it was too brittle during beta testing; classpath + * problems being the core issue. + * + * + * * @since Ant 1.7 */ public class AptCompilerAdapter extends DefaultCompilerAdapter { 1.2 +5 -0 ant/src/testcases/org/apache/tools/ant/taskdefs/AptTest.java Index: AptTest.java =================================================================== RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/AptTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AptTest.java 9 Mar 2005 22:56:38 -0000 1.1 +++ AptTest.java 4 May 2005 19:04:59 -0000 1.2 @@ -45,6 +45,11 @@ public void testAptFork() { executeTarget("testAptFork"); } + + public void testAptForkFalse() { + executeTarget("testAptForkFalse"); + assertLogContaining(Apt.WARNING_IGNORING_FORK); + } public void testListAnnotationTypes() { executeTarget("testListAnnotationTypes"); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org