PageRenderTime 56ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/jde-2.3.5/lisp/jde-compile.el

https://github.com/fbrunel/emacs
Emacs Lisp | 1464 lines | 911 code | 206 blank | 347 comment | 52 complexity | 449579ed95c45771743a29f6599d77cd MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. ;;; jde-compile.el -- Integrated Development Environment for Java.
  2. ;; $Revision: 1.63 $ $Date: 2004/10/20 06:17:06 $
  3. ;; Author: Paul Kinnucan <paulk@mathworks.com>
  4. ;; Maintainer: Paul Kinnucan
  5. ;; Keywords: java, tools
  6. ;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004 Paul Kinnucan.
  7. ;; GNU Emacs is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation; either version 2, or (at your option)
  10. ;; any later version.
  11. ;; GNU Emacs is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;; GNU General Public License for more details.
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  17. ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18. ;; Boston, MA 02111-1307, USA.
  19. ;;; Commentary:
  20. ;; This is one of a set of packages that make up the
  21. ;; Java Development Environment (JDE) for Emacs. See the
  22. ;; JDE User's Guide for more information.
  23. ;; The latest version of the JDE is available at
  24. ;; <URL:http://sunsite.auc.dk/jde/>.
  25. ;; Please send any comments, bugs, or upgrade requests to
  26. ;; Paul Kinnucan at paulk@mathworks.com.
  27. ;;; Code:
  28. (require 'eieio)
  29. (require 'cl)
  30. (require 'compile)
  31. (defgroup jde-compile-options nil
  32. "JDE Compiler Options"
  33. :group 'jde
  34. :prefix "jde-compile-option-")
  35. ;; (makunbound 'jde-compiler)
  36. (defcustom jde-compiler '("javac server" "")
  37. "Specify the type, and if necessary, the location of the compiler to
  38. be used to compile source files for the current project. The JDE
  39. supports three compilers: javac server, javac executable, and
  40. jikes. The javac server runs the com.sun.tools.javac package included
  41. with the JDK in the Beanshell. The javac executable shipped with the
  42. JDK also uses this package. The advantage of the javac server is that
  43. it avoids the vm startup time that accounts for most of the
  44. compilation time consumed by the javac executable. The javac server
  45. uses the version of com.sun.tools.javac included in the JDK for the
  46. current project. See `jde-jdk' for more information. If you want to
  47. use the javac executable to compile your project's source files,
  48. select \"javac\" as the compiler type and, optionally, specify
  49. the path to the executable in the \"Path\" field. If you do
  50. not specify a path, the JDE uses the javac executable included in the
  51. JDK for the current project. Similarly, to use jikes, select \"jikes\"
  52. and, if jikes is not on the command path of the Emacs
  53. environment, specify the path of the jikes executable."
  54. :group 'jde-project
  55. :type '(list
  56. (radio-button-choice
  57. :format "%t \n%v"
  58. :tag "Compiler type"
  59. (item "javac server")
  60. (item "javac")
  61. (item "jikes"))
  62. (file
  63. :tag "Path")))
  64. (defcustom jde-read-compile-args nil
  65. "*Specify whether to prompt for additional compiler arguments.
  66. If this variable is non-nil, the jde-compile command prompts
  67. you to enter additional compiler arguments in the minibuffer.
  68. These arguments are appended to those specified by customization
  69. variables. The JDE maintains a history list of arguments
  70. entered in the minibuffer."
  71. :group 'jde-project
  72. :type 'boolean)
  73. (defvar jde-interactive-compile-args ""
  74. "String of compiler arguments entered in the minibuffer.")
  75. (defvar jde-interactive-compile-arg-history nil
  76. "History of compiler arguments entered in the minibuffer.")
  77. ;; (makunbound 'jde-compile-finish-hook)
  78. (defcustom jde-compile-finish-hook
  79. '(jde-compile-finish-kill-buffer
  80. jde-compile-finish-refresh-speedbar
  81. jde-compile-finish-update-class-info)
  82. "List of functions to be invoked when compilation of a
  83. Java source file terminates. Each function should accept
  84. two arguments: the compilation buffer and a string
  85. describing how the compilation finished."
  86. :group 'jde
  87. :type 'hook)
  88. (defcustom jde-compile-option-hide-classpath nil
  89. "Substitute the classpath in the compilation window for
  90. ..."
  91. :group 'jde-compile-options
  92. :type 'boolean)
  93. (defun jde-compile-update-class-list ()
  94. (let ((class-dir
  95. (if (string= jde-compile-option-directory "")
  96. (expand-file-name ".")
  97. (jde-normalize-path
  98. jde-compile-option-directory
  99. 'jde-compile-option-directory))))
  100. (message (concat "Updating class list for " class-dir))
  101. (jde-jeval (concat
  102. "jde.util.JdeUtilities.updateClassList(\""
  103. class-dir
  104. "\");"))
  105. (message "Updating class list...done.")))
  106. (defun jde-compile-finish-update-class-info (buf msg)
  107. "Flush the classinfo cache and update the class list used by
  108. JDEE wizards at the end of compilation. Flush the entire cache as we
  109. don't know which classes were recompiled."
  110. ;;Setting the last java buffer as the current buffer
  111. (condition-case nil
  112. (progn
  113. (if jde-xemacsp
  114. (set-buffer (cadr (buffer-list)))
  115. (set-buffer (car (buffer-list))))
  116. (if (eq major-mode 'jde-mode)
  117. (progn
  118. (setq jde-complete-last-compiled-class (jde-parse-get-buffer-class))
  119. (jde-complete-flush-classes-in-cache (list jde-complete-last-compiled-class))
  120. (message "Flushed completion cache.")
  121. (setq jde-complete-last-compiled-class nil)
  122. (jde-compile-update-class-list))))
  123. (error nil)))
  124. (defun jde-compile-finish-refresh-speedbar (buf msg)
  125. "Refresh speedbar at the end of a compilation."
  126. (if (and (frame-live-p speedbar-frame)
  127. (frame-visible-p speedbar-frame))
  128. (speedbar-refresh)))
  129. (defcustom jde-compile-jump-to-first-error t
  130. "*Automatically jump to the first error when a compilation process completes."
  131. :group 'jde-compile-options
  132. :type 'boolean)
  133. (defun jde-compile-kill-buffer (buf)
  134. (delete-windows-on buf)
  135. (if jde-compile-enable-kill-buffer
  136. (kill-buffer buf)))
  137. ;; Thanks to Jack Donohue <donohuej@synovation.com>.
  138. (defun jde-compile-finish-kill-buffer (buf msg)
  139. "Removes the jde-compile window after a few seconds if no errors."
  140. (save-excursion
  141. (set-buffer buf)
  142. (if (null (or (string-match ".*exited abnormally.*" msg)
  143. (string-match ".*BUILD FAILED.*" (buffer-string))))
  144. ;;no errors, make the compilation window go away in a few seconds
  145. (lexical-let ((compile-buffer buf))
  146. (run-at-time
  147. "2 sec" nil 'jde-compile-kill-buffer
  148. compile-buffer)
  149. (message "No compilation errors"))
  150. ;;there were errors, so jump to the first error
  151. (if jde-compile-jump-to-first-error (next-error 1)))))
  152. (defcustom jde-compile-option-command-line-args nil
  153. "*Specify options as a string of command-line arguments.
  154. The value of this variable should be a list of switches understood
  155. by the compiler, for example, -depend -g. This variable is intended to
  156. be used to set compile options not otherwise defined by the JDE, in
  157. particular, options not defined by javac but used by another compiler
  158. that you might want to use with the JDE."
  159. :group 'jde-compile-options
  160. :type '(repeat (string :tag "Argument:")))
  161. (defcustom jde-compile-option-classpath nil
  162. "*Specify paths of classes required to compile this project.
  163. The JDE uses the specified paths to construct a -classpath
  164. argument to pass to the compiler. This option overrides the
  165. `jde-global-classpath' option."
  166. :group 'jde-compile-options
  167. :type '(repeat (file :tag "Path")))
  168. (defcustom jde-compile-option-sourcepath nil
  169. "*Specify the source code path to search for class or interface definitions.
  170. As with the user class path, source path entries can be directories, JAR
  171. archives, or ZIP archives. If packages are used, the local path name within
  172. the directory or archive must reflect the package name.
  173. Note that classes found through the classpath are subject to automatic
  174. recompilation if their sources are found."
  175. :group 'jde-compile-options
  176. :type '(repeat (file :tag "Path")))
  177. (defcustom jde-compile-option-directory ""
  178. "*Specifies the root directory of the class file hierarchy.
  179. The compiler places compiled classes in the specified
  180. directory. For example, specifying the class
  181. directory as:
  182. C:\\users\\dac\\classes
  183. causes the class files for the classes in the MyProgram.java source
  184. file to be saved in the directory C:\\users\\dac\\classes. If your class
  185. is in the package demos\\awt, the class files would be placed in directory
  186. C:\\users\\dac\\classes\\demos\\awt."
  187. :group 'jde-compile-options
  188. :type 'directory)
  189. (defcustom jde-compile-option-deprecation nil
  190. "*Warn use or override of a deprecated member or class.
  191. A member or class is deprecated if its documentation comment contains
  192. the @deprecated tag. The compiler will emit a warning at the end of
  193. compilation whether or not the deprecation option is on; this option
  194. causes the location of each individual use or override to be noted.
  195. Deprecated members or classes are deliberately not mentioned if the
  196. source file containing the deprecation is being recompiled. This can
  197. happen because the file is on the command line or because the depend
  198. option is on and the source file is out of date.
  199. "
  200. :group 'jde-compile-options
  201. :type 'boolean)
  202. (defcustom jde-compile-option-debug
  203. (list "selected" (list t nil nil))
  204. "*Include debug information in classes.
  205. The compiler includes line number information by default.
  206. Before JDK 1.2, the the debug and optimize options were
  207. mutually exclusive. In JDK 1.2, it is possible to combine debug and
  208. optimize, but the shortcuts taken by optimized code may occasionally
  209. produce surprising debugging results. For example, declared variables
  210. may not exist and code may appear to move or not be executed at all.
  211. The JDK 1.1.x versions of javac do not support inclusion of selected
  212. debug information."
  213. :group 'jde-compile-options
  214. :type '(list
  215. (radio-button-choice
  216. :format "%t \n%v"
  217. :tag "Debug info to include in class:"
  218. (const "all")
  219. (const "none")
  220. (const "selected"))
  221. (list
  222. :tag " info"
  223. :indent 4
  224. (checkbox :format "%[%v%] %t \n"
  225. :tag "Line Numbers")
  226. (checkbox :format "%[%v%] %t \n"
  227. :tag "Variables")
  228. (checkbox :format "%[%v%] %t \n"
  229. :tag "Source")))
  230. )
  231. (defcustom jde-compile-option-optimize nil
  232. "*Directs the compiler to try to generate faster code.
  233. This may slow down compilation, make larger class files, and/or make
  234. it difficult to debug.
  235. Prior to 1.2, the optimize option tried to inline methods across
  236. classes. This created compatibility problems and sometimes generated
  237. illegal bytecode. The optimize option also implicitly turned on the
  238. depend option and implicitly turned off the debug option.
  239. In JDK 1.2, the optimize option no longer inlines across classes and
  240. so may safely be used for any java compilation. Optimize no longer
  241. implicitly turns on depend or implicitly turns off debug."
  242. :group 'jde-compile-options
  243. :type 'boolean)
  244. (defcustom jde-compile-option-depend nil
  245. "*Analyze dependencies.
  246. Causes recompilation of class files on which the source files given as
  247. command line arguments recursively depend. Without this option, only
  248. files that are directly depended on and missing or out-of-date will be
  249. recompiled. Recompilation does not extend to missing or out-of-date
  250. files only depended on by already up-to-date class files.
  251. Note: if you are using a compiler other than post JDK 1.1.6 versions
  252. of javac, you may need to specify the command-line switch used by
  253. the compiler to specify dependency checking. See
  254. `jde-compile-option-depend-switch' for more information."
  255. :group 'jde-compile-options
  256. :type 'boolean)
  257. (defcustom jde-compile-option-depend-switch (list "-Xdepend")
  258. "*Specify command line switch for depend option.
  259. This option is necessary because the command-line switch for
  260. dependency checking differs among Java compilers. Choose
  261. from the following options:
  262. -Xdepend Full dependency checking (post JDK 1.1.6)
  263. -depend Full dependency checking (jikes and pre-JDK 1.1.6)
  264. +F Check everything except jar and zip files (jikes only)
  265. +U Check everything including jar and zip files (jikes only)"
  266. :group 'jde-compile-options
  267. :type '(list
  268. (radio-button-choice
  269. :format "%t \n%v"
  270. :tag "Select -Xdepend (javac) or -depend (jikes):"
  271. (const "-Xdepend")
  272. (const "-depend")
  273. (const "+F")
  274. (const "+U"))))
  275. (defcustom jde-compile-option-vm-args nil
  276. "*Specify command-line arguments for Java interpreter.
  277. Passes the specified arguments to the Java interpreter that runs the
  278. compiler. The argument should not contain spaces. This is useful for
  279. adjusting the compiler's execution environment or memory usage."
  280. :group 'jde-compile-options
  281. :type '(repeat (string :tag "Option")))
  282. (defcustom jde-compile-option-verbose nil
  283. "*Print verbose messages.
  284. Causes the compiler and linker to print out messages about what source
  285. files are being compiled and what class files are being loaded."
  286. :group 'jde-compile-options
  287. :type 'boolean)
  288. (defcustom jde-compile-option-nowarn nil
  289. "*Turn off warnings.
  290. If this option is specified, the compiler does not print out any
  291. warnings."
  292. :group 'jde-compile-options
  293. :type 'boolean)
  294. (defcustom jde-compile-option-encoding ""
  295. "*Specify the source file encoding name, such as EUCJIS\\SJIS.
  296. If this option is not specified, then the platform default converter
  297. is used."
  298. :group 'jde-compile-options
  299. :type 'string)
  300. ;;(makunbound 'jde-compile-option-source)
  301. (defcustom jde-compile-option-source (list "default")
  302. "*Enables JDK version-specific features to be used in
  303. source files.
  304. 1.3 The compiler does not support assertions
  305. 1.4 The compiler accepts code containing assertions.
  306. 1.5 Enables 1.5-specific features.
  307. Select \"default\" to use the source features that
  308. the compiler supports by default, i.e., to not include the -source
  309. switch on the compiler command line. For example, the javac compiler
  310. defaults to 1.3 source features if the -source flag is not
  311. used.
  312. ***NOTE***
  313. This option is supported only by versions of javac shipped
  314. starting with J2SDK 1.4."
  315. :group 'jde-compile-options
  316. :type '(list
  317. (radio-button-choice
  318. :format "%t \n%v"
  319. :tag "Source release:"
  320. (const "default")
  321. (const "1.3")
  322. (const "1.4")
  323. (const "1.5"))))
  324. ;;(makunbound 'jde-compile-option-target)
  325. (defcustom jde-compile-option-target (list "1.1")
  326. "*Generate class files that will work on VMs with the specified version.
  327. The default is to generate class files to be compatible with both
  328. 1.1 and 1.2 VMs. The versions supported by javac in JDK1.2 are:
  329. 1.1 Ensure that generated class files will be compatible
  330. with 1.1 and 1.2 VMs. This is the default.
  331. 1.2 Generate class files that will run on 1.2 VMs, but
  332. not on 1.1 VMs.
  333. 1.3 Generate class files that will run on VMs in the
  334. Java 2 SDK, v 1.3 and later, but will not run
  335. on 1.1 or 1.2 VMs
  336. 1.4 Generate class files that are compatible only with
  337. 1.4 VMs.
  338. By default, classes are compiled against the bootstrap and extension classes
  339. of the JDK that javac shipped with. But javac also supports cross-compiling,
  340. where classes are compiled against a bootstrap and extension classes of a
  341. different Java platform implementation. It is important to use
  342. `jde-compile-option-bootclasspath' and `jde-compile-option-extdirs' when
  343. cross-compiling."
  344. :group 'jde-compile-options
  345. :type '(list
  346. (radio-button-choice
  347. :format "%t \n%v"
  348. :tag "Target VM:"
  349. (const "1.1")
  350. (const "1.2")
  351. (const "1.3")
  352. (const "1.4"))))
  353. (defcustom jde-compile-option-bootclasspath nil
  354. "*Cross-compile against the specified set of boot classes.
  355. As with the user class path, boot class path entries can be
  356. directories, JAR archives, or ZIP archives."
  357. :group 'jde-compile-options
  358. :type '(repeat (file :tag "Path")))
  359. (defcustom jde-compile-option-extdirs nil
  360. "*Cross-compile against the specified extension directories.
  361. Each JAR archive in the specified directories is searched for class files."
  362. :group 'jde-compile-options
  363. :type '(repeat (file :tag "Path")))
  364. ;;(makunbound 'jde-compile-option-verbose-path)
  365. (defcustom jde-compile-option-verbose-path nil
  366. "*Describe how paths and standard extensions were searched to find
  367. source and class files.
  368. ***NOTE***
  369. This option is supported only by the versions of javac shipped
  370. with JDK 1.1.x and 1.2.x and oldjavac in JDK 1.3."
  371. :group 'jde-compile-options
  372. :type 'boolean)
  373. (defcustom jde-compile-enable-kill-buffer nil
  374. "* If true the 'jde-compile-finish-kill-buffer will kill the compilation
  375. buffer."
  376. :group 'jde-compile-options
  377. :type 'boolean)
  378. (defun jde-compile-show-options-buffer ()
  379. "Show the JDE Compile Options panel."
  380. (interactive)
  381. (customize-apropos "jde-compile-options" 'groups))
  382. (defclass jde-compile-server-buffer (bsh-compilation-buffer) ()
  383. "Compiler server buffer.")
  384. (defmethod bsh-compilation-buffer-create-native-buffer ((this jde-compile-server-buffer))
  385. "Creates the native Emacs buffer for the JDEE compile server."
  386. (oset this buffer-name "*JDEE Compile Server*")
  387. (oset this buffer (get-buffer-create (oref this buffer-name))))
  388. (defclass jde-compile-exec-buffer (bsh-compilation-buffer) ()
  389. "Compiler exec buffer.")
  390. (defmethod initialize-instance ((this jde-compile-exec-buffer) &rest fields)
  391. "Constructor for exec compilation buffer instance."
  392. (bsh-compilation-buffer-create-native-buffer this)
  393. (oset
  394. this
  395. filter
  396. (lexical-let ((this-buf this))
  397. (lambda (process output)
  398. (bsh-compilation-buffer-filter this-buf process output))))
  399. (oset this process (get-buffer-process (oref this buffer)))
  400. ;; Make sure this buffer is not associated with a compiler process that is
  401. ;; already running.
  402. (if (oref this process)
  403. (if (or (not (eq (process-status (oref this process)) 'run))
  404. (yes-or-no-p
  405. "A compilation process is running; kill it?"))
  406. (condition-case ()
  407. (progn
  408. (interrupt-process (oref this process))
  409. (sit-for 1)
  410. (delete-process (oref this process)))
  411. (error nil))
  412. (error "Cannot have two processes in `%s' at once"
  413. (oref this buffer-name))))
  414. (bsh-compilation-buffer-set-mode this))
  415. (defmethod bsh-compilation-buffer-create-native-buffer ((this jde-compile-exec-buffer))
  416. "Creates the native Emacs buffer for the JDEE compile server."
  417. (oset this buffer-name "*compilation*")
  418. (oset this buffer (get-buffer-create (oref this buffer-name))))
  419. (defclass jde-compile-compiler ()
  420. ((name :initarg :name
  421. :type string
  422. :documentation
  423. "Name of compiler")
  424. (version :initarg :version
  425. :type string
  426. :documentation
  427. "Compiler version.")
  428. (path :initarg :path
  429. :type string
  430. :documentation
  431. "Path of the compiler executable.")
  432. (buffer :initarg :buffer
  433. :type bsh-compilation-buffer
  434. :documentation
  435. "Compilation buffer")
  436. (window :initarg :window
  437. :type window
  438. :documentation
  439. "Window that displays the compilation buffer.")
  440. (interactive-args :initarg :interactive-args
  441. :type list
  442. :documentation
  443. "Arguments entered in the minibuffer.")
  444. (use-server-p :initarg :use-server-p
  445. :type boolean
  446. :documentation
  447. "Run as a compile server in the Beanshell."))
  448. "Class of Java compilers.")
  449. (defmethod jde-compile-classpath-arg ((this jde-compile-compiler))
  450. "Returns the classpath argument for this compiler."
  451. (let ((classpath
  452. (if jde-compile-option-classpath
  453. jde-compile-option-classpath
  454. (jde-get-global-classpath)))
  455. (symbol
  456. (if jde-compile-option-classpath
  457. 'jde-compile-option-classpath
  458. 'jde-global-classpath)))
  459. (if classpath
  460. (list
  461. "-classpath"
  462. (jde-build-classpath
  463. classpath
  464. symbol)
  465. ))))
  466. (defmethod jde-compile-sourcepath-arg ((this jde-compile-compiler))
  467. "Get the source path argument for this compiler."
  468. (if jde-compile-option-sourcepath
  469. (list
  470. "-sourcepath"
  471. (jde-build-classpath
  472. jde-compile-option-sourcepath
  473. 'jde-compile-option-sourcepath))))
  474. (defmethod jde-compile-bootclasspath-arg ((this jde-compile-compiler))
  475. "Get the boot classpath argument for this compiler."
  476. (if jde-compile-option-bootclasspath
  477. (list
  478. "-bootclasspath"
  479. (jde-build-classpath jde-compile-option-bootclasspath
  480. 'jde-compile-option-bootclasspath))))
  481. (defmethod jde-compile-extdirs-arg ((this jde-compile-compiler))
  482. "Get the extdirs argument for this compiler."
  483. (if jde-compile-option-extdirs
  484. (list
  485. "-extdirs"
  486. (jde-build-classpath
  487. jde-compile-option-extdirs
  488. 'jde-compile-option-extdirs))))
  489. (defmethod jde-compile-encoding-arg ((this jde-compile-compiler))
  490. (if (not (string= jde-compile-option-encoding ""))
  491. (list
  492. "-encoding"
  493. jde-compile-option-encoding)))
  494. (defmethod jde-compile-debug-arg ((this jde-compile-compiler))
  495. "Get the debug arg for this compiler."
  496. (let* ((include-option (nth 0 jde-compile-option-debug))
  497. (selected (nth 1 jde-compile-option-debug))
  498. (lines (nth 0 selected))
  499. (vars (nth 1 selected))
  500. (src (nth 2 selected)))
  501. (cond
  502. ((and
  503. (string= include-option "selected")
  504. lines
  505. (not vars)
  506. (not src))
  507. nil)
  508. ((string= include-option "all")
  509. (list "-g"))
  510. ((string= include-option "none")
  511. (list "-g:none"))
  512. ((and
  513. (string= include-option "selected")
  514. (or lines vars src))
  515. (list
  516. (concat
  517. "-g:"
  518. (if lines
  519. (if (or vars src) "lines,"
  520. "lines"))
  521. (if vars
  522. (if vars
  523. (if src "vars," "vars")))
  524. (if src "source")))))))
  525. (defmethod jde-compile-output-dir-arg ((this jde-compile-compiler))
  526. "Get the ouput directory arg for this compiler."
  527. (if (not (string= jde-compile-option-directory ""))
  528. (list
  529. "-d"
  530. (jde-normalize-path 'jde-compile-option-directory))))
  531. (defmethod jde-compile-deprecation-arg ((this jde-compile-compiler))
  532. "Get deprecation argument for this compiler."
  533. (if jde-compile-option-deprecation
  534. (list "-deprecation")))
  535. (defmethod jde-compile-optimize-arg ((this jde-compile-compiler))
  536. "Get optimization argument for this compiler."
  537. (if jde-compile-option-optimize
  538. (list "-O")))
  539. (defmethod jde-compile-depend-arg ((this jde-compile-compiler))
  540. "Get dependency-checking argument for this compiler."
  541. (if jde-compile-option-depend
  542. (list (car jde-compile-option-depend-switch))))
  543. (defmethod jde-compile-vm-args ((this jde-compile-compiler))
  544. "Get arguments to pass to the vm used to run this compiler."
  545. (if jde-compile-option-vm-args
  546. (mapcan
  547. (lambda (arg)
  548. (list (concat "-J" arg)))
  549. jde-compile-option-vm-args)))
  550. (defmethod jde-compile-verbose-arg ((this jde-compile-compiler))
  551. "Get verbosity level argument for this compiler."
  552. (if jde-compile-option-verbose
  553. (list "-verbose")))
  554. (defmethod jde-compile-verbose-path-arg ((this jde-compile-compiler))
  555. "Get verbose path argument for this compiler."
  556. (if jde-compile-option-verbose-path
  557. (list "-Xverbosepath")))
  558. (defmethod jde-compile-nowarn-arg ((this jde-compile-compiler))
  559. "Get no warning argument for this compiler."
  560. (if jde-compile-option-nowarn
  561. (list "-nowarn")))
  562. (defmethod jde-compile-command-line-args ((this jde-compile-compiler))
  563. "Get additional command line arguments for this compiler."
  564. jde-compile-option-command-line-args)
  565. (defmethod jde-compile-target-arg ((this jde-compile-compiler))
  566. "Get compiler target argument for this compiler."
  567. (let ((target (car jde-compile-option-target)))
  568. (if (not (string= target "1.1"))
  569. (list "-target" target))))
  570. (defmethod jde-compile-source-arg ((this jde-compile-compiler))
  571. "Get compiler source argument for this compiler."
  572. (let ((source (car jde-compile-option-source)))
  573. (if (not (string= source "default"))
  574. (list "-source" source))))
  575. (defmethod jde-compile-get-args ((this jde-compile-compiler))
  576. (append
  577. (jde-compile-classpath-arg this)
  578. (jde-compile-sourcepath-arg this)
  579. (jde-compile-bootclasspath-arg this)
  580. (jde-compile-extdirs-arg this)
  581. (jde-compile-encoding-arg this)
  582. (jde-compile-debug-arg this)
  583. (jde-compile-output-dir-arg this)
  584. (jde-compile-deprecation-arg this)
  585. (jde-compile-optimize-arg this)
  586. (jde-compile-depend-arg this)
  587. (jde-compile-vm-args this)
  588. (jde-compile-verbose-arg this)
  589. (jde-compile-verbose-path-arg this)
  590. (jde-compile-nowarn-arg this)
  591. (jde-compile-target-arg this)
  592. (jde-compile-source-arg this)
  593. (jde-compile-command-line-args this)))
  594. (defmethod jde-compile-run-exec ((this jde-compile-compiler))
  595. (let* ((outbuf (oref (oref this buffer) buffer))
  596. (compiler-path (oref this :path))
  597. (source-file (file-name-nondirectory buffer-file-name))
  598. (flag nil)
  599. (args (append
  600. (jde-compile-get-args this)
  601. (oref this :interactive-args)
  602. (list source-file))))
  603. (save-excursion
  604. (set-buffer outbuf)
  605. (insert (format "cd %s\n" default-directory))
  606. (insert (concat
  607. compiler-path
  608. " "
  609. (mapconcat (lambda (x)
  610. (if (and flag
  611. jde-compile-option-hide-classpath)
  612. (progn
  613. (setq flag nil)
  614. "...")
  615. (if (not (string= x "-classpath"))
  616. x
  617. (progn
  618. (setq flag t)
  619. x)))) args " ")
  620. "\n\n"))
  621. (let* ((process-environment (cons "EMACS=t" process-environment))
  622. (w32-quote-process-args ?\")
  623. (win32-quote-process-args ?\") ;; XEmacs
  624. (proc (apply 'start-process
  625. (downcase mode-name)
  626. outbuf
  627. compiler-path
  628. args)))
  629. (set-process-sentinel proc 'compilation-sentinel)
  630. (set-process-filter proc 'compilation-filter)
  631. (set-marker (process-mark proc) (point) outbuf)
  632. (setq compilation-in-progress
  633. (cons proc compilation-in-progress))))))
  634. (defmethod jde-compile-run-server ((this jde-compile-compiler))
  635. (let* ((directory-sep-char ?/)
  636. (args
  637. (append
  638. (jde-compile-get-args this)))
  639. (source-path
  640. (jde-normalize-path buffer-file-name))
  641. (arg-array (concat "new String[] {\"" source-path "\"")))
  642. (if args
  643. (setq arg-array
  644. (concat
  645. arg-array
  646. ","
  647. (mapconcat
  648. (lambda (arg)
  649. (concat "\"" arg "\""))
  650. args
  651. ","))))
  652. (setq arg-array (concat arg-array "}"))
  653. (save-excursion
  654. (set-buffer (oref (oref this buffer) buffer))
  655. (insert "CompileServer output:\n")
  656. (insert "\n")
  657. (let (flag temp)
  658. (setq temp
  659. (mapconcat
  660. (lambda (x)
  661. (if (and flag
  662. jde-compile-option-hide-classpath)
  663. (progn
  664. (setq flag nil)
  665. "...")
  666. (if (not (string= x "-classpath"))
  667. x
  668. (progn
  669. (setq flag t)
  670. x)))) args " "))
  671. (insert temp " "))
  672. (insert source-path "\n"))
  673. (if (not (jde-bsh-running-p))
  674. (progn
  675. (bsh-launch (oref 'jde-bsh the-bsh))
  676. (bsh-eval (oref 'jde-bsh the-bsh) (jde-create-prj-values-str))))
  677. (bsh-buffer-eval
  678. (oref 'jde-bsh the-bsh)
  679. (concat
  680. (format
  681. "jde.util.CompileServer.compile(%s);"
  682. arg-array)
  683. "\n")
  684. (oref this buffer))))
  685. (defmethod jde-compile-launch ((this jde-compile-compiler))
  686. (if (oref this :use-server-p)
  687. (jde-compile-run-server this)
  688. (jde-compile-run-exec this))
  689. (set-buffer-modified-p nil))
  690. (defmethod jde-compile-compile ((this jde-compile-compiler))
  691. (if (oref this :use-server-p)
  692. (oset this buffer (jde-compile-server-buffer "compilation buffer"))
  693. (oset this buffer (jde-compile-exec-buffer "compilation buffer")))
  694. ;; Pop to compilation buffer.
  695. (let* ((outbuf (oref (oref this buffer) buffer))
  696. (outwin (display-buffer outbuf)))
  697. (compilation-set-window-height outwin)
  698. (oset this :window outwin)
  699. (if (not jde-xemacsp)
  700. (if compilation-process-setup-function
  701. (funcall compilation-process-setup-function)))
  702. (jde-compile-launch this)
  703. (setq compilation-last-buffer outbuf)))
  704. (defclass jde-compile-javac (jde-compile-compiler)
  705. ()
  706. "Class of javac compilers.")
  707. (defmethod initialize-instance ((this jde-compile-javac) &rest fields)
  708. ;; Call parent initializer.
  709. (call-next-method)
  710. ;; Set compiler name.
  711. (oset this name "javac")
  712. )
  713. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  714. ;; ;;
  715. ;; JDK 1.1 Compiler ;;
  716. ;; ;;
  717. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  718. (defclass jde-compile-javac-11 (jde-compile-compiler)
  719. ()
  720. "Class of JDK 1.1 javac compilers.")
  721. (defmethod initialize-instance ((this jde-compile-javac-11) &rest fields)
  722. ;; Call parent initializer.
  723. (call-next-method)
  724. ;; Set compiler version.
  725. (oset this version "1.1"))
  726. (defmethod jde-compile-debug-arg ((this jde-compile-javac-11))
  727. "Get the debug arg for this compiler."
  728. (let ((include-option (nth 0 jde-compile-option-debug)))
  729. (cond
  730. ((string= include-option "all")
  731. (list "-g"))
  732. ((string= include-option "selected")
  733. (error "JDK 1.1 version of javac does not support selected debug info.")))))
  734. (defmethod jde-compile-depend-arg ((this jde-compile-javac-11))
  735. "Get dependency-checking argument for this compiler."
  736. (if jde-compile-option-depend
  737. (list "-depend")))
  738. (defmethod jde-compile-get-args ((this jde-compile-javac-11))
  739. (append
  740. (jde-compile-classpath-arg this)
  741. (jde-compile-encoding-arg this)
  742. (jde-compile-debug-arg this)
  743. (jde-compile-output-dir-arg this)
  744. (jde-compile-deprecation-arg this)
  745. (jde-compile-optimize-arg this)
  746. (jde-compile-depend-arg this)
  747. (jde-compile-vm-args this)
  748. (jde-compile-verbose-arg this)
  749. (jde-compile-nowarn-arg this)
  750. (jde-compile-command-line-args this)))
  751. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  752. ;; ;;
  753. ;; JDK 1.2 Compiler ;;
  754. ;; ;;
  755. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  756. (defclass jde-compile-javac-12 (jde-compile-compiler)
  757. ()
  758. "Class of JDK 1.2 javac compilers.")
  759. (defmethod initialize-instance ((this jde-compile-javac-12) &rest fields)
  760. ;; Call parent initializer.
  761. (call-next-method)
  762. ;; Set compiler version.
  763. (oset this version "1.2"))
  764. (defmethod jde-compile-depend-arg ((this jde-compile-javac-12))
  765. "Get dependency-checking argument for this compiler."
  766. (if jde-compile-option-depend
  767. (list "-Xdepend")))
  768. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  769. ;; ;;
  770. ;; JDK 1.3 Compiler ;;
  771. ;; ;;
  772. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  773. (defclass jde-compile-javac-13 (jde-compile-javac-12)
  774. ()
  775. "Class of JDK 1.3 javac compilers.")
  776. (defmethod initialize-instance ((this jde-compile-javac-13) &rest fields)
  777. ;; Call parent initializer.
  778. (call-next-method)
  779. ;; Set compiler version.
  780. (oset this version "1.3"))
  781. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  782. ;; ;;
  783. ;; JDK 1.4 Compiler ;;
  784. ;; ;;
  785. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  786. (defclass jde-compile-javac-14 (jde-compile-javac-13)
  787. ()
  788. "Class of JDK 1.4 javac compilers.")
  789. (defmethod initialize-instance ((this jde-compile-javac-14) &rest fields)
  790. ;; Call parent initializer.
  791. (call-next-method)
  792. ;; Set compiler version.
  793. (oset this version "1.4"))
  794. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  795. ;; ;;
  796. ;; J2SDK 1.5 Compiler ;;
  797. ;; ;;
  798. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  799. (defclass jde-compile-javac-15 (jde-compile-javac-14)
  800. ()
  801. "Class of J2SDK 1.5 javac compilers.")
  802. (defmethod initialize-instance ((this jde-compile-javac-15) &rest fields)
  803. ;; Call parent initializer.
  804. (call-next-method)
  805. ;; Set compiler version.
  806. (oset this version "1.5"))
  807. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  808. ;; ;;
  809. ;; Jikes Compiler ;;
  810. ;; ;;
  811. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  812. (defclass jde-compile-jikes (jde-compile-compiler)
  813. ()
  814. "Class of jikes compilers.")
  815. (defmethod initialize-instance ((this jde-compile-jikes) &rest fields)
  816. ;; Call parent initializer.
  817. (call-next-method)
  818. ;; Set compiler name.
  819. (oset this :name "jikes")
  820. ;; Set compiler version.
  821. (oset this version "1.14"))
  822. (defmethod jde-compile-debug-arg ((this jde-compile-jikes))
  823. "Get the debug arg for this compiler."
  824. (let ((include-option (nth 0 jde-compile-option-debug)))
  825. (cond
  826. ((string= include-option "all")
  827. (list "-g"))
  828. ((string= include-option "selected")
  829. (error "Jikes does not support jde-compile-option-debug's selected debug info option.")))))
  830. (defmethod jde-compile-depend-arg ((this jde-compile-jikes))
  831. "Get dependency-checking argument for this compiler."
  832. (if jde-compile-option-depend
  833. (list "-depend")))
  834. (defmethod jde-compile-command-line-args ((this jde-compile-jikes))
  835. "Get additional command line arguments for this compiler."
  836. (append
  837. (list "+E")
  838. jde-compile-option-command-line-args))
  839. (defmethod jde-compile-classpath-arg ((this jde-compile-jikes))
  840. "Returns the classpath argument for this compiler."
  841. (let ((classpath (call-next-method))
  842. (rt (expand-file-name "jre/lib/rt.jar" (jde-get-jdk-dir))))
  843. (if (file-exists-p rt)
  844. (if classpath
  845. (or (string-match "jre/lib/rt\.jar" (cadr classpath))
  846. (setcar (cdr classpath)
  847. (concat (cadr classpath)
  848. jde-classpath-separator
  849. rt)))
  850. (setq classpath (list "-classpath" rt))))
  851. classpath))
  852. (defmethod jde-compile-get-args ((this jde-compile-jikes))
  853. (append
  854. (jde-compile-classpath-arg this)
  855. (jde-compile-sourcepath-arg this)
  856. (jde-compile-bootclasspath-arg this)
  857. (jde-compile-extdirs-arg this)
  858. (jde-compile-encoding-arg this)
  859. (jde-compile-debug-arg this)
  860. (jde-compile-output-dir-arg this)
  861. (jde-compile-deprecation-arg this)
  862. (jde-compile-source-arg this)
  863. (jde-compile-optimize-arg this)
  864. (jde-compile-depend-arg this)
  865. (jde-compile-verbose-arg this)
  866. (jde-compile-verbose-path-arg this)
  867. (jde-compile-nowarn-arg this)
  868. (jde-compile-target-arg this)
  869. (jde-compile-command-line-args this)))
  870. (defvar jde-compile-javac-compilers
  871. (list
  872. (jde-compile-javac-11 "javac 1.1.x")
  873. (jde-compile-javac-12 "javac 1.2.x")
  874. (jde-compile-javac-13 "javac 1.3.x")
  875. (jde-compile-javac-14 "javac 1.4.x")
  876. (jde-compile-javac-15 "javac 1.5.x"))
  877. "List of supported javac compilers.")
  878. (defun jde-compile-get-javac ()
  879. (let* ((jdk-version (jde-java-version))
  880. (jdk-split-version (split-string jdk-version "[.]"))
  881. (jdk-major-version (nth 0 jdk-split-version))
  882. (jdk-minor-version (nth 1 jdk-split-version))
  883. (compiler
  884. (find-if
  885. (lambda (compiler-x)
  886. (let* ((compiler-split-version (split-string (oref compiler-x :version) "[.]"))
  887. (compiler-major-version (nth 0 compiler-split-version))
  888. (compiler-minor-version (nth 1 compiler-split-version)))
  889. (and
  890. (string= jdk-major-version compiler-major-version)
  891. (string= jdk-minor-version compiler-minor-version))))
  892. jde-compile-javac-compilers)))
  893. (unless compiler
  894. (let ((latest-javac (car (last jde-compile-javac-compilers))))
  895. (if
  896. (yes-or-no-p
  897. (format "The JDE does not recognize JDK %s javac. Assume JDK %s javac?"
  898. jdk-version (oref latest-javac :version)))
  899. (setq compiler latest-javac))))
  900. (if compiler
  901. (if (string= (car jde-compiler) "javac server")
  902. (oset compiler :use-server-p t)
  903. (progn
  904. (oset compiler :use-server-p nil)
  905. (oset compiler
  906. :path
  907. (let ((compiler-path
  908. (substitute-in-file-name (nth 1 jde-compiler))))
  909. (if (string= compiler-path "")
  910. (setq compiler-path (jde-get-jdk-prog 'javac))
  911. (if (file-exists-p compiler-path)
  912. compiler-path
  913. (error (format "Invalid compiler path %s"
  914. compiler-path)))))))))
  915. compiler))
  916. (defun jde-compile-get-jikes ()
  917. (let ((compiler-path
  918. (substitute-in-file-name (nth 1 jde-compiler))))
  919. (if (string= compiler-path "")
  920. (if (executable-find "jikes")
  921. (setq compiler-path "jikes")
  922. (error "Cannot find jikes."))
  923. (unless
  924. (or
  925. (file-exists-p
  926. (if (and
  927. (eq system-type 'windows-nt)
  928. (not (string-match "[.]exe$" compiler-path)))
  929. (concat compiler-path ".exe")
  930. compiler-path))
  931. (executable-find compiler-path))
  932. (error "Invalid compiler path: %s" compiler-path)))
  933. (jde-compile-jikes
  934. "Jikes"
  935. :use-server-p nil
  936. :path compiler-path)))
  937. (defun jde-compile-get-the-compiler ()
  938. "Get a compiler object that represents the compiler specified
  939. by `jde-compiler'."
  940. (let ((compiler-name (car jde-compiler)))
  941. (cond
  942. ((string-match "javac" compiler-name)
  943. (jde-compile-get-javac))
  944. ((string-match "jikes" compiler-name)
  945. (jde-compile-get-jikes))
  946. (t
  947. (error "The JDEE does not support a compiler named %s" compiler-name)))))
  948. ;;;###autoload
  949. (defun jde-set-compile-options (options)
  950. "Sets the compile options.
  951. Enter the options as you would on the command line, e.g.,
  952. -depend -verbose."
  953. (interactive
  954. "sEnter options: ")
  955. (setq jde-compile-option-command-line-args (split-string options " ")))
  956. ;;;###autoload
  957. (defun jde-compile ()
  958. "Compile the Java program in the current buffer.
  959. This command invokes the compiler specified by `jde-compiler'
  960. with the options specified by the JDE customization variables
  961. that begin with `jde-compile'. If the variable
  962. `jde-read-compile-args' is non-nil, this command reads
  963. additional compilation options from the minibuffer, with
  964. history enabled. If `jde-compiler' specifies the JDE compile
  965. server, this command uses the compile server. Otherwise, it
  966. uses the compiler executable specified by
  967. `jde-compiler' to compile."
  968. (interactive)
  969. (if jde-read-compile-args
  970. (setq jde-interactive-compile-args
  971. (read-from-minibuffer
  972. "Compile args: "
  973. jde-interactive-compile-args
  974. nil nil
  975. '(jde-interactive-compile-arg-history . 1))))
  976. ;; Force save-some-buffers to use the minibuffer
  977. ;; to query user about whether to save modified buffers.
  978. ;; Otherwise, when user invokes jde-compile from
  979. ;; menu, save-some-buffers tries to popup a menu
  980. ;; which seems not to be supported--at least on
  981. ;; the PC.
  982. (if (and (eq system-type 'windows-nt)
  983. (not jde-xemacsp))
  984. (let ((temp last-nonmenu-event))
  985. ;; The next line makes emacs think that jde-compile
  986. ;; was invoked from the minibuffer, even when it
  987. ;; is actually invoked from the menu-bar.
  988. (setq last-nonmenu-event t)
  989. (save-some-buffers (not compilation-ask-about-save) nil)
  990. (setq last-nonmenu-event temp))
  991. (save-some-buffers (not compilation-ask-about-save) nil))
  992. (setq compilation-finish-function
  993. (lambda (buf msg)
  994. (run-hook-with-args 'jde-compile-finish-hook buf msg)
  995. (setq compilation-finish-function nil)))
  996. (let ((compiler (jde-compile-get-the-compiler)))
  997. (if compiler
  998. (progn
  999. (oset compiler
  1000. :interactive-args
  1001. (if (and jde-interactive-compile-args
  1002. (not (string= jde-interactive-compile-args "")))
  1003. (split-string jde-interactive-compile-args " ")))
  1004. (jde-compile-compile compiler))
  1005. (error "Unknown compiler. Aborting compilation."))))
  1006. (provide 'jde-compile)
  1007. ;; Change History
  1008. ;; $Log: jde-compile.el,v $
  1009. ;; Revision 1.63 2004/10/20 06:17:06 paulk
  1010. ;; Update to support reloading classes from a single classpath entry. Thanks to Martin Schwamberger.
  1011. ;;
  1012. ;; Revision 1.62 2004/08/21 04:29:20 paulk
  1013. ;; Update the wizard class list after compiling a class.
  1014. ;;
  1015. ;; Revision 1.61 2004/08/03 03:55:00 paulk
  1016. ;; Emacs 21.3.5 compatibility fix: Updated jde-compile-finish-kill-buffer to include prefix argument which is not optional in Emacs 21.3.5.
  1017. ;;
  1018. ;; Revision 1.60 2004/05/26 05:15:33 paulk
  1019. ;; Fix version-matching bug in jde-compile-get-javac.
  1020. ;;
  1021. ;; Revision 1.59 2004/04/15 03:58:59 paulk
  1022. ;; Add "default" option to jde-compile-option-source.
  1023. ;;
  1024. ;; Revision 1.58 2004/02/22 08:02:29 paulk
  1025. ;; Update to support J2SDK1.5.0.
  1026. ;;
  1027. ;; Revision 1.57 2003/07/15 11:56:23 paulk
  1028. ;; Update jde-compile-option-target.
  1029. ;;
  1030. ;; Revision 1.56 2003/04/08 03:16:28 paulk
  1031. ;; Fixes regression that causes compilation buffer's default directory to be set incorrectly. Also rename compile server buffer from *compilation* to *JDEE Compile Server*
  1032. ;;
  1033. ;; Revision 1.55 2003/04/05 06:26:19 paulk
  1034. ;; Added jde-compile-jump-to-first-error option. Thanks to Sean Wellington.
  1035. ;;
  1036. ;; Revision 1.54 2003/04/04 13:35:00 jslopez
  1037. ;; Adds the source argument to the jikes compiler.
  1038. ;;
  1039. ;; Revision 1.53 2003/03/04 10:12:50 paulk
  1040. ;; Updated the compile server to use the new compilation-mode buffer support
  1041. ;; provided by bsh class.
  1042. ;;
  1043. ;; Revision 1.52 2003/02/28 04:13:33 jslopez
  1044. ;; Adds customization variable jde-compile-enable-kill-buffer. If true the
  1045. ;; jde-compile-finish-kill-buffer hook will kill the compilation buffer.
  1046. ;;
  1047. ;; Revision 1.51 2003/02/17 08:13:05 paulk
  1048. ;; Changes required to support new package-independent version of beanshell.el
  1049. ;;
  1050. ;; Revision 1.50 2003/02/07 00:31:57 jslopez
  1051. ;; Adds jde-compile-option-source to be compile 1.4 code with
  1052. ;; the assert key word on it.
  1053. ;;
  1054. ;; Revision 1.49 2002/12/12 05:24:46 paulk
  1055. ;; Fixed bug that caused the compile command to fail when jikes
  1056. ;; is the compiler and jde-compiler does not specify the path of the
  1057. ;; jikes executable.
  1058. ;;
  1059. ;; Revision 1.48 2002/11/22 09:32:13 paulk
  1060. ;; Improve error reporting when a user attempts to use an unsupported compiler.
  1061. ;;
  1062. ;; Revision 1.47 2002/11/05 07:47:25 paulk
  1063. ;; Mac OS (darwin) compatibility fix: find path of javac compiler. Thanks to Andrew Hyatt.
  1064. ;;
  1065. ;; Revision 1.46 2002/09/18 15:20:19 jslopez
  1066. ;; Fixes bug in jde-compile-finish-kill-buffer.
  1067. ;; The regexp BUILD FAILED was being match agains the wrong string.
  1068. ;; Now it is being match against the contents of the compilation buffer.
  1069. ;;
  1070. ;; Revision 1.45 2002/09/16 04:23:50 paulk
  1071. ;; Added missing -encoding switch for compiler encoding command line argument.
  1072. ;; Thanks to Toru Takahashi.
  1073. ;;
  1074. ;; Revision 1.44 2002/08/07 06:36:20 paulk
  1075. ;; Removed code intended to eliminate spurious warnings when byte-compiling the JDEE. The
  1076. ;; removed code now resides in a separate package, jde-compat.el. Thanks to Andy Piper
  1077. ;; for suggesting this restructuring. Also fixed a number of compiler warnings caused
  1078. ;; by genuine bugs.
  1079. ;;
  1080. ;; Revision 1.43 2002/08/03 05:01:45 paulk
  1081. ;; Added a jde-compile-finish-hook function that kills the compilation
  1082. ;; buffer if no compilation errors occured. Thanks to Jack Donohue <donohuej@synovation.com>.
  1083. ;;
  1084. ;; Revision 1.42 2002/06/12 07:04:30 paulk
  1085. ;; XEmacs compatibility fix: set win32-quote-process-args wherever
  1086. ;; the JDEE sets w32-quote-process-args. This allows use of spaces in
  1087. ;; paths passed as arguments to processes (e.g., javac) started by
  1088. ;; the JDEE.
  1089. ;;
  1090. ;; Revision 1.41 2002/06/11 06:24:27 paulk
  1091. ;; Provides support for paths containing spaces as compiler arguments via the following changes;
  1092. ;; - Locally set the w32-quote-process-args variable to a quotation mark.
  1093. ;; - The compile server Lisp code now passes the compiler arguments to the
  1094. ;; compile server Java code as an array of strings instead of as a single space-delimited
  1095. ;; string of arguments.
  1096. ;;
  1097. ;; Revision 1.40 2002/05/12 06:23:20 paulk
  1098. ;; Replaced call to jde-complete-get-name-of-this-class with call to
  1099. ;; jde-parse-buffer-class.
  1100. ;;
  1101. ;; Revision 1.39 2002/03/17 14:20:40 jslopez
  1102. ;; Fixes bug using jde-compile-option-vm-args.
  1103. ;;
  1104. ;; Revision 1.38 2002/03/03 14:42:26 jslopez
  1105. ;; Fixes bug getting compilation status in
  1106. ;; linux.
  1107. ;;
  1108. ;; Revision 1.37 2002/03/03 13:51:03 jslopez
  1109. ;; Fixes bug getting compilation status code.
  1110. ;; Makes the code more robust.
  1111. ;;
  1112. ;; Revision 1.36 2002/02/25 20:10:41 jslopez
  1113. ;; The Compile Server now uses its own filter.
  1114. ;;
  1115. ;; Revision 1.35 2002/02/15 02:52:42 jslopez
  1116. ;; Updates the compile server to be interactive.
  1117. ;;
  1118. ;; Revision 1.34 2001/12/12 05:40:53 paulk
  1119. ;; Removed an extraneous print form from jde-compile-run-exec that was dumping
  1120. ;; the compiler arguments into the minibuffer.
  1121. ;;
  1122. ;; Revision 1.33 2001/12/09 17:09:26 jslopez
  1123. ;; Adding the -classpath flag when the classpath is nil.
  1124. ;;
  1125. ;; Revision 1.32 2001/12/09 17:01:04 jslopez
  1126. ;; Fixes bug in the method jde-compile-classpath-arg (jikes)
  1127. ;; that will cause an error when appending the path for rt.jar
  1128. ;; to a nil classpath.
  1129. ;;
  1130. ;; Revision 1.31 2001/12/08 05:49:20 paulk
  1131. ;; Fixed jde-compile-get-javac to handle unknown version of the JDK.
  1132. ;;
  1133. ;; Revision 1.30 2001/11/29 10:00:33 paulk
  1134. ;; Fixed bug where the JDE was inserting a null string in the javac
  1135. ;; argument list when the user did not specify arguments interactively, which is normally the case. This bug caused compiling with the javac executable to fail on XEmacs.
  1136. ;;
  1137. ;; Revision 1.29 2001/11/28 08:32:10 paulk
  1138. ;; Compile server now runs jde-normalize-path on the path of the path of the source file.
  1139. ;; This ensures that the path will be converted to a Windows path on the Cygwin version
  1140. ;; of XEmacs.
  1141. ;;
  1142. ;; Revision 1.28 2001/11/23 14:21:47 paulk
  1143. ;; Fixed cut-and-paste error in the debug options error messages for Jikes.
  1144. ;;
  1145. ;; Revision 1.27 2001/10/24 04:13:33 jslopez
  1146. ;; Adds the customization variable jde-compile-option-hide-classpath.
  1147. ;; A non-nil variable causes the classpath value in the compilation
  1148. ;; output to be shown as ... . i.e java -classpath ... -g Test.
  1149. ;;
  1150. ;; Revision 1.26 2001/10/19 10:10:59 paulk
  1151. ;; Removed space in front of -g option that made it unrecognizable to compiler.
  1152. ;; Thanks to bert van vreckem.
  1153. ;;
  1154. ;; Revision 1.25 2001/10/19 04:14:20 paulk
  1155. ;; Bug fix: compile command once again supports the jde-read-compile-args option.
  1156. ;; Thanks to Luis Novais for reporting this bug.
  1157. ;;
  1158. ;; Revision 1.24 2001/10/16 05:10:50 paulk
  1159. ;; - Fixed Lisp error that occurred when the default setting
  1160. ;; for jde-compile-option-debug is in effect.
  1161. ;;
  1162. ;; - XEmacs compatibility fix. Fixed undefined variable and
  1163. ;; function Lisp errors that occur when trying to compile
  1164. ;; a Java source file.
  1165. ;;
  1166. ;; - XEmacs compatibility fix. Fixed bug that produced a Beanshell
  1167. ;; error when trying to run the compile server in XEmacs.
  1168. ;;
  1169. ;; Revision 1.23 2001/10/08 13:06:11 paulk
  1170. ;; Minor restructuring of compile server code.
  1171. ;;
  1172. ;; Revision 1.22 2001/10/05 11:02:27 paulk
  1173. ;; Reordered the compile server output message so that the file name follows the other arguments.
  1174. ;;
  1175. ;; Revision 1.21 2001/10/05 04:08:01 paulk
  1176. ;; - Fixed compile error that occurs when jde-compile-option-debug is set.
  1177. ;; This was due to the -g option being wrapped in an extra list.
  1178. ;; - Now includes rt.jar in the classpath when jikes is the compiler.
  1179. ;; Thanks to David Ponce.
  1180. ;;
  1181. ;; Revision 1.20 2001/10/01 20:48:58 jslopez
  1182. ;; Added support for jdk1.4.
  1183. ;;
  1184. ;; Revision 1.19 2001/10/01 12:02:34 paulk
  1185. ;; - Now uses the version of javac shipped with the JDK specified by jde-jdk.
  1186. ;; - Now generates the correct options for the various versions of javac.
  1187. ;; - Now includes the +E options if jikes is the selected compiler.
  1188. ;;
  1189. ;; Revision 1.18 2001/10/01 02:24:49 paulk
  1190. ;; - Created jde-compile-javac, jde-compile-jikes, jde-compile-javac-11x classes.
  1191. ;;
  1192. ;; - Fixed missing slot names in jde-compile-compiler class. Thanks to Eric Friedman.
  1193. ;;
  1194. ;; Revision 1.17 2001/09/28 05:10:10 paulk
  1195. ;; - Redefined jde-compiler to allow selection of the
  1196. ;; following options: javac executable, javac server,
  1197. ;; and jikes executable.
  1198. ;;
  1199. ;; - Redefinded jde-compile-option-command-line-args to
  1200. ;; accept a list of strings, each corresponding to one
  1201. ;; argument.
  1202. ;;
  1203. ;; - Created a new class jde-compile-compiler to serve
  1204. ;; as the root class for all compilers supported by
  1205. ;; the JDE. This should promote sharing code among
  1206. ;; the compilers.
  1207. ;;
  1208. ;; Revision 1.16 2001/08/30 13:21:57 jslopez
  1209. ;; Fixed bug in jde-compile-internal that did not scroll the compilation output
  1210. ;; when the compile server and compilation-scroll-output were enable.
  1211. ;;
  1212. ;; Revision 1.15 2001/08/30 01:31:54 paulk
  1213. ;; Adds support for compile server. Thanks to Javier Lopez.
  1214. ;;
  1215. ;; Revision 1.14 2001/04/16 05:47:33 paulk
  1216. ;; Normalized paths. Thanks to Nick Sieger.
  1217. ;;
  1218. ;; Revision 1.13 2001/04/11 03:23:18 paulk
  1219. ;; Updated to r

Large files files are truncated, but you can click here to view the full file