From fa7ca52b5278bd824a43a08e3ecd5f038696bb1a Mon Sep 17 00:00:00 2001 From: mwebster Date: Wed, 23 Aug 2006 14:34:28 +0000 Subject: [PATCH] Bug 149289 "Support system and user aop.xml configuration files" (add META-INF/aop-ajc.xml) --- .../META-INF/{aop.xml => aop-ajc.xml} | 0 ajde/testsrc/org/aspectj/ajde/OutxmlTest.java | 3 ++- bridge/src/org/aspectj/bridge/Constants.java | 19 +++++++++++++++++++ .../loadtime/ClassLoaderWeavingAdaptor.java | 3 ++- .../org/aspectj/ajdt/ajc/BuildArgParser.java | 2 +- .../ajdt/ajc/BuildArgParserTestCase.java | 2 +- .../tools/ant/taskdefs/AjcTaskTest.java | 4 ++-- .../tools/MultiProjectIncrementalTests.java | 2 +- 8 files changed, 28 insertions(+), 7 deletions(-) rename ajde/testdata/OutxmlTest/src-resources/META-INF/{aop.xml => aop-ajc.xml} (100%) create mode 100644 bridge/src/org/aspectj/bridge/Constants.java diff --git a/ajde/testdata/OutxmlTest/src-resources/META-INF/aop.xml b/ajde/testdata/OutxmlTest/src-resources/META-INF/aop-ajc.xml similarity index 100% rename from ajde/testdata/OutxmlTest/src-resources/META-INF/aop.xml rename to ajde/testdata/OutxmlTest/src-resources/META-INF/aop-ajc.xml diff --git a/ajde/testsrc/org/aspectj/ajde/OutxmlTest.java b/ajde/testsrc/org/aspectj/ajde/OutxmlTest.java index b4fff912b..2c018de1b 100644 --- a/ajde/testsrc/org/aspectj/ajde/OutxmlTest.java +++ b/ajde/testsrc/org/aspectj/ajde/OutxmlTest.java @@ -19,6 +19,7 @@ import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import org.aspectj.bridge.Constants; import org.aspectj.util.FileUtil; public class OutxmlTest extends AjdeTestCase { @@ -26,7 +27,7 @@ public class OutxmlTest extends AjdeTestCase { public static final String PROJECT_DIR = "OutxmlTest"; public static final String BIN_DIR = "bin"; public static final String OUTJAR_NAME = "/bin/test.jar"; - public static final String DEFAULT_AOPXML_NAME = "META-INF/aop.xml"; + public static final String DEFAULT_AOPXML_NAME = Constants.AOP_AJC_XML; public static final String CUSTOM_AOPXML_NAME = "custom/aop.xml"; /* diff --git a/bridge/src/org/aspectj/bridge/Constants.java b/bridge/src/org/aspectj/bridge/Constants.java new file mode 100644 index 000000000..b68dc4adc --- /dev/null +++ b/bridge/src/org/aspectj/bridge/Constants.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Webster - initial implementation + *******************************************************************************/ +package org.aspectj.bridge; + +public class Constants { + + /* Default resource names for user and generate aop.xml file */ + public final static String AOP_USER_XML = "META-INF/aop.xml"; + public final static String AOP_AJC_XML = "META-INF/aop-ajc.xml"; + +} diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 20d57f3e7..2e53d0cfa 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -28,6 +28,7 @@ import java.util.StringTokenizer; import org.aspectj.asm.IRelationship; import org.aspectj.bridge.AbortException; +import org.aspectj.bridge.Constants; import org.aspectj.bridge.ISourceLocation; import org.aspectj.util.LangUtil; import org.aspectj.weaver.ICrossReferenceHandler; @@ -52,7 +53,7 @@ import org.aspectj.weaver.tools.WeavingAdaptor; */ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { - private final static String AOP_XML = "META-INF/aop.xml"; + private final static String AOP_XML = Constants.AOP_USER_XML + ";" + Constants.AOP_AJC_XML; private boolean initialized; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java index 4aff85e38..4b2c82c13 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java @@ -493,7 +493,7 @@ public class BuildArgParser extends Main { showError("-outjar requires jar path argument"); } } else if (arg.equals("-outxml")) { - buildConfig.setOutxmlName("META-INF/aop.xml"); + buildConfig.setOutxmlName(org.aspectj.bridge.Constants.AOP_AJC_XML); } else if (arg.equals("-outxmlfile")) { if (args.size() > nextArgIndex) { String name = ((ConfigParser.Arg)args.get(nextArgIndex)).getValue(); diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java index 17ae5b01b..4ec4e5e78 100644 --- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java +++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java @@ -497,7 +497,7 @@ public class BuildArgParserTestCase extends TestCase { IMessageHolder messageHolder = new MessageHandler(); AjBuildConfig config = genBuildConfig(new String[] { "-outxml", "-showWeaveInfo" }, messageHolder); assertTrue("Warnings: " + messageHolder,!messageHolder.hasAnyMessage(IMessage.WARNING, true)); - assertEquals("Wrong outxml","META-INF/aop.xml",config.getOutxmlName()); + assertEquals("Wrong outxml","META-INF/aop-ajc.xml",config.getOutxmlName()); assertTrue("Following option currupted",config.getShowWeavingInformation()); } diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java index 74dcd34a4..cf93e775d 100644 --- a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java +++ b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java @@ -786,8 +786,8 @@ public class AjcTaskTest extends TestCase { AjcTask task = getTask("showweaveinfo.lst",destDir); task.setOutxml(true); checkRun(task,null); - File outxmlFile = new File(destDir,"META-INF/aop.xml"); - assertTrue("META-INF/aop.xml missing",outxmlFile.exists()); + File outxmlFile = new File(destDir,"META-INF/aop-ajc.xml"); + assertTrue("META-INF/aop-ajc.xml missing",outxmlFile.exists()); } public void testOutxmlFile () { diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index e241d5f55..c76470168 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -1656,7 +1656,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa int aspectCount = 0; File aopXML = new File(getWorkingDir().getAbsolutePath() + File.separatorChar + projectName + File.separatorChar - + "bin" + File.separatorChar + "META-INF" + File.separatorChar + "aop.xml"); + + "bin" + File.separatorChar + "META-INF" + File.separatorChar + "aop-ajc.xml"); if (!aopXML.exists()) { fail("Expected file " + aopXML.getAbsolutePath() + " to exist but it doesn't"); -- 2.39.5