summaryrefslogtreecommitdiffstats
path: root/ajde/src
diff options
context:
space:
mode:
authormkersten <mkersten>2003-01-25 01:25:30 +0000
committermkersten <mkersten>2003-01-25 01:25:30 +0000
commit85a827a7f269a18a0c80802811bbc2aa3766c2e4 (patch)
tree75acaa45c529c458122ee2a1e601474b925fc87d /ajde/src
parente5660e9d2e962392ad1b3bcd1fc5cbe4725cf8ae (diff)
downloadaspectj-85a827a7f269a18a0c80802811bbc2aa3766c2e4.tar.gz
aspectj-85a827a7f269a18a0c80802811bbc2aa3766c2e4.zip
Committed patches specified in:
http://bugs.eclipse.org/bugs/show_bug.cgi?id=29769
Diffstat (limited to 'ajde/src')
-rw-r--r--ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java85
-rw-r--r--ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java38
-rw-r--r--ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java44
-rw-r--r--ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java263
-rw-r--r--ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java167
5 files changed, 571 insertions, 26 deletions
diff --git a/ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java b/ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java
index edf4c0972..7e89a55fa 100644
--- a/ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java
+++ b/ajde/src/org/aspectj/ajde/BuildOptionsAdapter.java
@@ -8,61 +8,100 @@
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
- * Xerox/PARC initial implementation
+ * Xerox/PARC initial implementation
+ * AMC 01.20.2003 extended for AspectJ 1.1 compiler options
* ******************************************************************/
package org.aspectj.ajde;
+import java.util.Set;
+
/**
* When a particular option is not set its documented default is used.
*/
public interface BuildOptionsAdapter {
+ // Version constants
+ public static final String VERSION_13 = "1.3";
+ public static final String VERSION_14 = "1.4";
+
+ // Warning constants
+ public static final String WARN_CONSTRUCTOR_NAME = "constructorName";
+ public static final String WARN_PACKAGE_DEFAULT_METHOD = "packageDefaultMethod";
+ public static final String WARN_DEPRECATION = "deprecation";
+ public static final String WARN_MASKED_CATCH_BLOCKS = "maskedCatchBlocks";
+ public static final String WARN_UNUSED_LOCALS = "unusedLocals";
+ public static final String WARN_UNUSED_ARGUMENTS = "unusedArguments";
+ public static final String WARN_UNUSED_IMPORTS = "unusedImports";
+ public static final String WARN_SYNTHETIC_ACCESS = "syntheticAccess";
+ public static final String WARN_ASSERT_IDENITIFIER = "assertIdentifier";
+ public static final String WARN_NLS = "nonExternalisedString";
+
+ // Debug constants
+ public static final String DEBUG_SOURCE = "source";
+ public static final String DEBUG_LINES = "lines";
+ public static final String DEBUG_VARS = "vars";
+ public static final String DEBUG_ALL = "all";
+
/**
* Use javac to generate .class files. The default is "false".
+ * From -usejavac
+ * @deprecated Not supported from AspectJ 1.1 onwards
*/
public boolean getUseJavacMode();
/**
* Only relevant with Use Javac or Preprocess modes. Specify where to place
* intermediate .java files. The default is "workingdir".
+ * From -workingdir
+ * @deprecated Not supported from AspectJ 1.1 onwards
*/
public String getWorkingOutputPath();
/**
* Generate regular Java code into the Working OutputPath. Don't try to generate
* any .class files. The default is "false".
+ * From -source
+ * @deprecated Not supported from AspectJ 1.1 onwards
*/
public boolean getPreprocessMode();
/**
* Specify character encoding used by source files. The default is the current
* JVM's default.
+ * From -encoding
*/
public String getCharacterEncoding();
/**
* Support assertions as defined in JLS-1.4. The default is "false".
+ * @deprecated Use getComplianceLevel instead
*/
public boolean getSourceOnePointFourMode();
/**
* Be extra-lenient in interpreting the Java specification. The default is "false",
* i.e. "regular" mode.
+ * From -lenient
+ * @deprecated Not supported from AspectJ 1.1 onwards
*/
public boolean getLenientSpecMode();
/**
* Be extra-strict in interpreting the Java specification. The default is "false",
* i.e. "regular" mode.
+ * From -strict
+ * @deprecated Not supported from AspectJ 1.1 onwards
*/
public boolean getStrictSpecMode();
/**
* Make the use of some features from pre-1.0 versions of AspectJ be warnings to ease
* porting of old code. The default is "false".
+ * From -porting
+ * @deprecated Not supported from AspectJ 1.1 onwards
*/
public boolean getPortingMode();
@@ -71,4 +110,48 @@ public interface BuildOptionsAdapter {
* The default is no non-standard options.
*/
public String getNonStandardOptions();
+
+ // ----------------------------------
+ // New options added for AspectJ 1.1 from this point onwards
+
+ /**
+ * JDK Compliance level to be used by the compiler, either
+ * VERSION_13 or VERSION_14.
+ * From -1.3 / -1.4
+ */
+ public String getComplianceLevel();
+
+ /**
+ * Source compatibility level, either VERSION_13 or VERSION_14.
+ * From -source (eclipse option)
+ */
+ public String getSourceCompatibilityLevel();
+
+ /**
+ * Optional warnings, empty List is equivalent to -warn:none,
+ * returning null uses eclipse compiler default settings
+ * From -warn:xxx,yyy
+ */
+ public Set getWarnings();
+
+ /**
+ * Debug level. DEBUG_ALL == {SOURCE, LINES, VARS}.
+ * Empty list is equivalent to -g:none, returning
+ * non uses eclipse compiler default settings
+ * From -g:xxx
+ */
+ public Set getDebugLevel();
+
+ /**
+ * No errors generated for unresolved imports
+ * From -noImportError
+ */
+ public boolean getNoImportError();
+
+ /**
+ * Preserve all unused local variables (for debug)
+ * From -preserveAllLocals
+ */
+ public boolean getPreserveAllLocals();
+
}
diff --git a/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java b/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java
index e24307320..472a8425d 100644
--- a/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java
+++ b/ajde/src/org/aspectj/ajde/ProjectPropertiesAdapter.java
@@ -8,13 +8,15 @@
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
- * Xerox/PARC initial implementation
+ * Xerox/PARC initial implementation
+ * AMC 01.20.2003 extended for AspectJ 1.1 compiler options
* ******************************************************************/
package org.aspectj.ajde;
+import java.util.Set;
import java.util.List;
/**
@@ -55,4 +57,38 @@ public interface ProjectPropertiesAdapter {
public String getExecutionArgs();
public String getVmArgs();
+
+ // following methods added for AspectJ 1.1
+ //-----------------------------------------
+
+ /**
+ * Get the set of input jar files for this compilation.
+ * Set members should be of type java.io.File.
+ * An empty set or null is acceptable for this option.
+ * From -injars.
+ */
+ public Set getInJars();
+
+ /**
+ * Get the output jar file for the compilation results.
+ * Return null to leave classfiles unjar'd in output directory
+ * From -outjar
+ */
+ public String getOutJar();
+
+ /**
+ * Get a set of root source directories for the compilation.
+ * Set members should be of type java.io.File
+ * Returning null or an empty set disables the option.
+ * From -sourceroots
+ */
+ public Set getSourceRoots();
+
+ /**
+ * Get the set of aspect jar files to be used for the compilation.
+ * Returning null or an empty set disables this option. Set members
+ * should be of type java.io.File.
+ * From -aspectpath
+ */
+ public Set getAspectPath();
}
diff --git a/ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java b/ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java
index a52117e38..1c3e201d8 100644
--- a/ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java
+++ b/ajde/src/org/aspectj/ajde/internal/AspectJBuildManager.java
@@ -238,19 +238,49 @@ public class AspectJBuildManager implements BuildManager {
notifyCompileFinished(configFile, lastCompileTime, succeeded, warnings);
}
+ // AMC - updated for AspectJ 1.1 options
private String getFormattedOptionsString(BuildOptionsAdapter buildOptions, ProjectPropertiesAdapter properties) {
return "Building with settings: "
+ "\n-> output path: " + properties.getOutputPath()
+ "\n-> classpath: " + properties.getClasspath()
+ "\n-> bootclasspath: " + properties.getBootClasspath()
+ + "\n-> -injars " + formatSet(properties.getInJars())
+ + "\n-> -outjar " + formatOptionalString(properties.getOutJar())
+ + "\n-> -sourceroots " + formatSet(properties.getSourceRoots())
+ + "\n-> -aspectpath " + formatSet(properties.getAspectPath())
+ + "\n-> -" + buildOptions.getComplianceLevel()
+ + "\n-> -source " + buildOptions.getSourceCompatibilityLevel()
+ + "\n-> -g:" + formatSet(buildOptions.getDebugLevel())
+ + "\n-> -warn:" + formatSet(buildOptions.getWarnings())
+ + "\n-> noImportError: " + buildOptions.getNoImportError()
+ + "\n-> preserveAllLocals:" + buildOptions.getPreserveAllLocals()
+ "\n-> non-standard options: " + buildOptions.getNonStandardOptions()
- + "\n-> porting mode: " + buildOptions.getPortingMode()
- + "\n-> source 1.4 mode: " + buildOptions.getSourceOnePointFourMode()
- + "\n-> strict spec mode: " + buildOptions.getStrictSpecMode()
- + "\n-> lenient spec mode: " + buildOptions.getLenientSpecMode()
- + "\n-> use javac mode: " + buildOptions.getUseJavacMode()
- + "\n-> preprocess mode: " + buildOptions.getPreprocessMode()
- + "\n-> working dir: " + buildOptions.getWorkingOutputPath();
+ + "\n-> [ignored-deprecated in AspectJ1.1] porting mode: " + buildOptions.getPortingMode()
+ + "\n-> [ignored-deprecated in AspectJ1.1] source 1.4 mode: " + buildOptions.getSourceOnePointFourMode()
+ + "\n-> [ignored-deprecated in AspectJ1.1] strict spec mode: " + buildOptions.getStrictSpecMode()
+ + "\n-> [ignored-deprecated in AspectJ1.1] lenient spec mode: " + buildOptions.getLenientSpecMode()
+ + "\n-> [ignored-deprecated in AspectJ1.1] use javac mode: " + buildOptions.getUseJavacMode()
+ + "\n-> [ignored-deprecated in AspectJ1.1] preprocess mode: " + buildOptions.getPreprocessMode()
+ + "\n-> [ignored-deprecated in AspectJ1.1] working dir: " + buildOptions.getWorkingOutputPath();
+ }
+
+ private String formatSet( Set options ) {
+ if ( options == null ) return "<default>";
+ if ( options.isEmpty() ) return "none";
+
+ StringBuffer formattedOptions = new StringBuffer();
+ Iterator it = options.iterator();
+ while (it.hasNext()) {
+ String o = it.next().toString();
+ if (formattedOptions.length() > 0) formattedOptions.append(", ");
+ formattedOptions.append( o );
+ }
+ return formattedOptions.toString();
+ }
+
+ private String formatOptionalString( String s ) {
+ if ( s == null ) { return "" ; }
+ else { return s; }
}
}
diff --git a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
index 19ede47fd..9279456a7 100644
--- a/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
+++ b/ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
@@ -7,7 +7,9 @@
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
- * Xerox/PARC initial implementation
+ * Xerox/PARC initial implementation
+ * AMC 01.20.2003 extended to support new AspectJ 1.1 options,
+ * bugzilla #29769
* ******************************************************************/
@@ -17,10 +19,12 @@ import java.io.File;
import java.util.*;
import org.aspectj.ajde.*;
+import org.aspectj.ajdt.ajc.BuildArgParser;
import org.aspectj.ajdt.internal.core.builder.AjBuildConfig;
import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
import org.aspectj.bridge.*;
import org.aspectj.util.ConfigParser;
+import org.aspectj.util.LangUtil;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -99,36 +103,263 @@ public class CompilerAdapter {
buildConfig.setConfigFile(config);
}
+ // AMC refactored into two methods to populate buildConfig from buildOptions and
+ // project properties - bugzilla 29769.
+ configureBuildOptions(buildConfig, Ajde.getDefault().getBuildManager().getBuildOptions());
+ configureProjectOptions(buildConfig, Ajde.getDefault().getProjectProperties());
+
+ buildConfig.setGenerateModelMode(true);
+ return buildConfig;
+ }
+
+ /**
+ * Populate options in a build configuration, using the Ajde BuildOptionsAdapter.
+ * Added by AMC 01.20.2003, bugzilla #29769
+ */
+ private void configureBuildOptions( AjBuildConfig config, BuildOptionsAdapter options ) {
+
+ Map javaOptions = config.getJavaOptions();
+
+ if (options.getSourceOnePointFourMode()) {
+ javaOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
+ javaOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
+ }
+
+ String enc = options.getCharacterEncoding();
+ if ( enc != null & (enc.length() > 0)) {
+ javaOptions.put(CompilerOptions.OPTION_Encoding, enc );
+ }
+
+ String compliance = options.getComplianceLevel();
+ if ( compliance != null && (compliance.length() > 0) ) {
+ String version = CompilerOptions.VERSION_1_4;
+ if ( compliance.equals( BuildOptionsAdapter.VERSION_13 ) ) {
+ version = CompilerOptions.VERSION_1_3;
+ }
+ javaOptions.put(CompilerOptions.OPTION_Compliance, version );
+ javaOptions.put(CompilerOptions.OPTION_Source, version );
+ }
+
+ String sourceLevel = options.getSourceCompatibilityLevel();
+ if ( null != sourceLevel && ( sourceLevel.length() > 0 )) {
+ String slVersion = CompilerOptions.VERSION_1_4;
+ if ( sourceLevel.equals( BuildOptionsAdapter.VERSION_13 ) ) {
+ slVersion = CompilerOptions.VERSION_1_3;
+ }
+ // never set a lower source level than compliance level
+ String setCompliance = (String) javaOptions.get( CompilerOptions.OPTION_Compliance);
+ if ( ! (setCompliance.equals( CompilerOptions.VERSION_1_4 )
+ && slVersion.equals(CompilerOptions.VERSION_1_3)) ) {
+ javaOptions.put(CompilerOptions.OPTION_Source, slVersion);
+ }
+ }
+
+ Set warnings = options.getWarnings();
+ if ( warnings != null ) {
+ // turn off all warnings
+ disableWarnings( javaOptions );
+ // then selectively enable those in the set
+ enableWarnings( javaOptions, warnings );
+ }
+
+ Set debugOptions = options.getDebugLevel();
+ if ( debugOptions != null ) {
+ // default is all options off, so just need to selectively
+ // enable
+ Iterator it = debugOptions.iterator();
+ while (it.hasNext()){
+ String debug = (String) it.next();
+ if ( debug.equals( BuildOptionsAdapter.DEBUG_ALL )) {
+ javaOptions.put( CompilerOptions.OPTION_LineNumberAttribute,
+ CompilerOptions.GENERATE);
+ javaOptions.put( CompilerOptions.OPTION_SourceFileAttribute,
+ CompilerOptions.GENERATE);
+ javaOptions.put( CompilerOptions.OPTION_LocalVariableAttribute,
+ CompilerOptions.GENERATE);
+ } else if ( debug.equals( BuildOptionsAdapter.DEBUG_LINES )) {
+ javaOptions.put( CompilerOptions.OPTION_LineNumberAttribute,
+ CompilerOptions.GENERATE);
+ } else if ( debug.equals( BuildOptionsAdapter.DEBUG_SOURCE )) {
+ javaOptions.put( CompilerOptions.OPTION_SourceFileAttribute,
+ CompilerOptions.GENERATE);
+ } else if ( debug.equals( BuildOptionsAdapter.DEBUG_VARS)) {
+ javaOptions.put( CompilerOptions.OPTION_LocalVariableAttribute,
+ CompilerOptions.GENERATE);
+ }
+ }
+ }
+
+ if ( options.getNoImportError() ) {
+ javaOptions.put( CompilerOptions.OPTION_ReportInvalidImport,
+ CompilerOptions.WARNING);
+ }
+
+ if ( options.getPreserveAllLocals() ) {
+ javaOptions.put( CompilerOptions.OPTION_PreserveUnusedLocal,
+ CompilerOptions.PRESERVE);
+ }
+
+ config.setJavaOptions( javaOptions );
+
+ configureNonStandardOptions( config, options );
+ }
+
+ /**
+ * Helper method for configureBuildOptions
+ */
+ private void disableWarnings( Map options ) {
+ options.put(
+ CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportMethodWithConstructorName,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportDeprecation,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportHiddenCatchBlock,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportUnusedLocal,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportUnusedParameter,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportSyntheticAccessEmulation,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportNonExternalizedStringLiteral,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportAssertIdentifier,
+ CompilerOptions.IGNORE);
+ options.put(
+ CompilerOptions.OPTION_ReportUnusedImport,
+ CompilerOptions.IGNORE);
+ }
+
+ /**
+ * Helper method for configureBuildOptions
+ */
+ private void enableWarnings( Map options, Set warnings ) {
+ Iterator it = warnings.iterator();
+ while (it.hasNext() ) {
+ String thisWarning = (String) it.next();
+ if ( thisWarning.equals( BuildOptionsAdapter.WARN_ASSERT_IDENITIFIER )) {
+ options.put( CompilerOptions.OPTION_ReportAssertIdentifier,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_CONSTRUCTOR_NAME )) {
+ options.put( CompilerOptions.OPTION_ReportMethodWithConstructorName,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_DEPRECATION )) {
+ options.put( CompilerOptions.OPTION_ReportDeprecation,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_MASKED_CATCH_BLOCKS )) {
+ options.put( CompilerOptions.OPTION_ReportHiddenCatchBlock,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_PACKAGE_DEFAULT_METHOD )) {
+ options.put( CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_SYNTHETIC_ACCESS )) {
+ options.put( CompilerOptions.OPTION_ReportSyntheticAccessEmulation,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_UNUSED_ARGUMENTS )) {
+ options.put( CompilerOptions.OPTION_ReportUnusedParameter,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_UNUSED_IMPORTS )) {
+ options.put( CompilerOptions.OPTION_ReportUnusedImport,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_UNUSED_LOCALS )) {
+ options.put( CompilerOptions.OPTION_ReportUnusedLocal,
+ CompilerOptions.WARNING );
+ } else if ( thisWarning.equals( BuildOptionsAdapter.WARN_NLS )) {
+ options.put( CompilerOptions.OPTION_ReportNonExternalizedStringLiteral,
+ CompilerOptions.WARNING );
+ }
+ }
+ }
+
+
+ /**
+ * Helper method for configure build options
+ */
+ private void configureNonStandardOptions( AjBuildConfig config, BuildOptionsAdapter options ) {
+ String nonStdOptions = options.getNonStandardOptions();
+ if ( null == nonStdOptions || (nonStdOptions.length() == 0)) return;
+
+ StringTokenizer tok = new StringTokenizer( nonStdOptions );
+ String[] args = new String[ tok.countTokens() ];
+ int argCount = 0;
+ while ( tok.hasMoreTokens() ) {
+ args[argCount++] = tok.nextToken();
+ }
+
+ // set the non-standard options in an alternate build config
+ // (we don't want to lose the settings we already have)
+ BuildArgParser argParser = new BuildArgParser();
+ AjBuildConfig altConfig = argParser.genBuildConfig( args, messageHandler );
+
+ // copy the answers across
+ config.setNoWeave( altConfig.isNoWeave() );
+ config.setXnoInline( altConfig.isXnoInline() );
+ config.setXserializableAspects( altConfig.isXserializableAspects());
+ config.setLintMode( altConfig.getLintMode() );
+ config.setLintSpecFile( altConfig.getLintSpecFile() );
+ }
+ /**
+ * Populate options in a build configuration, using the ProjectPropertiesAdapter.
+ * Added by AMC 01.20.2003, bugzilla #29769
+ */
+ private void configureProjectOptions( AjBuildConfig config, ProjectPropertiesAdapter properties ) {
+
+ // set the classpath
String classpathString =
- Ajde.getDefault().getProjectProperties().getBootClasspath()
+ properties.getBootClasspath()
+ File.pathSeparator
- + Ajde.getDefault().getProjectProperties().getClasspath();
+ + properties.getClasspath();
StringTokenizer st = new StringTokenizer(
classpathString,
File.pathSeparator
);
+
List classpath = new ArrayList();
while (st.hasMoreTokens()) classpath.add(st.nextToken());
- buildConfig.setClasspath(classpath);
+ config.setClasspath(classpath);
Ajde.getDefault().logEvent("building with classpath: " + classpath);
- if (Ajde.getDefault().getBuildManager().getBuildOptions().getSourceOnePointFourMode()) {
- buildConfig.getJavaOptions().put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
- }
+ config.setOutputDir(
+ new File(properties.getOutputPath())
+ );
- // XXX problematic restriction, support multiple source roots
- List sourceRoots = new ArrayList();
- sourceRoots.add(new File(configFile).getParentFile());
- buildConfig.setSourceRoots(sourceRoots);
+ // new 1.1 options added by AMC
- buildConfig.setOutputDir(
- new File(Ajde.getDefault().getProjectProperties().getOutputPath())
- );
+ Set roots = properties.getSourceRoots();
+ if ( null != roots && !roots.isEmpty() ) {
+ List sourceRoots = new ArrayList( roots );
+ config.setSourceRoots(sourceRoots);
+ }
- buildConfig.setGenerateModelMode(true);
+ Set jars = properties.getInJars();
+ if ( null != jars && !jars.isEmpty() ) {
+ List inJars = new ArrayList( jars );
+ config.setInJars(inJars);
+ }
- return buildConfig;
+ String outJar = properties.getOutJar();
+ if ( null != outJar && (outJar.length() > 0) ) {
+ config.setOutputJar( new File( outJar ) );
+ }
+
+ Set aspects = properties.getAspectPath();
+ if ( null != aspects && !aspects.isEmpty() ) {
+ List aPath = new ArrayList( aspects );
+ config.setAspectpath( aPath);
+ }
+
+
}
private void init() {
diff --git a/ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java b/ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java
index 3093d09a0..da53c5c09 100644
--- a/ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java
+++ b/ajde/src/org/aspectj/ajde/ui/internal/AjcBuildOptions.java
@@ -9,12 +9,19 @@
*
* Contributors:
* Xerox/PARC initial implementation
+ * AMC 01.20.2003 extended to support AspectJ 1.1 options,
+ * bugzilla #29769
* ******************************************************************/
package org.aspectj.ajde.ui.internal;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.StringTokenizer;
+
import org.aspectj.ajde.*;
import org.aspectj.ajde.ui.*;
@@ -33,31 +40,46 @@ public class AjcBuildOptions implements BuildOptionsAdapter {
private static final String PORTING_MODE = AJC + ".portingMode";
private static final String VERBOSE_MODE = AJC + ".verboseMode";
private static final String NONSTANDARD_OPTIONS = AJC + ".nonStandardOptions";
+ // 1.1 constants added by AMC
+ private static final String COMPLIANCE_LEVEL = AJC + ".complianceLevel";
+ private static final String SOURCE_LEVEL = AJC + ".sourceLevel";
+ private static final String WARNINGS = AJC + ".warnings";
+ private static final String DEBUG_OPTIONS = AJC + ".debugOptions";
+ private static final String NO_IMPORT_ERROR = AJC + ".noImportError";
+ private static final String PRESERVE_LOCALS = AJC + ".preserveLocals";
+ private static final String DEFAULT = "default";
+
public AjcBuildOptions(UserPreferencesAdapter userPreferencesAdapter) {
this.preferencesAdapter = userPreferencesAdapter;
}
-
+
+ /** @deprecated */
public boolean getUseJavacMode() {
return getBooleanOptionVal(USE_JAVAC_MODE);
}
+ /** @deprecated */
public void setUseJavacMode(boolean value) {
setBooleanOptionVal(USE_JAVAC_MODE, value);
}
+ /** @deprecated */
public String getWorkingOutputPath() {
return preferencesAdapter.getProjectPreference(WORKING_DIR);
}
+ /** @deprecated */
public void setWorkingDir(String path) {
preferencesAdapter.setProjectPreference(WORKING_DIR, path);
}
+ /** @deprecated */
public boolean getPreprocessMode() {
return getBooleanOptionVal(PREPROCESS_MODE);
}
+ /** @deprecated */
public void setPreprocessMode(boolean value) {
setBooleanOptionVal(PREPROCESS_MODE, value);
}
@@ -70,34 +92,42 @@ public class AjcBuildOptions implements BuildOptionsAdapter {
preferencesAdapter.setProjectPreference(CHARACTER_ENCODING, value);
}
+ /** @deprecated */
public boolean getSourceOnePointFourMode() {
return getBooleanOptionVal(SOURCE_ONE_POINT_FOUR_MODE);
}
+ /** @deprecated */
public void setSourceOnePointFourMode(boolean value) {
setBooleanOptionVal(SOURCE_ONE_POINT_FOUR_MODE, value);
}
+ /** @deprecated */
public boolean getLenientSpecMode() {
return getBooleanOptionVal(LENIENT_MODE);
}
+ /** @deprecated */
public void setLenientSpecMode(boolean value) {
setBooleanOptionVal(LENIENT_MODE, value);
}
+ /** @deprecated */
public boolean getStrictSpecMode() {
return getBooleanOptionVal(STRICT_MODE);
}
+ /** @deprecated */
public void setStrictSpecMode(boolean value) {
setBooleanOptionVal(STRICT_MODE, value);
}
+ /** @deprecated */
public boolean getPortingMode() {
return getBooleanOptionVal(PORTING_MODE);
}
+ /** @deprecated */
public void setPortingMode(boolean value) {
setBooleanOptionVal(PORTING_MODE, value);
}
@@ -117,6 +147,89 @@ public class AjcBuildOptions implements BuildOptionsAdapter {
public void setNonStandardOptions(String value) {
preferencesAdapter.setProjectPreference(NONSTANDARD_OPTIONS, value);
}
+
+ // -------------
+ // new 1.1 compiler options start here...
+
+ /**
+ * JDK Compliance level to be used by the compiler, either
+ * VERSION_13 or VERSION_14.
+ * From -1.3 / -1.4
+ */
+ public String getComplianceLevel() {
+ return preferencesAdapter.getProjectPreference(COMPLIANCE_LEVEL);
+ }
+
+ public void setComplianceLevel( String value ) {
+ preferencesAdapter.setProjectPreference(COMPLIANCE_LEVEL,value);
+ }
+
+ /**
+ * Source compatibility level, either VERSION_13 or VERSION_14.
+ * From -source (eclipse option)
+ */
+ public String getSourceCompatibilityLevel() {
+ return preferencesAdapter.getProjectPreference(SOURCE_LEVEL);
+ }
+
+ public void setSourceCompatibilityLevel(String value) {
+ preferencesAdapter.setProjectPreference(SOURCE_LEVEL, value);
+ }
+
+ /**
+ * Optional warnings, empty List is equivalent to -warn:none,
+ * returning null uses eclipse compiler default settings
+ * From -warn:xxx,yyy
+ */
+ public Set getWarnings() {
+ String warnings = preferencesAdapter.getProjectPreference(WARNINGS);
+ return toWarningSet( warnings );
+ }
+
+ public void setWarnings( Set warningSet ) {
+ String warnings = fromWarningSet( warningSet );
+ preferencesAdapter.setProjectPreference(WARNINGS, warnings);
+ }
+
+ /**
+ * Debug level. DEBUG_ALL == {SOURCE, LINES, VARS}.
+ * Empty list is equivalent to -g:none, returning
+ * non uses eclipse compiler default settings
+ * From -g:xxx
+ */
+ public Set getDebugLevel() {
+ String debug = preferencesAdapter.getProjectPreference(DEBUG_OPTIONS);
+ return toDebugSet( debug );
+ }
+
+ public void setDebugLevel( Set debugSet ) {
+ String debug = fromDebugSet( debugSet );
+ preferencesAdapter.setProjectPreference(DEBUG_OPTIONS, debug);
+ }
+
+ /**
+ * No errors generated for unresolved imports
+ * From -noImportError
+ */
+ public boolean getNoImportError() {
+ return getBooleanOptionVal(NO_IMPORT_ERROR);
+ }
+
+ public void setNoImportError(boolean value) {
+ setBooleanOptionVal(NO_IMPORT_ERROR, value);
+ }
+
+ /**
+ * Preserve all unused local variables (for debug)
+ * From -preserveAllLocals
+ */
+ public boolean getPreserveAllLocals() {
+ return getBooleanOptionVal(PRESERVE_LOCALS);
+ }
+
+ public void setPreserveAllLocals(boolean value) {
+ setBooleanOptionVal(PRESERVE_LOCALS, value);
+ }
private boolean getBooleanOptionVal(String name) {
if (preferencesAdapter.getProjectPreference(name) != null) {
@@ -133,4 +246,56 @@ public class AjcBuildOptions implements BuildOptionsAdapter {
preferencesAdapter.setProjectPreference(name, "false");
}
}
+
+ private Set toWarningSet( String warnings ) {
+ if ( null == warnings ) return null;
+ if ( warnings.equals(DEFAULT) ) return null;
+
+ Set warningSet = new HashSet();
+ StringTokenizer tok = new StringTokenizer( warnings, "," );
+ while ( tok.hasMoreTokens() ) {
+ String warning = tok.nextToken();
+ warningSet.add( warning );
+ }
+ return warningSet;
+ }
+
+ private String fromWarningSet( Set warningSet ) {
+ if ( warningSet == null ) return DEFAULT;
+
+ StringBuffer warnings = new StringBuffer();
+ Iterator it = warningSet.iterator();
+ while ( it.hasNext() ) {
+ String w = (String) it.next();
+ if (warnings.length() > 0 ) warnings.append(',');
+ warnings.append( w );
+ }
+ return warnings.toString();
+ }
+
+ private Set toDebugSet( String debugOptions ) {
+ if ( null == debugOptions ) return null;
+ if ( debugOptions.equals(DEFAULT) ) return null;
+
+ Set debugSet = new HashSet();
+ StringTokenizer tok = new StringTokenizer( debugOptions, "," );
+ while ( tok.hasMoreTokens() ) {
+ String debug = tok.nextToken();
+ debugSet.add( debug );
+ }
+ return debugSet; }
+
+ private String fromDebugSet( Set debugSet ) {
+ if ( debugSet == null ) return DEFAULT;
+
+ StringBuffer debugOptions = new StringBuffer();
+ Iterator it = debugSet.iterator();
+ while ( it.hasNext() ) {
+ String d = (String) it.next();
+ if (debugOptions.length() > 0 ) debugOptions.append(',');
+ debugOptions.append( d );
+ }
+ return debugOptions.toString();
+ }
+
}