remove apt task, there is no apt tool in java8
Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/afdf355c Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/afdf355c Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/afdf355c Branch: refs/heads/master Commit: afdf355c6570a12316d604254132491e64fcd4eb Parents: 3c930b9 Author: Stefan Bodewig <bode...@apache.org> Authored: Sat Apr 9 13:39:04 2016 +0200 Committer: Stefan Bodewig <bode...@apache.org> Committed: Sat Apr 9 13:39:04 2016 +0200 ---------------------------------------------------------------------- WHATSNEW | 3 + manual/Tasks/apt.html | 179 ------------ manual/tasklist.html | 1 - manual/tasksoverview.html | 6 - src/main/org/apache/tools/ant/taskdefs/Apt.java | 270 ------------------- .../taskdefs/compilers/AptCompilerAdapter.java | 187 ------------- .../compilers/AptExternalCompilerAdapter.java | 71 ----- .../tools/ant/taskdefs/defaults.properties | 1 - src/tests/antunit/taskdefs/apt/AptExample.java | 25 -- src/tests/antunit/taskdefs/apt/Distributed.java | 39 --- .../apt/DistributedAnnotationFactory.java | 50 ---- .../apt/DistributedAnnotationProcessor.java | 65 ----- 12 files changed, 3 insertions(+), 894 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/WHATSNEW ---------------------------------------------------------------------- diff --git a/WHATSNEW b/WHATSNEW index cbbdea9..4372dca 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -7,6 +7,9 @@ Changes that could break older environments: * Ant 1.10.x requires Java8 or newer at compile or build time. The 1.9.x series wil stay compatible with Java5. + * The <apt> task has been removed since apt itself has been removed + with Java8. + Fixed bugs: ----------- http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/manual/Tasks/apt.html ---------------------------------------------------------------------- diff --git a/manual/Tasks/apt.html b/manual/Tasks/apt.html deleted file mode 100644 index 4bdd9a9..0000000 --- a/manual/Tasks/apt.html +++ /dev/null @@ -1,179 +0,0 @@ -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<html lang="en-us"><head> -<meta http-equiv="Content-Language" content="en-us"><link rel="stylesheet" type="text/css" href="../stylesheets/style.css"> -<title>Apt Task</title></head> - -<body> - -<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. - <p>This task runs on Java 1.5 to Java 1.7.</p> - <p>Apt is deprecated in Java 1.6, which can run annotation - processors as part of javac, and removed from the distribution in Java 1.8. - The task will fire an exception when attempting to run under Java 1.8.</p> - - -<p>This task inherits from the <a href="javac.html">Javac Task</a>, and thus - 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> -<table border="1" cellpadding="2" cellspacing="0"> - <tbody><tr> - <td valign="top"><b>Attribute</b></td> - <td valign="top"><b>Description</b></td> - <td align="center" valign="top"><b>Required</b></td> - </tr> - <tr> - <td valign="top">compile</td> - <td valign="top">After running the Apt, should the code be compiled. (see the - <code>-nocompile</code> flag on the Apt executable)</td> - <td align="center" valign="top">No, defaults to false.</td> - </tr> - <tr> - <td valign="top">factory</td> - <td valign="top">The fully qualified classname of the AnnotationProcessFactory to be used - to construct annotation processors. This represents the <code>-factory</code> - command line flag of the Apt executable.</td> - <td align="center" valign="top">No</td> - </tr> - <tr> - <td valign="top">factorypathref</td> - <td valign="top">The reference id of the path used to find the classes needed by the - AnnotationProcessorFactory (and the location of the factory itself). - This represents the <code>-factorypath</code> flag on the Apt executable.</td> - <td align="center" valign="top">No</td> - </tr> - <tr> - <td valign="top">preprocessdir</td> - <td valign="top">The directory used for preprocessing. This is the directory where the - generated source code will be place. This represents the <code>-s</code> flag on - the Apt executable.</td> - <td align="center" valign="top">No</td> - </tr> -</tbody></table> - -<h3>Parameters specified as nested elements</h3> - - -<h4>factorypath</h4> - -<p>You can specify the path used to find the classes needed by the AnnotationProcessorFactory - at runtime, using this element. It is represents as a generic path like structure. This - represents the <code>-factorypath</code> flag on the Apt executable.</p> - - -<h4>option</h4> - -<p>Used to represent a generic option to pass to Apt. This represents the <code>-A</code> flag on the - Apt executable. You can specify zero or more <code><option></code> elements.</p> - -<table border="1" cellpadding="2" cellspacing="0"> -<tbody><tr> - <td valign="top" width="12%"><b>Attribute</b></td> - <td valign="top" width="78%"><b>Description</b></td> - <td valign="top" width="10%"><b>Required</b></td> -</tr> - <tr> - <td valign="top">name</td> - <td align="center">The name of the option</td> - <td align="center">Yes.</td> - </tr> - <tr> - <td valign="top">value</td> - <td align="center">The value to set the option to</td> - <td align="center">Yes.</td> - </tr> -</tbody></table> - -<h3>Examples</h3> -<blockquote><pre> -<apt srcdir="${src}" - destdir="${build}" - classpath="xyz.jar" - debug="on" - compile="true" - factory="com.mycom.MyAnnotationProcessorFactory" - factorypathref="my.factorypath.id" - preprocessdir="${preprocess.dir}"> -</apt> -</pre></blockquote> -<p>compiles all <code>.java</code> files under the <code>${src}</code> -directory, and stores -the <code>.class</code> files in the <code>${build}</code> directory. -The classpath used includes <code>xyz.jar</code>, and compiling with -debug information is on. It also forces the generated source code to -be compiled. The generated source code will be placed in -<code>${preprocess.dir}</code> directory, using the class -<code>com.mycom.MyAnnotationProcessorFactory</code> to supply -AnnotationProcessor instances.</p> - - -<h3>Notes</h3> - -<p> -The inherited "fork" attribute is set to true by default; please do not change it. -</p> - -<p> -The inherited "compiler" attribute is ignored, as it is forced to use the Apt compiler -</p> - -<p>Using the Apt compiler with the "compile" option set to "true" - forces you to use Sun's Apt compiler, which will use the JDK's Javac compiler. - If you wish to use another compiler, you will first need run the Apt processor - with the "compile" flag set to "false", and then use a - <code><javac></code> task to compile first your original source code, and then the - generated source code:</p> - -<blockquote><pre> -<apt srcdir="${src}" - destdir="${build}" - classpath="xyz.jar" - debug="true" - compile="false" - factory="com.mycom.MyAnnotationProcessorFactory" - factorypathref="my.factorypath.id" - preprocessdir="${preprocess.dir}"> -</apt> - -<javac srcdir="${src}" - destdir="${build}" - classpath="xyz.jar" - debug="on"/> - -<javac srcdir="${preprocess.dir}" - destdir="${build}" - classpath="xyz.jar" - debug="true"/> -</pre></blockquote> - -This may involve more build file coding, but the speedup gained from switching -to jikes may justify the effort. -<p> -</p> - -</body></html> http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/manual/tasklist.html ---------------------------------------------------------------------- diff --git a/manual/tasklist.html b/manual/tasklist.html index 6578e55..003ba75 100644 --- a/manual/tasklist.html +++ b/manual/tasklist.html @@ -40,7 +40,6 @@ <li><a href="Tasks/antstructure.html">AntStructure</a></li> <li><a href="Tasks/antversion.html">AntVersion</a></li> <li><a href="Tasks/apply.html">Apply/<i>ExecOn</i></a></li> -<li><a href="Tasks/apt.html">Apt</a></li> <li><a href="Tasks/attrib.html">Attrib</a></li> <li><a href="Tasks/augment.html">Augment</a></li> <li><a href="Tasks/available.html">Available</a></li> http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/manual/tasksoverview.html ---------------------------------------------------------------------- diff --git a/manual/tasksoverview.html b/manual/tasksoverview.html index 99aa11b..34b24fb 100644 --- a/manual/tasksoverview.html +++ b/manual/tasksoverview.html @@ -232,12 +232,6 @@ documentation.</p> </tr> <tr valign="top"> - <td nowrap><a href="Tasks/apt.html">Apt</a></td> - <td><p>Runs the annotation processor tool (apt), and then optionally compiles - the original code, and any generated source code.</p></td> - </tr> - - <tr valign="top"> <td nowrap><a href="Tasks/jspc.html">JspC</a></td> <td><p>Runs the JSP compiler. It can be used to precompile JSP pages for fast initial invocation of JSP pages, deployment on a server without http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/main/org/apache/tools/ant/taskdefs/Apt.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/Apt.java b/src/main/org/apache/tools/ant/taskdefs/Apt.java deleted file mode 100644 index 52154a8..0000000 --- a/src/main/org/apache/tools/ant/taskdefs/Apt.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package org.apache.tools.ant.taskdefs; - -import java.io.File; -import java.util.Vector; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.compilers.AptExternalCompilerAdapter; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; -import org.apache.tools.ant.util.JavaEnvUtils; - -/** - * Apt Task for running the Annotation processing tool for JDK 1.5. It derives - * from the existing Javac task, and forces the compiler based on whether we're - * executing internally, or externally. - * - * @since Ant 1.7 - */ - - -public class Apt - extends Javac { - private boolean compile = true; - private String factory; - private Path factoryPath; - private Vector<Option> options = new Vector<Option>(); - private File preprocessDir; - /** The name of the apt tool. */ - public static final String EXECUTABLE_NAME = "apt"; - /** An warning message when ignoring compiler attribute. */ - public static final String ERROR_IGNORING_COMPILER_OPTION - = "Ignoring compiler attribute for the APT task, as it is fixed"; - /** 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. - */ - public static final class Option { - private String name; - private String value; - - /** Constructor for Option */ - public Option() { - //default - } - - /** - * Get the name attribute. - * @return the name attribute. - */ - public String getName() { - return name; - } - - /** - * Set the name attribute. - * @param name the name of the option. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get the value attribute. - * @return the value attribute. - */ - public String getValue() { - return value; - } - - /** - * Set the value attribute. - * @param value the value of the option. - */ - public void setValue(String value) { - this.value = value; - } - } - - /** - * Constructor for Apt task. - * This sets the apt compiler adapter as the compiler in the super class. - */ - public Apt() { - super(); - super.setCompiler(AptExternalCompilerAdapter.class.getName()); - super.setFork(true); - } - - /** - * Get the name of the apt executable. - * - * @return the name of the executable. - */ - public String getAptExecutable() { - String exe = getExecutable(); - return exe != null ? exe : - JavaEnvUtils.getJdkExecutable(EXECUTABLE_NAME); - } - - /** - * Set the compiler. - * This is not allowed and a warning log message is made. - * @param compiler not used. - */ - public void setCompiler(String compiler) { - log(ERROR_IGNORING_COMPILER_OPTION, Project.MSG_WARN); - } - - /** - * 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) { - log(WARNING_IGNORING_FORK, Project.MSG_WARN); - } - } - - /** - * Get the compiler class name. - * @return the compiler class name. - */ - public String getCompiler() { - return super.getCompiler(); - } - - /** - * Get the compile option for the apt compiler. - * If this is false the "-nocompile" argument will be used. - * @return the value of the compile option. - */ - public boolean isCompile() { - return compile; - } - - /** - * Set the compile option for the apt compiler. - * Default value is true. - * @param compile if true set the compile option. - */ - public void setCompile(boolean compile) { - this.compile = compile; - } - - /** - * Get the factory option for the apt compiler. - * If this is non-null the "-factory" argument will be used. - * @return the value of the factory option. - */ - public String getFactory() { - return factory; - } - - /** - * Set the factory option for the apt compiler. - * Default value is null. - * @param factory the classname of the factory. - */ - public void setFactory(String factory) { - this.factory = factory; - } - - /** - * Add a reference to a path to the factoryPath attribute. - * @param ref a reference to a path. - */ - public void setFactoryPathRef(Reference ref) { - createFactoryPath().setRefid(ref); - } - - /** - * Add a path to the factoryPath attribute. - * @return a path to be configured. - */ - public Path createFactoryPath() { - if (factoryPath == null) { - factoryPath = new Path(getProject()); - } - return factoryPath.createPath(); - } - - /** - * Get the factory path attribute. - * If this is not null, the "-factorypath" argument will be used. - * The default value is null. - * @return the factory path attribute. - */ - public Path getFactoryPath() { - return factoryPath; - } - - /** - * Create a nested option. - * @return an option to be configured. - */ - public Option createOption() { - Option opt = new Option(); - options.add(opt); - return opt; - } - - /** - * Get the options to the compiler. - * Each option will use '"-E" name ["=" value]' argument. - * @return the options. - */ - public Vector<Option> getOptions() { - return options; - } - - /** - * Get the preprocessdir attribute. - * This corresponds to the "-s" argument. - * The default value is null. - * @return the preprocessdir attribute. - */ - public File getPreprocessDir() { - return preprocessDir; - } - - /** - * Set the preprocessdir attribute. - * @param preprocessDir where to place processor generated source files. - */ - public void setPreprocessDir(File preprocessDir) { - this.preprocessDir = preprocessDir; - } - - /** - * Do the compilation. - * @throws BuildException on error. - */ - public void execute() - throws BuildException { - if (JavaEnvUtils.getJavaVersionNumber() >= 18) { - throw new BuildException("apt does not exist under Java 1.8 and higher"); - } - super.execute(); - } -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java deleted file mode 100644 index 9503ac0..0000000 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.tools.ant.taskdefs.compilers; - -import java.io.File; -import java.lang.reflect.Method; -import java.util.Enumeration; -import java.util.Vector; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Apt; -import org.apache.tools.ant.types.Commandline; -import org.apache.tools.ant.types.Path; - - -/** - * <p>The implementation of the apt compiler for JDK 1.5.</p> - * - * <p>As usual, the low level entry points for Java tools are neither documented or - * stable; this entry point may change from that of 1.5.0_01-b08 without any - * warning at all. The IDE decompile of the tool entry points is as follows:</p> - * <pre> - * public class Main { - * public Main() ; - * - * public static transient void main(String... strings); - * - * public static transient int process(String... strings); - * - * public static transient int process(PrintWriter printWriter, - * String... strings); - * public static transient int process( - * AnnotationProcessorFactory annotationProcessorFactory, - * String... strings); - * - * public static transient int process( - * AnnotationProcessorFactory annotationProcessorFactory, - * PrintWriter printWriter, - * String... strings); - * private static transient int processing( - * AnnotationProcessorFactory annotationProcessorFactory, - * PrintWriter printWriter, - * String... strings) ; - * } - * </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 { - - /** - * Integer returned by the Apt compiler to indicate success. - */ - private static final int APT_COMPILER_SUCCESS = 0; - /** - * class in tools.jar that implements APT - */ - public static final String APT_ENTRY_POINT = "com.sun.tools.apt.Main"; - - /** - * method used to compile. - */ - public static final String APT_METHOD_NAME = "process"; - - /** - * Get the facade task that fronts this adapter - * - * @return task instance - * @see DefaultCompilerAdapter#getJavac() - */ - protected Apt getApt() { - return (Apt) getJavac(); - } - - /** - * Using the front end arguments, set up the command line to run Apt - * - * @param apt task - * @param cmd command that is set up with the various switches from the task - * options - */ - static void setAptCommandlineSwitches(final Apt apt, final Commandline cmd) { - - if (!apt.isCompile()) { - cmd.createArgument().setValue("-nocompile"); - } - - // Process the factory class - final String factory = apt.getFactory(); - if (factory != null) { - cmd.createArgument().setValue("-factory"); - cmd.createArgument().setValue(factory); - } - - // Process the factory path - final Path factoryPath = apt.getFactoryPath(); - if (factoryPath != null) { - cmd.createArgument().setValue("-factorypath"); - cmd.createArgument().setPath(factoryPath); - } - - final File preprocessDir = apt.getPreprocessDir(); - if (preprocessDir != null) { - cmd.createArgument().setValue("-s"); - cmd.createArgument().setFile(preprocessDir); - } - - // Process the processor options - final Vector options = apt.getOptions(); - final Enumeration elements = options.elements(); - Apt.Option opt; - StringBuffer arg = null; - while (elements.hasMoreElements()) { - opt = (Apt.Option) elements.nextElement(); - arg = new StringBuffer(); - arg.append("-A").append(opt.getName()); - if (opt.getValue() != null) { - arg.append("=").append(opt.getValue()); - } - cmd.createArgument().setValue(arg.toString()); - } - } - - /** - * using our front end task, set up the command line switches - * - * @param cmd command line to set up - */ - protected void setAptCommandlineSwitches(final Commandline cmd) { - final Apt apt = getApt(); - setAptCommandlineSwitches(apt, cmd); - } - - /** - * Run the compilation. - * @return true on success. - * @throws BuildException if the compilation has problems. - */ - public boolean execute() throws BuildException { - attributes.log("Using apt compiler", Project.MSG_VERBOSE); - //set up the javac options - final Commandline cmd = setupModernJavacCommand(); - //then add the Apt options - setAptCommandlineSwitches(cmd); - - //finally invoke APT - // Use reflection to be able to build on all JDKs: - try { - final Class c = Class.forName(APT_ENTRY_POINT); - final Object compiler = c.newInstance(); - final Method compile = c.getMethod(APT_METHOD_NAME, - new Class[]{(new String[]{}).getClass()}); - final int result = ((Integer) compile.invoke - (compiler, new Object[]{cmd.getArguments()})) - .intValue(); - return (result == APT_COMPILER_SUCCESS); - } catch (final BuildException be) { - //rethrow build exceptions - throw be; - } catch (final Exception ex) { - //cast everything else to a build exception - throw new BuildException("Error starting apt compiler", - ex, location); - } - } -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/main/org/apache/tools/ant/taskdefs/compilers/AptExternalCompilerAdapter.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/AptExternalCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/AptExternalCompilerAdapter.java deleted file mode 100644 index dadb55b..0000000 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/AptExternalCompilerAdapter.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.apache.tools.ant.taskdefs.compilers; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Apt; -import org.apache.tools.ant.types.Commandline; - -/** - * The implementation of the apt compiler for JDK 1.5 using an external process - * - * @since Ant 1.7 - */ -public class AptExternalCompilerAdapter extends DefaultCompilerAdapter { - - - /** - * Get the facade task that fronts this adapter - * - * @return task instance - * @see DefaultCompilerAdapter#getJavac() - */ - protected Apt getApt() { - return (Apt) getJavac(); - } - - /** - * Performs a compile using the Javac externally. - * @return true the compilation was successful. - * @throws BuildException if there is a problem. - */ - public boolean execute() throws BuildException { - attributes.log("Using external apt compiler", Project.MSG_VERBOSE); - - - // Setup the apt executable - Apt apt = getApt(); - Commandline cmd = new Commandline(); - cmd.setExecutable(apt.getAptExecutable()); - setupModernJavacCommandlineSwitches(cmd); - AptCompilerAdapter.setAptCommandlineSwitches(apt, cmd); - int firstFileName = cmd.size(); - //add the files - logAndAddFilesToCompile(cmd); - - //run - return 0 == executeExternalCompile(cmd.getCommandline(), - firstFileName, - true); - - } - -} - http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/main/org/apache/tools/ant/taskdefs/defaults.properties ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/defaults.properties b/src/main/org/apache/tools/ant/taskdefs/defaults.properties index 9cf1499..e1022fb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/defaults.properties +++ b/src/main/org/apache/tools/ant/taskdefs/defaults.properties @@ -19,7 +19,6 @@ antcall=org.apache.tools.ant.taskdefs.CallTarget antstructure=org.apache.tools.ant.taskdefs.AntStructure antversion=org.apache.tools.ant.taskdefs.condition.AntVersion apply=org.apache.tools.ant.taskdefs.Transform -apt=org.apache.tools.ant.taskdefs.Apt attributenamespacedef=org.apache.tools.ant.taskdefs.AttributeNamespaceDef augment=org.apache.tools.ant.taskdefs.AugmentReference available=org.apache.tools.ant.taskdefs.Available http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/tests/antunit/taskdefs/apt/AptExample.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/apt/AptExample.java b/src/tests/antunit/taskdefs/apt/AptExample.java deleted file mode 100644 index 9d6fcba..0000000 --- a/src/tests/antunit/taskdefs/apt/AptExample.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -/** - */ -@Distributed( - protocol="CORBA", - distribution=Distributed.DistributionTypes.FEDERATED - ) -public class AptExample { -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/tests/antunit/taskdefs/apt/Distributed.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/apt/Distributed.java b/src/tests/antunit/taskdefs/apt/Distributed.java deleted file mode 100644 index ebc3467..0000000 --- a/src/tests/antunit/taskdefs/apt/Distributed.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -import java.lang.annotation.Annotation; -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.RetentionPolicy; - -/** - */ -@Documented -@Retention(value = RetentionPolicy.RUNTIME) -@Target(value = ElementType.TYPE) -public @interface Distributed { - - public DistributionTypes distribution() default DistributionTypes.LOCAL; - - public String protocol() default "RMI"; - - public enum DistributionTypes { SINGLETON, LOCAL, FAULT_TOLERANT, FEDERATED, MOBILE}; - - -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/tests/antunit/taskdefs/apt/DistributedAnnotationFactory.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/apt/DistributedAnnotationFactory.java b/src/tests/antunit/taskdefs/apt/DistributedAnnotationFactory.java deleted file mode 100644 index a8fb633..0000000 --- a/src/tests/antunit/taskdefs/apt/DistributedAnnotationFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -import com.sun.mirror.apt.AnnotationProcessorFactory; -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; - -import java.util.Collection; -import java.util.Set; -import java.util.Arrays; -import java.util.Collections; - - -/** - * This was the first piece of Java1.5 code in the source tree. - * @since 20050-03-09T21:29:25Z - */ -public class DistributedAnnotationFactory implements AnnotationProcessorFactory { - - private static final Collection<String> supportedAnnotations - = Collections.unmodifiableCollection(Arrays.asList("*")); - - public Collection<String> supportedOptions() { - return Collections.emptySet(); - } - - public Collection<String> supportedAnnotationTypes() { - return supportedAnnotations; - } - - public AnnotationProcessor getProcessorFor( - Set<com.sun.mirror.declaration.AnnotationTypeDeclaration> annotationTypeDeclarations, - AnnotationProcessorEnvironment env) { - return new DistributedAnnotationProcessor(env); - } -} http://git-wip-us.apache.org/repos/asf/ant/blob/afdf355c/src/tests/antunit/taskdefs/apt/DistributedAnnotationProcessor.java ---------------------------------------------------------------------- diff --git a/src/tests/antunit/taskdefs/apt/DistributedAnnotationProcessor.java b/src/tests/antunit/taskdefs/apt/DistributedAnnotationProcessor.java deleted file mode 100644 index f94ff7f..0000000 --- a/src/tests/antunit/taskdefs/apt/DistributedAnnotationProcessor.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -//found in tools.jar, not the JRE runtime. -import com.sun.mirror.apt.AnnotationProcessor; -import com.sun.mirror.apt.AnnotationProcessorEnvironment; -import com.sun.mirror.declaration.TypeDeclaration; -import com.sun.mirror.declaration.ClassDeclaration; -import com.sun.mirror.util.SimpleDeclarationVisitor; -import static com.sun.mirror.util.DeclarationVisitors.*; - -import java.util.Map; - -/** - * Annotation processor outputs stuff - */ - -public class DistributedAnnotationProcessor implements AnnotationProcessor { - - public AnnotationProcessorEnvironment env; - - public DistributedAnnotationProcessor(AnnotationProcessorEnvironment env) { - this.env = env; - } - - public void echo(String text) { - env.getMessager().printNotice(text); - } - - public void process() { - echo("DistributedAnnotationProcessor-is-go"); - - Map<String, String> options=env.getOptions(); - for(String key:options.keySet()) { - echo("Option ["+key+"] = "+options.get(key)); - } - - //work time - for (TypeDeclaration typeDecl : env.getSpecifiedTypeDeclarations()) { - typeDecl.accept(getDeclarationScanner(new ClassVisitor(), - NO_OP)); - } - } - - private class ClassVisitor extends SimpleDeclarationVisitor { - public void visitClassDeclaration(ClassDeclaration d) { - echo("visiting "+ d.getQualifiedName()); - } - } -}