Browse Source

Fixed Bugzilla Bug 113554: support ajsym file generation for command line builds

tags/V1_5_0RC1
mkersten 18 years ago
parent
commit
9fe6c2bc5c

+ 2
- 1
ajde/testsrc/org/aspectj/ajde/AjdeTests.java View File

@@ -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);

+ 65
- 0
ajde/testsrc/org/aspectj/ajde/SymbolFileGenerationTest.java View File

@@ -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());
}
}

+ 10
- 0
docs/devGuideDB/ajc.xml View File

@@ -142,6 +142,16 @@
</para></listitem>
</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>

+ 3
- 1
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java View File

@@ -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);

+ 1
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/messages.properties View File

@@ -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\

+ 8
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildConfig.java View File

@@ -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;

+ 10
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java View File

@@ -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);


+ 6
- 0
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjCompilerOptions.java View File

@@ -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;


Loading…
Cancel
Save