ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs AptTest.java
Date Wed, 04 May 2005 19:04:59 GMT
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 @@
   <h2><a name="Apt">Apt</a></h2>
   <h3>Description</h3>
   <p>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.</p>
  +   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 &lt;apt&gt; task does break when upgrading JVM, please
  +   check to see if there is a more recent version of Ant that tracks
  +   any changes.</p>
   
   
   <p>This task inherits from the <a href="javac.html">Javac Task</a>, 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 <tt>fork</tt> attribute, which is present
  +   but which can only be set to <tt>true</tt>. That is, apt only works as
  +   a forked process.
  + </p>
  + <p>
  +   In addition, it supports
      the following addition items:</p>
   
   <h3>Parameters</h3>
  @@ -109,7 +121,7 @@
   <h3>Notes</h3>
   
   <p>
  -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.
   </p>
   
   <p>
  
  
  
  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 @@
     <assertAptExampleCompiled />
   </target>
   
  +
  +<target name="testAptForkFalse" depends="init">
  +  <apt srcdir="${src}"
  +       destdir="${classes.dir}"
  +       debug="on"
  +       compile="true"
  +       fork="false"
  +       preprocessdir="${preprocess.dir}">
  +  </apt>
  +  <assertAptExampleCompiled />
  +</target>
  +
   <target name="testListAnnotationTypes" depends="init">
     <apt srcdir="${src}"
          destdir="${classes.dir}"
  @@ -105,4 +117,5 @@
   
   
   
  +
   </project>
  
  
  
  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 @@
    * }
    * </pre>
    *
  + * 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


Mime
View raw message