From: mkersten Date: Tue, 8 Nov 2005 02:33:59 +0000 (+0000) Subject: Fixed Bugzilla Bug 113554: support ajsym file generation for command line builds X-Git-Tag: V1_5_0RC1~228 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9fe6c2bc5c7d9950fc3edeadb0d9cfb8c1f28495;p=aspectj.git Fixed Bugzilla Bug 113554: support ajsym file generation for command line builds --- diff --git a/ajde/testsrc/org/aspectj/ajde/AjdeTests.java b/ajde/testsrc/org/aspectj/ajde/AjdeTests.java index 461dfc52f..bf95d0e37 100644 --- a/ajde/testsrc/org/aspectj/ajde/AjdeTests.java +++ b/ajde/testsrc/org/aspectj/ajde/AjdeTests.java @@ -40,7 +40,8 @@ public class AjdeTests extends TestCase { public static Test suite() { TestSuite suite = new TestSuite(AjdeTests.class.getName()); //$JUnit-BEGIN$ - suite.addTestSuite(ShowWeaveMessagesTestCase.class); + suite.addTestSuite(SymbolFileGenerationTest.class); + suite.addTestSuite(ShowWeaveMessagesTestCase.class); suite.addTestSuite(DuplicateManifestTest.class); suite.addTestSuite(BuildOptionsTest.class); suite.addTestSuite(BuildConfigurationTests.class); diff --git a/ajde/testsrc/org/aspectj/ajde/SymbolFileGenerationTest.java b/ajde/testsrc/org/aspectj/ajde/SymbolFileGenerationTest.java new file mode 100644 index 000000000..100ed2f66 --- /dev/null +++ b/ajde/testsrc/org/aspectj/ajde/SymbolFileGenerationTest.java @@ -0,0 +1,65 @@ +/* ******************************************************************* + * Copyright (c) 1999-2001 Xerox Corporation, + * 2002 Palo Alto Research Center, Incorporated (PARC). + * 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: + * Xerox/PARC initial implementation + * ******************************************************************/ + +package org.aspectj.ajde; + +import java.io.File; + +import org.aspectj.tools.ajc.AjcTestCase; + +/** + * @author Mik Kersten + */ +public class SymbolFileGenerationTest extends AjcTestCase { + private static final String DIR = "../ajde/testdata/examples/coverage"; + + protected File dir = new File(DIR); + protected File configFile = new File(DIR + "/coverage.lst"); + protected File esymFile = new File(DIR + "/ModelCoverage.ajesym"); + protected File outDir = new File(DIR + "/bin"); + protected File crossRefsFile = new File(outDir.getAbsolutePath() + "/build.ajsym"); + + protected void setUp() throws Exception { + super.setUp(); + } + + public void testCrossRefsFileGeneration() { + if (crossRefsFile.exists()) assertTrue(crossRefsFile.delete()); + if (esymFile.exists()) assertTrue(esymFile.delete()); + String[] args = new String[] { + "-d", + outDir.getAbsolutePath(), + "-crossrefs", + "@" + configFile.getAbsolutePath() + }; + ajc(dir, args); + + assertFalse(esymFile.exists()); + assertTrue(crossRefsFile.exists()); + } + + public void testEmacssymGeneration() { + if (crossRefsFile.exists()) assertTrue(crossRefsFile.delete()); + if (esymFile.exists()) assertTrue(esymFile.delete()); + String[] args = new String[] { + "-d", + outDir.getAbsolutePath(), + "-emacssym", + "@" + configFile.getAbsolutePath() + }; + ajc(dir, args); + + assertTrue(esymFile.exists()); + assertFalse(crossRefsFile.exists()); + } +} diff --git a/docs/devGuideDB/ajc.xml b/docs/devGuideDB/ajc.xml index ef3438987..04393eaa5 100644 --- a/docs/devGuideDB/ajc.xml +++ b/docs/devGuideDB/ajc.xml @@ -142,6 +142,16 @@ + + -crossrefs + + Generate a build .ajsym file into the output directory. Used for + viewing crosscutting references by tools like the AspectJ + Browser. + + + + -emacssym 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 74135e9b6..9db08913d 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 @@ -117,7 +117,6 @@ public class BuildArgParser extends Main { AjcConfigParser parser = new AjcConfigParser(buildConfig, handler); parser.parseCommandLine(args); - boolean swi = buildConfig.getShowWeavingInformation(); // Now jump through firey hoops to turn them on/off if (handler instanceof CountingMessageHandler) { @@ -519,6 +518,9 @@ public class BuildArgParser extends Main { } else { showError("-XincrementalFile requires file argument"); } + } else if (arg.equals("-crossrefs")) { + buildConfig.setGenerateCrossRefsMode(true); + buildConfig.setGenerateModelMode(true); } else if (arg.equals("-emacssym")) { buildConfig.setEmacsSymMode(true); buildConfig.setGenerateModelMode(true); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties index 9a9029e97..a297978ec 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties @@ -31,6 +31,7 @@ AspectJ-specific options:\n\ \t (reads stdin: enter to recompile and ''q'' to quit)\n\ \t-sourceroots compile all .aj and .java files in \n\ \t ( uses classpath delimiter)\n\ +\t-crossrefs generate .ajsym file into the output directory\n\ \t-emacssym generate .ajesym symbol files for emacs support\n\ \t-Xlint same as ''-Xlint:warning''\n\ \t-Xlint: set default level for crosscutting messages\n\ diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java index 8b5cf2132..505b80844 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java @@ -515,6 +515,14 @@ public class AjBuildConfig { boolean generateJavadocsInModelMode) { options.generateJavaDocsInModel = generateJavadocsInModelMode; } + + public boolean isGenerateCrossRefsMode() { + return options.generateCrossRefs; + } + + public void setGenerateCrossRefsMode(boolean on) { + options.generateCrossRefs = on; + } public boolean isEmacsSymMode() { return options.generateEmacsSymFiles; diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index 9cb561ea2..004ab6534 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -89,6 +89,7 @@ import org.eclipse.core.runtime.OperationCanceledException; //import org.aspectj.org.eclipse.jdt.internal.compiler.util.HashtableOfObject; public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourceProvider,ICompilerAdapterFactory { + private static final String CROSSREFS_FILE_NAME = "build.lst"; private static final String CANT_WRITE_RESULT = "unable to write compilation result"; private static final String MANIFEST_NAME = "META-INF/MANIFEST.MF"; static final boolean COPY_INPATH_DIR_RESOURCES = false; @@ -281,6 +282,15 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc if (buildConfig.isEmacsSymMode()) { new org.aspectj.ajdt.internal.core.builder.EmacsStructureModelManager().externalizeModel(); } + + // for bug 113554: support ajsym file generation for command line builds + if (buildConfig.isGenerateCrossRefsMode()) { + String configFileProxy = buildConfig.getOutputDir().getAbsolutePath() + + File.separator + + CROSSREFS_FILE_NAME; + AsmManager.getDefault().writeStructureModel(configFileProxy); + } + // have to tell state we succeeded or next is not incremental state.successfulCompile(buildConfig,batch); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java index 2e1196b3a..7481b4ffc 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java @@ -79,6 +79,12 @@ public class AjCompilerOptions extends CompilerOptions { public boolean generateEmacsSymFiles = false; public boolean noAtAspectJProcessing = false; + /** + * Generates a map of cross references based on information + * in the structure model. + */ + public boolean generateCrossRefs = false; + public boolean proceedOnError = false;