aboutsummaryrefslogtreecommitdiffstats
path: root/taskdefs
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-04-09 13:54:46 +0000
committerwisberg <wisberg>2003-04-09 13:54:46 +0000
commit501fb83d58cf6921c4af42cc8bbae556561409ae (patch)
tree4cd883da4f09063f1bf4a71ae8f89186ee077631 /taskdefs
parent22dd8fcfbcb6f7ad1d7401f2df9ef205253437fb (diff)
downloadaspectj-501fb83d58cf6921c4af42cc8bbae556561409ae.tar.gz
aspectj-501fb83d58cf6921c4af42cc8bbae556561409ae.zip
minimal (unverified) compiler adapter tests
Diffstat (limited to 'taskdefs')
-rw-r--r--taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java99
1 files changed, 99 insertions, 0 deletions
diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java
new file mode 100644
index 000000000..0d8ea4dd4
--- /dev/null
+++ b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/Ajc11CompilerAdapterTest.java
@@ -0,0 +1,99 @@
+/* *******************************************************************
+ * Copyright (c) 2003 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Common Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Wes Isberg initial implementation
+ * ******************************************************************/
+
+package org.aspectj.tools.ant.taskdefs;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Javac;
+import org.apache.tools.ant.types.Path;
+import org.aspectj.util.FileUtil;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ */
+public class Ajc11CompilerAdapterTest extends TestCase {
+ public static boolean LOGGING = false;
+ ArrayList tempFiles = new ArrayList();
+
+ public Ajc11CompilerAdapterTest(String name) {
+ super(name);
+ }
+
+ public void tearDown() {
+ for (Iterator iter = tempFiles.iterator(); iter.hasNext();) {
+ File file = (File) iter.next();
+ FileUtil.deleteContents(file);
+ file.delete();
+ }
+ }
+
+// public void testCompilerAdapterWithJavac() { // XXX requires tools.jar
+// Javac javac = getJavac(new Project());
+// setupTracingJava(javac);
+// javac.execute();
+// }
+
+ public void testCompilerAdapterWithAjc() { // XXX unverified
+ Project project = new Project();
+ String cname = Ajc11CompilerAdapter.class.getName();
+ project.setProperty("build.compiler", cname);
+ Javac javac = getJavac(project);
+ setupTracingJava(javac);
+ log("---- first compile...");
+ System.out.flush();
+ javac.execute();
+ log("---- second compile (none: nothing out of date?)...");
+ javac.execute();
+ }
+
+ public void testCompilerAdapterWithAjcRecursively() { // XXX unverified
+ Project project = new Project();
+ String cname = Ajc11CompilerAdapter.class.getName();
+ project.setProperty("build.compiler", cname);
+ project.setProperty("build.compiler.clean", "yes");
+ Javac javac = getJavac(project);
+ setupTracingJava(javac);
+ log("---- first compile...");
+ System.out.flush();
+ javac.execute();
+ log("---- second compile...");
+ System.out.flush();
+ javac.execute(); // expecting full recompile - pre-cleaned
+ }
+
+ Javac getJavac(Project project) {
+ Javac javac = new Javac();
+ javac.setProject(project);
+ File classesDir = FileUtil.getTempDir("Ajc11CompilerAdapterTest");
+ tempFiles.add(classesDir);
+ javac.setDestdir(classesDir);
+ javac.setVerbose(true);
+ return javac;
+ }
+
+ void setupTracingJava(Javac javac) { // XXX assumes module dir, doc loc
+ String exDir = "../docs/dist/doc/examples";
+ javac.setSrcdir(new Path(javac.getProject(), exDir));
+ javac.setIncludes("tracing/*.java"); // XXX assumes tracing example
+ }
+ void log(String s) {
+ if (LOGGING) {
+ System.err.println(s);
+ }
+ }
+}