aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten <mkersten>2005-11-08 02:33:59 +0000
committermkersten <mkersten>2005-11-08 02:33:59 +0000
commit9fe6c2bc5c7d9950fc3edeadb0d9cfb8c1f28495 (patch)
tree06fd48eafb4a02f29dbe35c6d857a45e20cea8a3
parent67ec9ca9ab089690ab376f1ed75006143f26fb84 (diff)
downloadaspectj-9fe6c2bc5c7d9950fc3edeadb0d9cfb8c1f28495.tar.gz
aspectj-9fe6c2bc5c7d9950fc3edeadb0d9cfb8c1f28495.zip
Fixed Bugzilla Bug 113554: support ajsym file generation for command line builds
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AjdeTests.java3
-rw-r--r--ajde/testsrc/org/aspectj/ajde/SymbolFileGenerationTest.java65
-rw-r--r--docs/devGuideDB/ajc.xml10
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties1
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java8
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java10
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java6
8 files changed, 105 insertions, 2 deletions
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
@@ -143,6 +143,16 @@
</varlistentry>
<varlistentry>
+ <term>-crossrefs</term>
+ <listitem><para>
+ Generate a build .ajsym file into the output directory. Used for
+ viewing crosscutting references by tools like the AspectJ
+ Browser.
+ </para></listitem>
+ </varlistentry>
+
+
+ <varlistentry>
<term>-emacssym</term>
<listitem><para>
Generate .ajesym symbol files for emacs support
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 <dirs> compile all .aj and .java files in <dirs>\n\
\t (<dirs> 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:<level> 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;