From ca4acbfcb0622ad9a83b2f37e8257b4589e0920d Mon Sep 17 00:00:00 2001 From: acolyer Date: Mon, 11 Aug 2003 09:48:42 +0000 Subject: [PATCH] use System property aspectjrt.path to add to testcase classpath if defined --- .../compiler/batch/BasicCommandTestCase.java | 10 +++--- .../compiler/batch/BcweaverJarMaker.java | 31 +++++++++++++------ .../compiler/batch/BinaryFormsTestCase.java | 19 ++++++++---- .../compiler/batch/CommandTestCase.java | 18 +++++++++-- .../compiler/batch/WorkingTestMain.java | 5 +-- 5 files changed, 59 insertions(+), 24 deletions(-) diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java index 824a85f43..dfc350f87 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BasicCommandTestCase.java @@ -97,7 +97,7 @@ public class BasicCommandTestCase extends CommandTestCase { args.add("out"); args.add("-classpath"); - args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin"); + args.add(getRuntimeClasspath() + File.pathSeparator + "../lib/junit/junit.jar;../testing-client/bin"); args.add("-Xlint:error"); args.add("testdata/src1/Xlint.java"); @@ -110,7 +110,7 @@ public class BasicCommandTestCase extends CommandTestCase { args.add("out"); args.add("-classpath"); - args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin;not_found_anywhere.jar"); + args.add(getRuntimeClasspath() + File.pathSeparator + "../lib/junit/junit.jar;../testing-client/bin;not_found_anywhere.jar"); args.add("testdata/src1/ThisAndModifiers.java"); ICommand command = new AjdtCommand(); @@ -145,7 +145,8 @@ public class BasicCommandTestCase extends CommandTestCase { List args = new ArrayList(); args.add("-classpath"); - args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin"); + args.add(getRuntimeClasspath() + File.pathSeparator + + "../lib/junit/junit.jar;../testing-client/bin"); File f1 = new File("testdata/src1/p1/Foo.class"); File f2 = new File("testdata/src1/WrongPackage.class"); @@ -180,7 +181,8 @@ public class BasicCommandTestCase extends CommandTestCase { args.add("out"); args.add("-classpath"); - args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin"); + args.add(getRuntimeClasspath() + File.pathSeparator + + "../lib/junit/junit.jar;../testing-client/bin"); args.add("testdata/src1/SizeIssuesAspect.java"); args.add("testdata/src1/SizeIssues.java"); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java index 86bd3c227..d9c5c0062 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BcweaverJarMaker.java @@ -12,6 +12,7 @@ package org.aspectj.ajdt.internal.compiler.batch; +import java.io.File; import java.io.IOException; import java.util.*; import java.util.ArrayList; @@ -41,7 +42,8 @@ public class BcweaverJarMaker { args.add("../weaver/testdata/tracing.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + File.pathSeparator + + System.getProperty("aspectjrt.path")); args.add("testdata/src1/Trace.java"); args.add("testdata/src1/MyTrace.java"); @@ -55,7 +57,8 @@ public class BcweaverJarMaker { args.add("../weaver/testdata/megatrace.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + File.pathSeparator + + System.getProperty("aspectjrt.path")); args.add("testdata/src1/trace/MegaTrace.java"); args.add("testdata/src1/trace/ExecTrace.java"); @@ -70,7 +73,8 @@ public class BcweaverJarMaker { args.add("../weaver/testdata/megatrace0easy.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + File.pathSeparator + + System.getProperty("aspectjrt.path")); args.add("testdata/src1/trace/MegaTrace.java"); args.add("testdata/src1/trace/ObviousTraceNothing.java"); @@ -84,7 +88,8 @@ public class BcweaverJarMaker { args.add("../weaver/testdata/megatrace0hard.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + File.pathSeparator + + System.getProperty("aspectjrt.path")); args.add("testdata/src1/trace/MegaTrace.java"); args.add("testdata/src1/trace/HardTraceNothing.java"); @@ -101,7 +106,8 @@ public class BcweaverJarMaker { args.add("-noweave"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + File.pathSeparator + + System.getProperty("aspectjrt.path")); args.add("testdata/src1/trace/MegaTrace.java"); args.add("testdata/src1/trace/ExecTrace.java"); @@ -116,7 +122,8 @@ public class BcweaverJarMaker { args.add("../weaver/testdata/dummyAspect.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + File.pathSeparator + + System.getProperty("aspectjrt.path")); args.add("testdata/src1/DummyAspect.java"); @@ -126,7 +133,9 @@ public class BcweaverJarMaker { public static void makeTestJars() throws IOException { List args = new ArrayList(); - args.add("-classpath"); args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar"); + args.add("-classpath"); + args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-outjar"); args.add("../tests/new/options11/aspectlib1.jar"); args.add("../tests/new/options11/library1/*.java"); @@ -135,7 +144,9 @@ public class BcweaverJarMaker { args = new ArrayList(); - args.add("-classpath"); args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar"); + args.add("-classpath"); + args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-outjar"); args.add("../tests/new/options11/aspectlib2.jar"); args.add("../tests/new/options11/library2/*.java"); @@ -144,7 +155,9 @@ public class BcweaverJarMaker { args = new ArrayList(); - args.add("-classpath"); args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar"); + args.add("-classpath"); + args.add("../lib/test/aspectjrt.jar;../lib/test/testing-client.jar" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-outjar"); args.add("../tests/new/options11/injar.jar"); args.add("../tests/new/options11/injar/*.java"); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java index 0382c9a1f..85c1e01ee 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/BinaryFormsTestCase.java @@ -12,6 +12,7 @@ package org.aspectj.ajdt.internal.compiler.batch; +import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -32,7 +33,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("out/lib.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-d"); args.add("out"); @@ -47,7 +49,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("out/lib.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-d"); args.add("out"); @@ -65,7 +68,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("out/lib.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-d"); args.add("out"); @@ -82,7 +86,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args.add("out/lib.jar"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-d"); args.add("out"); @@ -94,7 +99,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args = new ArrayList(); args.add("-classpath"); - args.add("../runtime/bin;out/lib.jar"); + args.add("../runtime/bin;out/lib.jar" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-d"); args.add("out"); @@ -105,7 +111,8 @@ public class BinaryFormsTestCase extends CommandTestCase { args = new ArrayList(); args.add("-classpath"); - args.add("../runtime/bin;out/lib.jar"); + args.add("../runtime/bin;out/lib.jar" + + File.pathSeparator + System.getProperty("aspectjrt.path")); args.add("-Xlint:error"); args.add("-d"); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java index d1391b8a5..1db780683 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/CommandTestCase.java @@ -20,6 +20,7 @@ import org.aspectj.bridge.IMessageHolder; import org.aspectj.bridge.MessageHandler; import org.aspectj.weaver.bcel.LazyClassGen; +import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -49,8 +50,10 @@ public abstract class CommandTestCase extends TestCase { args.add("-d"); args.add("out"); - args.add("-classpath"); - args.add("../runtime/bin;../lib/junit/junit.jar"); + args.add("-classpath"); + + args.add(getRuntimeClasspath() + File.pathSeparator + + "../lib/junit/junit.jar"); args.add("-g"); //XXX need this to get sourcefile and line numbers, shouldn't @@ -67,7 +70,7 @@ public abstract class CommandTestCase extends TestCase { args.add("out"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add(getRuntimeClasspath()); args.add("testdata/" + source); @@ -152,4 +155,13 @@ public abstract class CommandTestCase extends TestCase { } + /** get the location of the org.aspectj.lang & runtime classes */ + protected static String getRuntimeClasspath() { + return "../runtime/bin" + File.pathSeparator + + System.getProperty("aspectjrt.path"); + + } + } + + diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java index d63418ff6..8cf39d3f8 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/WorkingTestMain.java @@ -12,6 +12,7 @@ package org.aspectj.ajdt.internal.compiler.batch; +import java.io.File; import java.io.IOException; import java.util.*; import java.util.List; @@ -40,7 +41,7 @@ public class WorkingTestMain { args.add("out"); args.add("-classpath"); - args.add("../runtime/bin;../lib/junit/junit.jar;../testing-client/bin"); + args.add("../runtime/bin;" + System.getProperty("aspectjrt.path") + ";../lib/junit/junit.jar;../testing-client/bin"); //args.add("../runtime/bin;../lib/junit/junit.jar"); // args.add("-injars"); @@ -76,7 +77,7 @@ public class WorkingTestMain { args.add("out"); args.add("-classpath"); - args.add("../runtime/bin"); + args.add("../runtime/bin" + File.pathSeparator + System.getProperty("aspectjrt.path")); for (int i=0; i < argfiles.length; i++) { args.add("@" + examplesDir + argfiles[i]); -- 2.39.5