Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

AjBuildConfig.java 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. /* *******************************************************************
  2. * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
  3. * All rights reserved.
  4. * This program and the accompanying materials are made available
  5. * under the terms of the Common Public License v1.0
  6. * which accompanies this distribution and is available at
  7. * http://www.eclipse.org/legal/cpl-v10.html
  8. *
  9. * Contributors:
  10. * PARC initial implementation
  11. * Adrian Colyer added constructor to populate javaOptions with
  12. * default settings - 01.20.2003
  13. * Bugzilla #29768, 29769
  14. * ******************************************************************/
  15. package org.aspectj.ajdt.internal.core.builder;
  16. import java.io.File;
  17. import java.util.*;
  18. import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
  19. /**
  20. * All configuration information needed to run the AspectJ compiler.
  21. */
  22. public class AjBuildConfig {
  23. public static final String AJLINT_IGNORE = "ignore";
  24. public static final String AJLINT_WARN = "warn";
  25. public static final String AJLINT_ERROR = "error";
  26. public static final String AJLINT_DEFAULT = "default";
  27. private File outputDir;
  28. private File outputJar;
  29. private List/*File*/ sourceRoots = new ArrayList();
  30. private List/*File*/ files = new ArrayList();
  31. private List/*File*/ inJars = new ArrayList();
  32. private List/*File*/ aspectpath = new ArrayList();
  33. private List/*String*/ classpath = new ArrayList();
  34. private Map javaOptions = new HashMap();
  35. private Map ajOptions = new HashMap();
  36. private File configFile;
  37. private boolean generateModelMode = false;
  38. private boolean emacsSymMode = false;
  39. private boolean noWeave = false;
  40. private boolean XserializableAspects = false;
  41. private boolean XnoInline = false;
  42. private String lintMode = AJLINT_DEFAULT;
  43. private File lintSpecFile = null;
  44. // incremental variants handled by the compiler client, but parsed here
  45. private boolean incrementalMode;
  46. private File incrementalFile;
  47. /**
  48. * Intialises the javaOptions Map to hold the default
  49. * JDT Compiler settings. Added by AMC 01.20.2003 in reponse
  50. * to bug #29768 and enh. 29769.
  51. * The settings here are duplicated from those set in
  52. * org.eclipse.jdt.internal.compiler.batch.Main, but I've elected to
  53. * copy them rather than refactor the JDT class since this keeps
  54. * integration with future JDT releases easier (?).
  55. */
  56. public AjBuildConfig( ) {
  57. javaOptions.put(
  58. CompilerOptions.OPTION_LocalVariableAttribute,
  59. CompilerOptions.DO_NOT_GENERATE);
  60. javaOptions.put(
  61. CompilerOptions.OPTION_LineNumberAttribute,
  62. CompilerOptions.DO_NOT_GENERATE);
  63. javaOptions.put(
  64. CompilerOptions.OPTION_SourceFileAttribute,
  65. CompilerOptions.DO_NOT_GENERATE);
  66. javaOptions.put(
  67. CompilerOptions.OPTION_PreserveUnusedLocal,
  68. CompilerOptions.OPTIMIZE_OUT);
  69. javaOptions.put(
  70. CompilerOptions.OPTION_ReportUnreachableCode,
  71. CompilerOptions.ERROR);
  72. javaOptions.put(
  73. CompilerOptions.OPTION_ReportInvalidImport,
  74. CompilerOptions.ERROR);
  75. javaOptions.put(
  76. CompilerOptions.OPTION_ReportOverridingPackageDefaultMethod,
  77. CompilerOptions.WARNING);
  78. javaOptions.put(
  79. CompilerOptions.OPTION_ReportMethodWithConstructorName,
  80. CompilerOptions.WARNING);
  81. javaOptions.put(
  82. CompilerOptions.OPTION_ReportDeprecation,
  83. CompilerOptions.WARNING);
  84. javaOptions.put(
  85. CompilerOptions.OPTION_ReportHiddenCatchBlock,
  86. CompilerOptions.WARNING);
  87. javaOptions.put(
  88. CompilerOptions.OPTION_ReportUnusedLocal,
  89. CompilerOptions.IGNORE);
  90. javaOptions.put(
  91. CompilerOptions.OPTION_ReportUnusedParameter,
  92. CompilerOptions.IGNORE);
  93. javaOptions.put(
  94. CompilerOptions.OPTION_ReportSyntheticAccessEmulation,
  95. CompilerOptions.IGNORE);
  96. javaOptions.put(
  97. CompilerOptions.OPTION_ReportNonExternalizedStringLiteral,
  98. CompilerOptions.IGNORE);
  99. javaOptions.put(
  100. CompilerOptions.OPTION_ReportAssertIdentifier,
  101. CompilerOptions.IGNORE);
  102. javaOptions.put(
  103. CompilerOptions.OPTION_Compliance,
  104. CompilerOptions.VERSION_1_3);
  105. javaOptions.put(
  106. CompilerOptions.OPTION_Source,
  107. CompilerOptions.VERSION_1_3);
  108. javaOptions.put(
  109. CompilerOptions.OPTION_TargetPlatform,
  110. CompilerOptions.VERSION_1_1);
  111. }
  112. /**
  113. * returned files includes <ul>
  114. * <li>files explicitly listed on command-line</li>
  115. * <li>files listed by reference in argument list files</li>
  116. * <li>files contained in sourceRootDir if that exists</li>
  117. * </ul>
  118. *
  119. * @return all source files that should be compiled.
  120. */
  121. public List/*File*/ getFiles() {
  122. return files;
  123. }
  124. public File getOutputDir() {
  125. return outputDir;
  126. }
  127. public void setFiles(List files) {
  128. this.files = files;
  129. }
  130. public void setOutputDir(File outputDir) {
  131. this.outputDir = outputDir;
  132. }
  133. public Map getAjOptions() {
  134. return ajOptions;
  135. }
  136. /**
  137. * @return the Map expected by org.eclipse.jdt.core.internal.Compiler.
  138. */
  139. public Map getJavaOptions() {
  140. return javaOptions;
  141. }
  142. public void setAjOptions(Map ajOptions) {
  143. this.ajOptions = ajOptions;
  144. }
  145. public void setJavaOptions(Map javaOptions) {
  146. this.javaOptions = javaOptions;
  147. }
  148. /**
  149. * This includes all entries from -bootclasspath, -extdirs, -classpath,
  150. */
  151. public List getClasspath() { // XXX setters don't respect javadoc contract...
  152. return classpath;
  153. }
  154. public void setClasspath(List classpath) {
  155. this.classpath = classpath;
  156. }
  157. public File getOutputJar() {
  158. return outputJar;
  159. }
  160. public List/*File*/ getInJars() {
  161. return inJars;
  162. }
  163. public void setOutputJar(File outputJar) {
  164. this.outputJar = outputJar;
  165. }
  166. public void setInJars(List sourceJars) {
  167. this.inJars = sourceJars;
  168. }
  169. public List getSourceRoots() {
  170. return sourceRoots;
  171. }
  172. public void setSourceRoots(List sourceRootDir) {
  173. this.sourceRoots = sourceRootDir;
  174. }
  175. public File getConfigFile() {
  176. return configFile;
  177. }
  178. public void setConfigFile(File configFile) {
  179. this.configFile = configFile;
  180. }
  181. public boolean isEmacsSymMode() {
  182. return emacsSymMode;
  183. }
  184. public void setEmacsSymMode(boolean emacsSymMode) {
  185. this.emacsSymMode = emacsSymMode;
  186. }
  187. public boolean isGenerateModelMode() {
  188. return generateModelMode;
  189. }
  190. public void setGenerateModelMode(boolean structureModelMode) {
  191. this.generateModelMode = structureModelMode;
  192. }
  193. public void setIncrementalMode(boolean incrementalMode) {
  194. this.incrementalMode = incrementalMode;
  195. }
  196. public boolean isIncrementalMode() {
  197. return incrementalMode;
  198. }
  199. public void setIncrementalFile(File incrementalFile) {
  200. this.incrementalFile = incrementalFile;
  201. }
  202. public boolean isIncrementalFileMode() {
  203. return (null != incrementalFile);
  204. }
  205. /**
  206. * This includes injars and aspectpath
  207. */
  208. public List getFullClasspath() {
  209. if (inJars.isEmpty() && aspectpath.isEmpty()) return getClasspath();
  210. List full = new ArrayList();
  211. for (Iterator i = inJars.iterator(); i.hasNext(); ) {
  212. full.add(((File)i.next()).getAbsolutePath());
  213. }
  214. for (Iterator i = aspectpath.iterator(); i.hasNext(); ) {
  215. full.add(((File)i.next()).getAbsolutePath());
  216. }
  217. full.addAll(getClasspath());
  218. return full;
  219. }
  220. public String getLintMode() {
  221. return lintMode;
  222. }
  223. public File getLintSpecFile() {
  224. return lintSpecFile;
  225. }
  226. public List getAspectpath() {
  227. return aspectpath;
  228. }
  229. public boolean isNoWeave() {
  230. return noWeave;
  231. }
  232. public void setLintMode(String lintMode) {
  233. this.lintMode = lintMode;
  234. }
  235. public void setLintSpecFile(File lintSpecFile) {
  236. this.lintSpecFile = lintSpecFile;
  237. }
  238. public void setAspectpath(List aspectpath) {
  239. this.aspectpath = aspectpath;
  240. }
  241. public void setNoWeave(boolean noWeave) {
  242. this.noWeave = noWeave;
  243. }
  244. public boolean isXserializableAspects() {
  245. return XserializableAspects;
  246. }
  247. public void setXserializableAspects(boolean xserializableAspects) {
  248. XserializableAspects = xserializableAspects;
  249. }
  250. public boolean isXnoInline() {
  251. return XnoInline;
  252. }
  253. public void setXnoInline(boolean xnoInline) {
  254. XnoInline = xnoInline;
  255. }
  256. }