diff options
author | hsestupin <stupin.sergey@gmail.com> | 2014-08-11 11:40:48 +0400 |
---|---|---|
committer | Andy Clement <aclement@gopivotal.com> | 2014-08-11 09:36:22 -0700 |
commit | ac48f780a46720f201ac893c8fbf9b1e17cc60d4 (patch) | |
tree | a8dc1c7199c5dca02f6fd5b0a276d55eceaf1102 | |
parent | 0419c01193d055b77a9ba2ee408a5dcbba4162b0 (diff) | |
download | aspectj-ac48f780a46720f201ac893c8fbf9b1e17cc60d4.tar.gz aspectj-ac48f780a46720f201ac893c8fbf9b1e17cc60d4.zip |
add apt args when calling from ant (AjcTask)
Signed-off-by: hsestupin <stupin.sergey@gmail.com>
-rw-r--r-- | taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java | 42 | ||||
-rw-r--r-- | taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java | 29 |
2 files changed, 71 insertions, 0 deletions
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java index 043830cfd..0b36599f8 100644 --- a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java +++ b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java @@ -461,6 +461,48 @@ public class AjcTask extends MatchingTask { return (0 == result.length() ? null : result.toString()); } + /** + * Controls whether annotation processing and/or compilation is done. + * -proc:none means that compilation takes place without annotation processing. + * -proc:only means that only annotation processing is done, without any subsequent compilation. + */ + public void setProc(String proc) { + if (proc.equals("none")) { + cmd.addFlag("-proc:none", true); + } else if (proc.equals("only")) { + cmd.addFlag("-proc:only", true); + } + } + + /** + * -processor class1[,class2,class3...] + * Names of the annotation processors to run. This bypasses the default discovery process. + */ + public void setProcessor(String processors) { + cmd.addFlagged("-processor", processors); + } + + /** + * -processorpath path + * Specify where to find annotation processors; if this option is not used, the class path will be searched for processors. + */ + public void setProcessorpath(String processorpath) { + cmd.addFlagged("-processorpath", processorpath); + } + + /** + * -s dir + * Specify the directory where to place generated source files. The directory must already exist; javac will not create it. + * If a class is part of a package, the compiler puts the source file in a subdirectory reflecting the package name, + * creating directories as needed. + * + * For example, if you specify -s C:\mysrc and the class is called com.mypackage.MyClass, + * then the source file will be placed in C:\mysrc\com\mypackage\MyClass.java. + */ + public void setS(String s) { + cmd.addFlagged("-s", s); + } + public void setIncremental(boolean incremental) { cmd.addFlag("-incremental", incremental); inIncrementalMode = incremental; diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java index 26516d163..6d88baf44 100644 --- a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java +++ b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java @@ -784,6 +784,35 @@ public class AjcTaskTest extends TestCase { } } + + public void testAptProc() { + AjcTask task = getTask(NOFILE); + task.setProc("none"); + checkContains(task.makeCommand(), "-proc:none", true); + task.setProc("only"); + checkContains(task.makeCommand(), "-proc:only", true); + } + + public void testAptProcessor() { + AjcTask task = getTask(NOFILE); + task.setProcessor("some.SomeClass"); + checkContains(task.makeCommand(), "-processor", true); + checkContains(task.makeCommand(), "some.SomeClass", true); + } + + public void testAptProcessorpath() { + AjcTask task = getTask(NOFILE); + task.setProcessorpath("some/path"); + checkContains(task.makeCommand(), "-processorpath", true); + checkContains(task.makeCommand(), "some/path", true); + } + + public void testAptGeneratedDirectory() { + AjcTask task = getTask(NOFILE); + task.setS("some/path"); + checkContains(task.makeCommand(), "-s", true); + checkContains(task.makeCommand(), "some/path", true); + } public void testOutxml () { File destDir = getTempDir(); |