aboutsummaryrefslogtreecommitdiffstats
path: root/taskdefs
diff options
context:
space:
mode:
Diffstat (limited to 'taskdefs')
-rw-r--r--taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java42
-rw-r--r--taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java29
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();