123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- /* *******************************************************************
- * Copyright (c) 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:
- * PARC initial implementation
- * Adrian Colyer added constructor to populate javaOptions with
- * default settings - 01.20.2003
- * Bugzilla #29768, 29769
- * ******************************************************************/
-
-
- package org.aspectj.ajdt.internal.core.builder;
-
- import java.io.File;
- import java.util.*;
-
- import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-
- /**
- * All configuration information needed to run the AspectJ compiler.
- */
- public class AjBuildConfig {
-
- public static final String AJLINT_IGNORE = "ignore";
- public static final String AJLINT_WARN = "warn";
- public static final String AJLINT_ERROR = "error";
- public static final String AJLINT_DEFAULT = "default";
-
- private File outputDir;
- private File outputJar;
- private List/*File*/ sourceRoots = new ArrayList();
- private List/*File*/ files = new ArrayList();
- private List/*File*/ inJars = new ArrayList();
- private List/*File*/ aspectpath = new ArrayList();
- private List/*String*/ classpath = new ArrayList();
- private Map javaOptions = new HashMap();
- private Map ajOptions = new HashMap();
- private File configFile;
- private boolean generateModelMode = false;
- private boolean emacsSymMode = false;
- private boolean noWeave = false;
- private boolean XserializableAspects = false;
- private boolean XnoInline = false;
- private String lintMode = AJLINT_DEFAULT;
- private File lintSpecFile = null;
-
- // incremental variants handled by the compiler client, but parsed here
- private boolean incrementalMode;
- private File incrementalFile;
-
- /**
- * Intialises the javaOptions Map to hold the default
- * JDT Compiler settings. Added by AMC 01.20.2003 in reponse
- * to bug #29768 and enh. 29769.
- * The settings here are duplicated from those set in
- * org.eclipse.jdt.internal.compiler.batch.Main, but I've elected to
- * copy them rather than refactor the JDT class since this keeps
- * integration with future JDT releases easier (?).
- */
- public AjBuildConfig( ) {
- javaOptions.put(
- CompilerOptions.OPTION_LocalVariableAttribute,
- CompilerOptions.DO_NOT_GENERATE);
- javaOptions.put(
- CompilerOptions.OPTION_LineNumberAttribute,
- CompilerOptions.DO_NOT_GENERATE);
- javaOptions.put(
- CompilerOptions.OPTION_SourceFileAttribute,
- CompilerOptions.DO_NOT_GENERATE);
- javaOptions.put(
- CompilerOptions.OPTION_PreserveUnusedLocal,
- CompilerOptions.OPTIMIZE_OUT);
- javaOptions.put(
- CompilerOptions.OPTION_ReportUnreachableCode,
- CompilerOptions.ERROR);
- javaOptions.put(
- CompilerOptions.OPTION_ReportInvalidImport,
- CompilerOptions.ERROR);
- javaOptions.put(
- CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod,
- CompilerOptions.WARNING);
- javaOptions.put(
- CompilerOptions.OPTION_ReportMethodWithConstructorName,
- CompilerOptions.WARNING);
- javaOptions.put(
- CompilerOptions.OPTION_ReportDeprecation,
- CompilerOptions.WARNING);
- javaOptions.put(
- CompilerOptions.OPTION_ReportHiddenCatchBlock,
- CompilerOptions.WARNING);
- javaOptions.put(
- CompilerOptions.OPTION_ReportUnusedLocal,
- CompilerOptions.IGNORE);
- javaOptions.put(
- CompilerOptions.OPTION_ReportUnusedParameter,
- CompilerOptions.IGNORE);
- javaOptions.put(
- CompilerOptions.OPTION_ReportSyntheticAccessEmulation,
- CompilerOptions.IGNORE);
- javaOptions.put(
- CompilerOptions.OPTION_ReportNonExternalizedStringLiteral,
- CompilerOptions.IGNORE);
- javaOptions.put(
- CompilerOptions.OPTION_ReportAssertIdentifier,
- CompilerOptions.IGNORE);
- javaOptions.put(
- CompilerOptions.OPTION_Compliance,
- CompilerOptions.VERSION_1_3);
- javaOptions.put(
- CompilerOptions.OPTION_Source,
- CompilerOptions.VERSION_1_3);
- javaOptions.put(
- CompilerOptions.OPTION_TargetPlatform,
- CompilerOptions.VERSION_1_1);
- }
-
- /**
- * returned files includes <ul>
- * <li>files explicitly listed on command-line</li>
- * <li>files listed by reference in argument list files</li>
- * <li>files contained in sourceRootDir if that exists</li>
- * </ul>
- *
- * @return all source files that should be compiled.
- */
- public List/*File*/ getFiles() {
- return files;
- }
-
- public File getOutputDir() {
- return outputDir;
- }
-
- public void setFiles(List files) {
- this.files = files;
- }
-
- public void setOutputDir(File outputDir) {
- this.outputDir = outputDir;
- }
-
- public Map getAjOptions() {
- return ajOptions;
- }
-
- /**
- * @return the Map expected by org.eclipse.jdt.core.internal.Compiler.
- */
- public Map getJavaOptions() {
- return javaOptions;
- }
-
- public void setAjOptions(Map ajOptions) {
- this.ajOptions = ajOptions;
- }
-
- public void setJavaOptions(Map javaOptions) {
- this.javaOptions = javaOptions;
- }
-
- /**
- * This includes all entries from -bootclasspath, -extdirs, -classpath,
- */
- public List getClasspath() { // XXX setters don't respect javadoc contract...
- return classpath;
- }
-
- public void setClasspath(List classpath) {
- this.classpath = classpath;
- }
-
- public File getOutputJar() {
- return outputJar;
- }
-
- public List/*File*/ getInJars() {
- return inJars;
- }
-
- public void setOutputJar(File outputJar) {
- this.outputJar = outputJar;
- }
-
- public void setInJars(List sourceJars) {
- this.inJars = sourceJars;
- }
-
- public List getSourceRoots() {
- return sourceRoots;
- }
-
- public void setSourceRoots(List sourceRootDir) {
- this.sourceRoots = sourceRootDir;
- }
-
- public File getConfigFile() {
- return configFile;
- }
-
- public void setConfigFile(File configFile) {
- this.configFile = configFile;
- }
-
- public boolean isEmacsSymMode() {
- return emacsSymMode;
- }
-
- public void setEmacsSymMode(boolean emacsSymMode) {
- this.emacsSymMode = emacsSymMode;
- }
-
- public boolean isGenerateModelMode() {
- return generateModelMode;
- }
-
- public void setGenerateModelMode(boolean structureModelMode) {
- this.generateModelMode = structureModelMode;
- }
-
- public void setIncrementalMode(boolean incrementalMode) {
- this.incrementalMode = incrementalMode;
- }
-
- public boolean isIncrementalMode() {
- return incrementalMode;
- }
-
- public void setIncrementalFile(File incrementalFile) {
- this.incrementalFile = incrementalFile;
- }
-
- public boolean isIncrementalFileMode() {
- return (null != incrementalFile);
- }
-
- /**
- * This includes injars and aspectpath
- */
- public List getFullClasspath() {
- if (inJars.isEmpty() && aspectpath.isEmpty()) return getClasspath();
- List full = new ArrayList();
- for (Iterator i = inJars.iterator(); i.hasNext(); ) {
- full.add(((File)i.next()).getAbsolutePath());
- }
- for (Iterator i = aspectpath.iterator(); i.hasNext(); ) {
- full.add(((File)i.next()).getAbsolutePath());
- }
- full.addAll(getClasspath());
- return full;
- }
-
- public String getLintMode() {
- return lintMode;
- }
-
- public File getLintSpecFile() {
- return lintSpecFile;
- }
-
- public List getAspectpath() {
- return aspectpath;
- }
-
- public boolean isNoWeave() {
- return noWeave;
- }
-
- public void setLintMode(String lintMode) {
- this.lintMode = lintMode;
- }
-
- public void setLintSpecFile(File lintSpecFile) {
- this.lintSpecFile = lintSpecFile;
- }
-
- public void setAspectpath(List aspectpath) {
- this.aspectpath = aspectpath;
- }
-
- public void setNoWeave(boolean noWeave) {
- this.noWeave = noWeave;
- }
-
- public boolean isXserializableAspects() {
- return XserializableAspects;
- }
-
- public void setXserializableAspects(boolean xserializableAspects) {
- XserializableAspects = xserializableAspects;
- }
-
- public boolean isXnoInline() {
- return XnoInline;
- }
-
- public void setXnoInline(boolean xnoInline) {
- XnoInline = xnoInline;
- }
-
- }
|