}
public Path createClasspath() {
- if (bootclasspath == null) {
- bootclasspath = new Path(project);
+ if (classpath == null) {
+ classpath = new Path(project);
}
- return bootclasspath.createPath();
+ return classpath.createPath();
}
public void setBootclasspath(Path path) {
}
public Path createBootclasspath() {
- if (classpath == null) {
- classpath = new Path(project);
+ if (bootclasspath == null) {
+ bootclasspath = new Path(project);
}
- return classpath.createPath();
+ return bootclasspath.createPath();
}
public void setExtdirs(Path path) {
executing = true;
}
try {
- if (0 < ignored.size()) {
- for (Iterator iter = ignored.iterator(); iter.hasNext();) {
- log("ignored: " + iter.next(), Project.MSG_INFO);
- }
- }
- // when copying resources, use temp jar for class output
- // then copy temp jar contents and resources to output jar
- if (null != outjar) {
- if (copyInjars || (null != sourceRootCopyFilter)) {
- String path = outjar.getAbsolutePath();
- int len = FileUtil.zipSuffixLength(path);
- if (len < 1) {
- log("not copying injars - weird outjar: " + path);
- } else {
- path = path.substring(0, path.length()-len) + ".tmp.jar";
- tmpOutjar = new File(path);
- }
- }
- if (null == tmpOutjar) {
- cmd.addFlagged("-outjar", outjar.getAbsolutePath());
- } else {
- cmd.addFlagged("-outjar", tmpOutjar.getAbsolutePath());
- }
- }
-
- addListArgs();
- if (verbose || listFileArgs) { // XXX if listFileArgs, only do that
+ boolean copyArgs = false;
+ setupCommand(copyArgs);
+ if (verbose || listFileArgs) { // XXX if listFileArgs, only do that
String[] args = cmd.extractArguments();
- log("ajc " + Arrays.asList(args), Project.MSG_VERBOSE);
- }
+ log("ajc " + Arrays.asList(args), Project.MSG_VERBOSE);
+ }
if (!fork) {
executeInSameVM();
} else { // when forking, Adapter handles failonerror
tmpOutjar.delete();
}
}
+ }
+
+ String[] setupCommand(boolean copyArgs) {
+ if (0 < ignored.size()) {
+ for (Iterator iter = ignored.iterator(); iter.hasNext();) {
+ log("ignored: " + iter.next(), Project.MSG_INFO);
+ }
+ }
+ // when copying resources, use temp jar for class output
+ // then copy temp jar contents and resources to output jar
+ if (null != outjar) {
+ if (copyInjars || (null != sourceRootCopyFilter)) {
+ String path = outjar.getAbsolutePath();
+ int len = FileUtil.zipSuffixLength(path);
+ if (len < 1) {
+ log("not copying injars - weird outjar: " + path);
+ } else {
+ path = path.substring(0, path.length()-len) + ".tmp.jar";
+ tmpOutjar = new File(path);
+ }
+ }
+ if (null == tmpOutjar) {
+ cmd.addFlagged("-outjar", outjar.getAbsolutePath());
+ } else {
+ cmd.addFlagged("-outjar", tmpOutjar.getAbsolutePath());
+ }
+ }
+
+ addListArgs();
+ String[] result = null;
+ if (copyArgs) {
+ result = cmd.extractArguments();
+ }
+ return result;
}
/**
runTest(task, NO_EXCEPTION, IMessageHolderChecker.ONE_ERROR_ONE_ABORT);
}
+ public void testClasspath() {
+ AjcTask task = getTask(NOFILE);
+ String[] cmd = task.setupCommand(true);
+ String classpath = null;
+ String bootclasspath = null;
+ for (int i = 0; i < cmd.length; i++) {
+ if ("-classpath".equals(cmd[i])) {
+ classpath = cmd[i+1];
+ } else if ("-bootclasspath".equals(cmd[i])) {
+ bootclasspath = cmd[i+1];
+ }
+ }
+ assertTrue("not expecting bootclasspath",
+ null == bootclasspath);
+ assertTrue("expecting aspectj in classpath",
+ (-1 != classpath.indexOf("aspectjrt.jar")));
+ }
+
// ---------------------------------------- sourcefile
// XXX need to figure out how to specify files directly programmatically
// public void testDefaultFile() {