aboutsummaryrefslogtreecommitdiffstats
path: root/taskdefs/src
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2018-02-14 14:05:31 -0800
committerAndy Clement <aclement@pivotal.io>2018-02-14 14:05:31 -0800
commit9e4928968907207a1a0557b1db8475690d921f39 (patch)
treed9407df7a8f606443c81fc8145ff2f3e8c3a7357 /taskdefs/src
parent323a9c2b24df0aa92dc40137de98e106f9dc18ea (diff)
downloadaspectj-9e4928968907207a1a0557b1db8475690d921f39.tar.gz
aspectj-9e4928968907207a1a0557b1db8475690d921f39.zip
Fix Bug 531179 - Add compiler arg support to iajc task
Diffstat (limited to 'taskdefs/src')
-rw-r--r--taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java25
-rw-r--r--taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java49
2 files changed, 59 insertions, 15 deletions
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java
index 686b3b75a..065f44e71 100644
--- a/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java
+++ b/taskdefs/src/org/aspectj/tools/ant/taskdefs/Ajc10.java
@@ -12,6 +12,16 @@
package org.aspectj.tools.ant.taskdefs;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project;
@@ -28,23 +38,13 @@ import org.aspectj.tools.ajc.Main;
import org.aspectj.tools.ajc.Main.MessagePrinter;
import org.aspectj.util.FileUtil;
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
/**
* Main taskdef class for the AspectJ 1.0 compiler, <code>ajc</code>.
* See the README and examples/build.xml for more information.
*/
public class Ajc10 extends MatchingTask {
- private static final List VALID_XOPTIONS;
+ private static final List<String> VALID_XOPTIONS;
static {
String[] xs = new String[]
{ "lint", "serializableAspects", "targetNearSource", "OcodeSize",
@@ -398,7 +398,8 @@ public class Ajc10 extends MatchingTask {
// ------------------------- operational methods
- public void execute() throws BuildException {
+ @Override
+ public void execute() throws BuildException {
if (srcdir == null && argfiles == null) {
throw new BuildException("one of srcdir or argfiles must be set!",
location);
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
index e5e726add..1bbab168a 100644
--- a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
+++ b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
@@ -227,6 +227,7 @@ public class AjcTask extends MatchingTask {
private static final int MAX_COMMANDLINE = 4096;
private static final File DEFAULT_DESTDIR = new File(".") {
+ @Override
public String toString() {
return "(no destination dir specified)";
}
@@ -326,6 +327,8 @@ public class AjcTask extends MatchingTask {
private File xweaveDir;
private String xdoneSignal;
+ private List<CompilerArg> compilerArgs;
+
// ----- added by adapter - integrate better?
private List /* File */adapterFiles;
private String[] adapterArguments;
@@ -390,6 +393,7 @@ public class AjcTask extends MatchingTask {
// need declare for "all fields initialized in ..."
adapterArguments = null;
adapterFiles = new ArrayList();
+ compilerArgs = null;
argfiles = null;
inxmlfiles = null;
executing = false;
@@ -481,7 +485,7 @@ public class AjcTask extends MatchingTask {
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.
@@ -694,6 +698,33 @@ public class AjcTask extends MatchingTask {
public Commandline.Argument createJvmarg() {
return this.javaCmd.createVmArgument();
}
+
+ public static class CompilerArg {
+
+ private String value;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return value;
+ }
+ }
+
+ public CompilerArg createCompilerarg() {
+ CompilerArg compilerArg = new CompilerArg();
+ if (compilerArgs == null) {
+ compilerArgs = new ArrayList<CompilerArg>();
+ }
+ compilerArgs.add(compilerArg);
+ return compilerArg;
+ }
// ----------------
public void setTagFile(File file) {
@@ -1076,6 +1107,7 @@ public class AjcTask extends MatchingTask {
*
* @exception BuildException if the compilation has problems or if there were compiler errors and failonerror is true.
*/
+ @Override
public void execute() throws BuildException {
this.logger = new TaskLogger(this);
if (executing) {
@@ -1273,6 +1305,7 @@ public class AjcTask extends MatchingTask {
Main newmain = new Main();
newmain.setHolder(holder);
newmain.setCompletionRunner(new Runnable() {
+ @Override
public void run() {
doCompletionTasks();
}
@@ -1480,7 +1513,7 @@ public class AjcTask extends MatchingTask {
// ------------------------------ setup and reporting
/** @return null if path null or empty, String rendition otherwise */
- protected static void addFlaggedPath(String flag, Path path, List list) {
+ protected static void addFlaggedPath(String flag, Path path, List<String> list) {
if (!LangUtil.isEmpty(flag) && ((null != path) && (0 < path.size()))) {
list.add(flag);
list.add(path.toString());
@@ -1490,7 +1523,7 @@ public class AjcTask extends MatchingTask {
/**
* Add to list any path or plural arguments.
*/
- protected void addListArgs(List list) throws BuildException {
+ protected void addListArgs(List<String> list) throws BuildException {
addFlaggedPath("-classpath", classpath, list);
addFlaggedPath("-bootclasspath", bootclasspath, list);
addFlaggedPath("-extdirs", extdirs, list);
@@ -1498,6 +1531,12 @@ public class AjcTask extends MatchingTask {
addFlaggedPath("-injars", injars, list);
addFlaggedPath("-inpath", inpath, list);
addFlaggedPath("-sourceroots", sourceRoots, list);
+
+ if (this.compilerArgs != null) {
+ for (CompilerArg compilerArg:compilerArgs) {
+ list.add(compilerArg.toString());
+ }
+ }
if (argfiles != null) {
String[] files = argfiles.list();
@@ -2070,6 +2109,7 @@ public class AjcTask extends MatchingTask {
*
* @see org.aspectj.bridge.IMessageHandler#handleMessage(org.aspectj.bridge.IMessage)
*/
+ @Override
public boolean handleMessage(IMessage message) throws AbortException {
Kind messageKind = message.getKind();
String messageText = message.toString();
@@ -2104,6 +2144,7 @@ public class AjcTask extends MatchingTask {
*
* @see org.aspectj.bridge.IMessageHandler#isIgnoring(org.aspectj.bridge.IMessage.Kind)
*/
+ @Override
public boolean isIgnoring(Kind kind) {
return false;
}
@@ -2113,6 +2154,7 @@ public class AjcTask extends MatchingTask {
*
* @see org.aspectj.bridge.IMessageHandler#dontIgnore(org.aspectj.bridge.IMessage.Kind)
*/
+ @Override
public void dontIgnore(Kind kind) {
}
@@ -2121,6 +2163,7 @@ public class AjcTask extends MatchingTask {
*
* @see org.aspectj.bridge.IMessageHandler#ignore(org.aspectj.bridge.IMessage.Kind)
*/
+ @Override
public void ignore(Kind kind) {
}